linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary Bisson <gary.bisson@boundarydevices.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod][PATCH 3/3] Android.bp: initial addition
Date: Mon, 17 Aug 2020 10:38:35 +0200	[thread overview]
Message-ID: <20200817083835.GB91176@p1g2> (raw)
In-Reply-To: <CAMRc=MdaMKEW2n32eYD7q1R6V4GWGakk2xmUWmejncLD-x+pYQ@mail.gmail.com>

Hi,

On Mon, Aug 10, 2020 at 09:51:07PM +0200, Bartosz Golaszewski wrote:
> On Mon, Jun 8, 2020 at 11:07 AM Gary Bisson
> <gary.bisson@boundarydevices.com> wrote:
> >
> > - Defines both shared and static versions of libgpiod
> > - Defines all the libs/tools as vendor (installed in /vendor)
> >
> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> > ---
> > Hi,
> >
> > One thing that isn't ideal here is to set GPIOD_VERSION_STR manually,
> > that will require to keep track of it for all versions.
> >
> > Not sure if there's a better way to provide that value to Android.bp.
> >
> 
> I don't know Android very well but if its build system can launch
> autotools, then maybe you could autotoolify this file by providing
> Android.bp.in and letting autotools expand this macro?

No unfortunately that is not how the AOSP build system works (or at
least I'm not aware of it).
AFAIK all the open-source projects used in AOSP (see external/ folder)
have a separate Android.bp alongside the autotools files.

Here are a few examples of Android.bp files added by Google to
well-known projects:
- curl [1]
- iputils [2]
- strace [3]

In the case above it is up to Google to maintain that file as only
hosted on their servers (not merged upstream).
But some other projects are ok merging it which makes it easier (at
least for me) like can-utils [4].

> > Regards,
> > Gary
> > ---
> >  Android.bp | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 95 insertions(+)
> >  create mode 100644 Android.bp
> >
> > diff --git a/Android.bp b/Android.bp
> > new file mode 100644
> > index 0000000..6c437df
> > --- /dev/null
> > +++ b/Android.bp
> > @@ -0,0 +1,95 @@
> > +cc_library_shared {
> > +    name: "libgpiod",
> > +    vendor: true,
> > +    srcs: [
> > +        "lib/core.c",
> > +        "lib/ctxless.c",
> > +        "lib/helpers.c",
> > +        "lib/iter.c",
> > +        "lib/misc.c",
> > +    ],
> > +    cflags: ["-Werror", "-Wno-macro-redefined", "-DGPIOD_VERSION_STR=\"1.6-devel\""],
> > +    export_include_dirs: ["include"],
> > +    local_include_dirs: ["include"],
> > +}
> > +
> > +cc_library_static {
> > +    name: "libgpiod_static",
> > +    vendor: true,
> > +    srcs: [
> > +        "lib/core.c",
> > +        "lib/ctxless.c",
> > +        "lib/helpers.c",
> > +        "lib/iter.c",
> > +        "lib/misc.c",
> > +    ],
> > +    cflags: ["-Werror", "-Wno-macro-redefined", "-DGPIOD_VERSION_STR=\"1.6-devel\""],
> > +    export_include_dirs: ["include"],
> > +    local_include_dirs: ["include"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpiodetect",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpiodetect.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpiofind",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpiofind.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpioget",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpioget.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpioinfo",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpioinfo.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpiomon",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpiomon.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > +
> > +cc_binary {
> > +    name: "gpioset",
> > +    vendor: true,
> > +    srcs: [
> > +        "tools/tools-common.c",
> > +        "tools/gpioset.c",
> > +    ],
> > +    shared_libs: ["libgpiod"],
> > +    cflags: ["-Werror"],
> > +}
> > --
> > 2.26.2
> >
> 
> Can I somehow test this build file on linux? We'll surely be expanding
> libgpiod in the future so I need to be able to update this file.

I'm not sure what's the easiest way to get you a build env.
In my case I use the full AOSP tree [5][6] which might not be ideal for
you as it involves pulling 40G+ of data.
For me the commands were:
$ source build/envsetup.sh
$ lunch aosp_arm-eng
$ mmm external/libgpiod

Maybe someone else has a way to setup a Soong build without pulling
everything.

Let me know if you have any questions.

Regards,
Gary

[1] https://android.googlesource.com/platform/external/curl/+/refs/heads/master/Android.bp
[2] https://android.googlesource.com/platform/external/iputils/+/refs/heads/master/Android.bp
[3] https://android.googlesource.com/platform/external/strace/+/refs/heads/master/Android.bp
[4] https://github.com/linux-can/can-utils/blob/master/Android.mk
[5] https://source.android.com/setup/build/downloading
[6] https://source.android.com/setup/build/building

  reply	other threads:[~2020-08-17  8:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08  9:06 [libgpiod][PATCH 0/3] Add Android build support Gary Bisson
2020-06-08  9:06 ` [libgpiod][PATCH 1/3] core: add missing header inclusion Gary Bisson
2020-06-08  9:06 ` [libgpiod][PATCH 2/3] tools-common: fix build for Android Gary Bisson
2020-08-10 19:15   ` Bartosz Golaszewski
2020-08-17  8:23     ` Gary Bisson
2020-08-17 13:04       ` Bartosz Golaszewski
2020-08-18 16:04         ` Gary Bisson
2020-06-08  9:06 ` [libgpiod][PATCH 3/3] Android.bp: initial addition Gary Bisson
2020-08-10 19:51   ` Bartosz Golaszewski
2020-08-17  8:38     ` Gary Bisson [this message]
2020-08-17 16:24       ` Bartosz Golaszewski
2020-08-18 16:01         ` Bartosz Golaszewski
2020-08-18 16:05           ` Gary Bisson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200817083835.GB91176@p1g2 \
    --to=gary.bisson@boundarydevices.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).