* [libgpiod][PATCH 0/3] Add Android build support @ 2020-06-08 9:06 Gary Bisson 2020-06-08 9:06 ` [libgpiod][PATCH 1/3] core: add missing header inclusion Gary Bisson ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Gary Bisson @ 2020-06-08 9:06 UTC (permalink / raw) To: linux-gpio; +Cc: Gary Bisson Hi, This series adds support to build libgpiod library and tools as part of an Android build. Some comments are included into the individual patches, to explain the choices made. This was tested inside an Android 10 AOSP tree. Let me know if you have any questions. Regards, Gary Gary Bisson (3): core: add missing header inclusion tools-common: fix build for Android Android.bp: initial addition Android.bp | 95 ++++++++++++++++++++++++++++++++++++++++++++ lib/core.c | 1 + tools/tools-common.c | 10 +++-- 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 Android.bp -- 2.26.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [libgpiod][PATCH 1/3] core: add missing header inclusion 2020-06-08 9:06 [libgpiod][PATCH 0/3] Add Android build support Gary Bisson @ 2020-06-08 9:06 ` Gary Bisson 2020-06-08 9:06 ` [libgpiod][PATCH 2/3] tools-common: fix build for Android Gary Bisson 2020-06-08 9:06 ` [libgpiod][PATCH 3/3] Android.bp: initial addition Gary Bisson 2 siblings, 0 replies; 13+ messages in thread From: Gary Bisson @ 2020-06-08 9:06 UTC (permalink / raw) To: linux-gpio; +Cc: Gary Bisson Otherwise throwing the following error: lib/core.c:102:9: error: implicit declaration of function 'basename' is invalid in C99 Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> --- lib/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core.c b/lib/core.c index f704b44..b71a284 100644 --- a/lib/core.c +++ b/lib/core.c @@ -10,6 +10,7 @@ #include <errno.h> #include <fcntl.h> #include <gpiod.h> +#include <libgen.h> #include <limits.h> #include <linux/gpio.h> #include <poll.h> -- 2.26.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [libgpiod][PATCH 2/3] tools-common: fix build for Android 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 ` Gary Bisson 2020-08-10 19:15 ` Bartosz Golaszewski 2020-06-08 9:06 ` [libgpiod][PATCH 3/3] Android.bp: initial addition Gary Bisson 2 siblings, 1 reply; 13+ messages in thread From: Gary Bisson @ 2020-06-08 9:06 UTC (permalink / raw) To: linux-gpio; +Cc: Gary Bisson program_invocation_name doesn't exist in Android, getprogname() should be used instead. Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> --- Hi, I couldn't an equivalent to program_invocation_short_name, so the program is now using program_invocation_name all the time, hope it's ok. Regards, Gary --- tools/tools-common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/tools-common.c b/tools/tools-common.c index 12bde20..1d7fc2c 100644 --- a/tools/tools-common.c +++ b/tools/tools-common.c @@ -21,7 +21,11 @@ const char *get_progname(void) { +#if defined __ANDROID__ + return getprogname(); +#else return program_invocation_name; +#endif } void die(const char *fmt, ...) @@ -29,7 +33,7 @@ void die(const char *fmt, ...) va_list va; va_start(va, fmt); - fprintf(stderr, "%s: ", program_invocation_name); + fprintf(stderr, "%s: ", get_progname()); vfprintf(stderr, fmt, va); fprintf(stderr, "\n"); va_end(va); @@ -42,7 +46,7 @@ void die_perror(const char *fmt, ...) va_list va; va_start(va, fmt); - fprintf(stderr, "%s: ", program_invocation_name); + fprintf(stderr, "%s: ", get_progname()); vfprintf(stderr, fmt, va); fprintf(stderr, ": %s\n", strerror(errno)); va_end(va); @@ -53,7 +57,7 @@ void die_perror(const char *fmt, ...) void print_version(void) { printf("%s (libgpiod) v%s\n", - program_invocation_short_name, gpiod_version_string()); + get_progname(), gpiod_version_string()); printf("Copyright (C) 2017-2018 Bartosz Golaszewski\n"); printf("License: LGPLv2.1\n"); printf("This is free software: you are free to change and redistribute it.\n"); -- 2.26.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 2/3] tools-common: fix build for Android 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 0 siblings, 1 reply; 13+ messages in thread From: Bartosz Golaszewski @ 2020-08-10 19:15 UTC (permalink / raw) To: Gary Bisson; +Cc: open list:GPIO SUBSYSTEM On Mon, Jun 8, 2020 at 11:07 AM Gary Bisson <gary.bisson@boundarydevices.com> wrote: > > program_invocation_name doesn't exist in Android, getprogname() should > be used instead. > > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> > --- > Hi, > > I couldn't an equivalent to program_invocation_short_name, so the > program is now using program_invocation_name all the time, hope it's ok. > > Regards, > Gary > --- > tools/tools-common.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tools/tools-common.c b/tools/tools-common.c > index 12bde20..1d7fc2c 100644 > --- a/tools/tools-common.c > +++ b/tools/tools-common.c > @@ -21,7 +21,11 @@ > > const char *get_progname(void) > { > +#if defined __ANDROID__ I'd prefer to keep libgpiod Android-agnostic. Does prctl() exist in Android? It too can be used for that. Bartosz > + return getprogname(); > +#else > return program_invocation_name; > +#endif > } > > void die(const char *fmt, ...) > @@ -29,7 +33,7 @@ void die(const char *fmt, ...) > va_list va; > > va_start(va, fmt); > - fprintf(stderr, "%s: ", program_invocation_name); > + fprintf(stderr, "%s: ", get_progname()); > vfprintf(stderr, fmt, va); > fprintf(stderr, "\n"); > va_end(va); > @@ -42,7 +46,7 @@ void die_perror(const char *fmt, ...) > va_list va; > > va_start(va, fmt); > - fprintf(stderr, "%s: ", program_invocation_name); > + fprintf(stderr, "%s: ", get_progname()); > vfprintf(stderr, fmt, va); > fprintf(stderr, ": %s\n", strerror(errno)); > va_end(va); > @@ -53,7 +57,7 @@ void die_perror(const char *fmt, ...) > void print_version(void) > { > printf("%s (libgpiod) v%s\n", > - program_invocation_short_name, gpiod_version_string()); > + get_progname(), gpiod_version_string()); > printf("Copyright (C) 2017-2018 Bartosz Golaszewski\n"); > printf("License: LGPLv2.1\n"); > printf("This is free software: you are free to change and redistribute it.\n"); > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 2/3] tools-common: fix build for Android 2020-08-10 19:15 ` Bartosz Golaszewski @ 2020-08-17 8:23 ` Gary Bisson 2020-08-17 13:04 ` Bartosz Golaszewski 0 siblings, 1 reply; 13+ messages in thread From: Gary Bisson @ 2020-08-17 8:23 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: open list:GPIO SUBSYSTEM Hi, Sorry for the delay. On Mon, Aug 10, 2020 at 09:15:18PM +0200, Bartosz Golaszewski wrote: > On Mon, Jun 8, 2020 at 11:07 AM Gary Bisson > <gary.bisson@boundarydevices.com> wrote: > > > > program_invocation_name doesn't exist in Android, getprogname() should > > be used instead. > > > > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> > > --- > > Hi, > > > > I couldn't an equivalent to program_invocation_short_name, so the > > program is now using program_invocation_name all the time, hope it's ok. > > > > Regards, > > Gary > > --- > > tools/tools-common.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/tools/tools-common.c b/tools/tools-common.c > > index 12bde20..1d7fc2c 100644 > > --- a/tools/tools-common.c > > +++ b/tools/tools-common.c > > @@ -21,7 +21,11 @@ > > > > const char *get_progname(void) > > { > > +#if defined __ANDROID__ > > I'd prefer to keep libgpiod Android-agnostic. Does prctl() exist in > Android? It too can be used for that. Yes I understand. prctl() can be used in Android so it would definitely be a better option. Regards, Gary ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 2/3] tools-common: fix build for Android 2020-08-17 8:23 ` Gary Bisson @ 2020-08-17 13:04 ` Bartosz Golaszewski 2020-08-18 16:04 ` Gary Bisson 0 siblings, 1 reply; 13+ messages in thread From: Bartosz Golaszewski @ 2020-08-17 13:04 UTC (permalink / raw) To: Gary Bisson; +Cc: open list:GPIO SUBSYSTEM On Mon, Aug 17, 2020 at 10:23 AM Gary Bisson <gary.bisson@boundarydevices.com> wrote: > > Hi, > > Sorry for the delay. > > On Mon, Aug 10, 2020 at 09:15:18PM +0200, Bartosz Golaszewski wrote: > > On Mon, Jun 8, 2020 at 11:07 AM Gary Bisson > > <gary.bisson@boundarydevices.com> wrote: > > > > > > program_invocation_name doesn't exist in Android, getprogname() should > > > be used instead. > > > > > > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> > > > --- > > > Hi, > > > > > > I couldn't an equivalent to program_invocation_short_name, so the > > > program is now using program_invocation_name all the time, hope it's ok. > > > > > > Regards, > > > Gary > > > --- > > > tools/tools-common.c | 10 +++++++--- > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > diff --git a/tools/tools-common.c b/tools/tools-common.c > > > index 12bde20..1d7fc2c 100644 > > > --- a/tools/tools-common.c > > > +++ b/tools/tools-common.c > > > @@ -21,7 +21,11 @@ > > > > > > const char *get_progname(void) > > > { > > > +#if defined __ANDROID__ > > > > I'd prefer to keep libgpiod Android-agnostic. Does prctl() exist in > > Android? It too can be used for that. > > Yes I understand. prctl() can be used in Android so it would definitely > be a better option. > > Regards, > Gary The name returned by prctl(PR_GET_NAME, ...) is equivalent to program_invocation_short_name. That would mean ditching the full executable path everywhere in messages. Alternatively we can just set the full program name at the start of every tool. I'm fine with the latter too as long as we don't stick these __ANDROID__ ifdefs in the tree. Bart ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 2/3] tools-common: fix build for Android 2020-08-17 13:04 ` Bartosz Golaszewski @ 2020-08-18 16:04 ` Gary Bisson 0 siblings, 0 replies; 13+ messages in thread From: Gary Bisson @ 2020-08-18 16:04 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: open list:GPIO SUBSYSTEM Hi, On Mon, Aug 17, 2020 at 03:04:57PM +0200, Bartosz Golaszewski wrote: > On Mon, Aug 17, 2020 at 10:23 AM Gary Bisson > <gary.bisson@boundarydevices.com> wrote: > > > > Hi, > > > > Sorry for the delay. > > > > On Mon, Aug 10, 2020 at 09:15:18PM +0200, Bartosz Golaszewski wrote: > > > On Mon, Jun 8, 2020 at 11:07 AM Gary Bisson > > > <gary.bisson@boundarydevices.com> wrote: > > > > > > > > program_invocation_name doesn't exist in Android, getprogname() should > > > > be used instead. > > > > > > > > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> > > > > --- > > > > Hi, > > > > > > > > I couldn't an equivalent to program_invocation_short_name, so the > > > > program is now using program_invocation_name all the time, hope it's ok. > > > > > > > > Regards, > > > > Gary > > > > --- > > > > tools/tools-common.c | 10 +++++++--- > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/tools/tools-common.c b/tools/tools-common.c > > > > index 12bde20..1d7fc2c 100644 > > > > --- a/tools/tools-common.c > > > > +++ b/tools/tools-common.c > > > > @@ -21,7 +21,11 @@ > > > > > > > > const char *get_progname(void) > > > > { > > > > +#if defined __ANDROID__ > > > > > > I'd prefer to keep libgpiod Android-agnostic. Does prctl() exist in > > > Android? It too can be used for that. > > > > Yes I understand. prctl() can be used in Android so it would definitely > > be a better option. > > > > Regards, > > Gary > > The name returned by prctl(PR_GET_NAME, ...) is equivalent to > program_invocation_short_name. That would mean ditching the full > executable path everywhere in messages. Alternatively we can just set > the full program name at the start of every tool. I'm fine with the > latter too as long as we don't stick these __ANDROID__ ifdefs in the > tree. Ok, I'll test this and send a v2. Might not be before next week though. Regards, Gary ^ permalink raw reply [flat|nested] 13+ messages in thread
* [libgpiod][PATCH 3/3] Android.bp: initial addition 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-06-08 9:06 ` Gary Bisson 2020-08-10 19:51 ` Bartosz Golaszewski 2 siblings, 1 reply; 13+ messages in thread From: Gary Bisson @ 2020-06-08 9:06 UTC (permalink / raw) To: linux-gpio; +Cc: Gary Bisson - 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. 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 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 3/3] Android.bp: initial addition 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 0 siblings, 1 reply; 13+ messages in thread From: Bartosz Golaszewski @ 2020-08-10 19:51 UTC (permalink / raw) To: Gary Bisson; +Cc: open list:GPIO SUBSYSTEM 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? > 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. Bartosz ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 3/3] Android.bp: initial addition 2020-08-10 19:51 ` Bartosz Golaszewski @ 2020-08-17 8:38 ` Gary Bisson 2020-08-17 16:24 ` Bartosz Golaszewski 0 siblings, 1 reply; 13+ messages in thread From: Gary Bisson @ 2020-08-17 8:38 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: open list:GPIO SUBSYSTEM 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 3/3] Android.bp: initial addition 2020-08-17 8:38 ` Gary Bisson @ 2020-08-17 16:24 ` Bartosz Golaszewski 2020-08-18 16:01 ` Bartosz Golaszewski 0 siblings, 1 reply; 13+ messages in thread From: Bartosz Golaszewski @ 2020-08-17 16:24 UTC (permalink / raw) To: Gary Bisson; +Cc: open list:GPIO SUBSYSTEM On Mon, Aug 17, 2020 at 10:38 AM Gary Bisson <gary.bisson@boundarydevices.com> wrote: > > 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]. > I'm perfectly fine with merging this file but I don't like having another place to look at when bumping the version number. I bunched up all API and ABI versions together in configure.ac in order to not forget anything when making new releases. I'm sure Android's build system is not as limited as not to allow to run some external scripts that would at least fetch the current version from configure.ac, is it? > > > 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 Thanks for the links. I have access to a build server so at least for now I can fetch the whole tree alright. Bartosz ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 3/3] Android.bp: initial addition 2020-08-17 16:24 ` Bartosz Golaszewski @ 2020-08-18 16:01 ` Bartosz Golaszewski 2020-08-18 16:05 ` Gary Bisson 0 siblings, 1 reply; 13+ messages in thread From: Bartosz Golaszewski @ 2020-08-18 16:01 UTC (permalink / raw) To: Gary Bisson; +Cc: open list:GPIO SUBSYSTEM On Mon, Aug 17, 2020 at 6:24 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > [snip] > > > > > > 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]. > > > > I'm perfectly fine with merging this file but I don't like having > another place to look at when bumping the version number. I bunched up > all API and ABI versions together in configure.ac in order to not > forget anything when making new releases. > > I'm sure Android's build system is not as limited as not to allow to > run some external scripts that would at least fetch the current > version from configure.ac, is it? > Can you do something like this[1] but make the command fetch the version string from configure.ac? Bartosz [1] http://androidxref.com/9.0.0_r3/xref/external/libmojo/Android.bp#67 [snip] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [libgpiod][PATCH 3/3] Android.bp: initial addition 2020-08-18 16:01 ` Bartosz Golaszewski @ 2020-08-18 16:05 ` Gary Bisson 0 siblings, 0 replies; 13+ messages in thread From: Gary Bisson @ 2020-08-18 16:05 UTC (permalink / raw) To: Bartosz Golaszewski; +Cc: open list:GPIO SUBSYSTEM Hi, On Tue, Aug 18, 2020 at 06:01:13PM +0200, Bartosz Golaszewski wrote: > On Mon, Aug 17, 2020 at 6:24 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > [snip] > > > > > > > > > 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]. > > > > > > > I'm perfectly fine with merging this file but I don't like having > > another place to look at when bumping the version number. I bunched up > > all API and ABI versions together in configure.ac in order to not > > forget anything when making new releases. > > > > I'm sure Android's build system is not as limited as not to allow to > > run some external scripts that would at least fetch the current > > version from configure.ac, is it? > > > > Can you do something like this[1] but make the command fetch the > version string from configure.ac? > > Bartosz > > [1] http://androidxref.com/9.0.0_r3/xref/external/libmojo/Android.bp#67 Yes I'll try to come up with something that get the version from configure.ac. Same as the other patch, might be only next week. Thanks, Gary ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-08-18 16:05 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2020-08-17 16:24 ` Bartosz Golaszewski 2020-08-18 16:01 ` Bartosz Golaszewski 2020-08-18 16:05 ` Gary Bisson
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).