diff mbox

libaio: allow building on static-only configurations

Message ID 1472501917-28520-1-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Commit 6304578d4e7e9d3b1d42c2630761feaa66a12c3d
Headers show

Commit Message

Thomas Petazzoni Aug. 29, 2016, 8:18 p.m. UTC
This commit adds a simple patch to the libaio build system that allows
it to be used on static-only configurations. It is probably easier to
fix this than to propagate the !BR2_STATIC_LIBS dependency.

Fixes:

  http://autobuild.buildroot.net/results/8c86402bd14a0af1b82e6e07c06531a856dd37c6/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 ...e-add-ENABLE_SHARED-boolean-to-allow-stat.patch | 56 ++++++++++++++++++++++
 package/libaio/libaio.mk                           |  4 ++
 2 files changed, 60 insertions(+)
 create mode 100644 package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch

Comments

Romain Naour Aug. 29, 2016, 8:27 p.m. UTC | #1
Hi Thomas,

Le 29/08/2016 à 22:18, Thomas Petazzoni a écrit :
> This commit adds a simple patch to the libaio build system that allows
> it to be used on static-only configurations. It is probably easier to
> fix this than to propagate the !BR2_STATIC_LIBS dependency.

Ok, I'll reject my patch which disable libaio for static-only build.

Reviewed-by: Romain Naour <romain.naour@gmail.com>
[build tested]
Tested-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/8c86402bd14a0af1b82e6e07c06531a856dd37c6/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  ...e-add-ENABLE_SHARED-boolean-to-allow-stat.patch | 56 ++++++++++++++++++++++
>  package/libaio/libaio.mk                           |  4 ++
>  2 files changed, 60 insertions(+)
>  create mode 100644 package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch
> 
> diff --git a/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch b/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch
> new file mode 100644
> index 0000000..50703c3
> --- /dev/null
> +++ b/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch
> @@ -0,0 +1,56 @@
> +From 14dee5707716629b1bc8d06b93cdfe9ea1a3b813 Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +Date: Mon, 29 Aug 2016 22:14:26 +0200
> +Subject: [PATCH] src/Makefile: add ENABLE_SHARED boolean to allow static-only
> + build
> +
> +Currently, the libaio builds sytem builds a shared library
> +unconditionally. In some environments, this is not possible or
> +desirable. This commit adds a new Makefile variable, ENABLE_SHARED,
> +which defaults to "1" (i.e shared library enabled) and that allows to
> +override this behavior, and therefore to disable the build and
> +installation of the shared library.
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +---
> + src/Makefile | 9 ++++++++-
> + 1 file changed, 8 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/Makefile b/src/Makefile
> +index eadb336..cfab240 100644
> +--- a/src/Makefile
> ++++ b/src/Makefile
> +@@ -8,12 +8,17 @@ SO_CFLAGS=-shared $(CFLAGS)
> + L_CFLAGS=$(CFLAGS)
> + LINK_FLAGS=
> + LINK_FLAGS+=$(LDFLAGS)
> ++ENABLE_SHARED ?= 1
> + 
> + soname=libaio.so.1
> + minor=0
> + micro=1
> + libname=$(soname).$(minor).$(micro)
> +-all_targets += libaio.a $(libname)
> ++all_targets += libaio.a
> ++
> ++ifeq ($(ENABLE_SHARED),1)
> ++all_targets += $(libname)
> ++endif
> + 
> + all: $(all_targets)
> + 
> +@@ -55,9 +60,11 @@ $(libname): $(libaio_sobjs) libaio.map
> + install: $(all_targets)
> + 	install -D -m 644 libaio.h $(includedir)/libaio.h
> + 	install -D -m 644 libaio.a $(libdir)/libaio.a
> ++ifeq ($(ENABLE_SHARED),1)
> + 	install -D -m 755 $(libname) $(libdir)/$(libname)
> + 	ln -sf $(libname) $(libdir)/$(soname)
> + 	ln -sf $(libname) $(libdir)/libaio.so
> ++endif
> + 
> + $(libaio_objs): libaio.h
> + 
> +-- 
> +2.7.4
> +
> diff --git a/package/libaio/libaio.mk b/package/libaio/libaio.mk
> index 0854fc5..5ebe1b7 100644
> --- a/package/libaio/libaio.mk
> +++ b/package/libaio/libaio.mk
> @@ -13,6 +13,10 @@ LIBAIO_LICENSE_FILES = COPYING
>  
>  LIBAIO_CONFIGURE_OPTS = $(TARGET_CONFIGURE_OPTS)
>  
> +ifeq ($(BR2_STATIC_LIBS),y)
> +LIBAIO_CONFIGURE_OPTS += ENABLE_SHARED=0
> +endif
> +
>  # On PowerPC, a weird toolchain issue causes -Os builds to produce
>  # references to hidden symbols, so we're forcing -O2
>  ifeq ($(BR2_powerpc),y)
>
Peter Korsgaard Aug. 29, 2016, 9:25 p.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > This commit adds a simple patch to the libaio build system that allows
 > it to be used on static-only configurations. It is probably easier to
 > fix this than to propagate the !BR2_STATIC_LIBS dependency.

 > Fixes:

 >   http://autobuild.buildroot.net/results/8c86402bd14a0af1b82e6e07c06531a856dd37c6/

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Committed, thanks. Don't forget to send the patch upstream.
diff mbox

Patch

diff --git a/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch b/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch
new file mode 100644
index 0000000..50703c3
--- /dev/null
+++ b/package/libaio/0002-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch
@@ -0,0 +1,56 @@ 
+From 14dee5707716629b1bc8d06b93cdfe9ea1a3b813 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Mon, 29 Aug 2016 22:14:26 +0200
+Subject: [PATCH] src/Makefile: add ENABLE_SHARED boolean to allow static-only
+ build
+
+Currently, the libaio builds sytem builds a shared library
+unconditionally. In some environments, this is not possible or
+desirable. This commit adds a new Makefile variable, ENABLE_SHARED,
+which defaults to "1" (i.e shared library enabled) and that allows to
+override this behavior, and therefore to disable the build and
+installation of the shared library.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ src/Makefile | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index eadb336..cfab240 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -8,12 +8,17 @@ SO_CFLAGS=-shared $(CFLAGS)
+ L_CFLAGS=$(CFLAGS)
+ LINK_FLAGS=
+ LINK_FLAGS+=$(LDFLAGS)
++ENABLE_SHARED ?= 1
+ 
+ soname=libaio.so.1
+ minor=0
+ micro=1
+ libname=$(soname).$(minor).$(micro)
+-all_targets += libaio.a $(libname)
++all_targets += libaio.a
++
++ifeq ($(ENABLE_SHARED),1)
++all_targets += $(libname)
++endif
+ 
+ all: $(all_targets)
+ 
+@@ -55,9 +60,11 @@ $(libname): $(libaio_sobjs) libaio.map
+ install: $(all_targets)
+ 	install -D -m 644 libaio.h $(includedir)/libaio.h
+ 	install -D -m 644 libaio.a $(libdir)/libaio.a
++ifeq ($(ENABLE_SHARED),1)
+ 	install -D -m 755 $(libname) $(libdir)/$(libname)
+ 	ln -sf $(libname) $(libdir)/$(soname)
+ 	ln -sf $(libname) $(libdir)/libaio.so
++endif
+ 
+ $(libaio_objs): libaio.h
+ 
+-- 
+2.7.4
+
diff --git a/package/libaio/libaio.mk b/package/libaio/libaio.mk
index 0854fc5..5ebe1b7 100644
--- a/package/libaio/libaio.mk
+++ b/package/libaio/libaio.mk
@@ -13,6 +13,10 @@  LIBAIO_LICENSE_FILES = COPYING
 
 LIBAIO_CONFIGURE_OPTS = $(TARGET_CONFIGURE_OPTS)
 
+ifeq ($(BR2_STATIC_LIBS),y)
+LIBAIO_CONFIGURE_OPTS += ENABLE_SHARED=0
+endif
+
 # On PowerPC, a weird toolchain issue causes -Os builds to produce
 # references to hidden symbols, so we're forcing -O2
 ifeq ($(BR2_powerpc),y)