Re: [libgpiod][PATCH 3/3] Android.bp: initial addition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx>
> > ---
> > 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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux