From 4dc04ef55710f7f5c1e55ebb5cba8e22a126404e Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Aug 14 2018 21:17:13 +0000 Subject: [PATCH 1/2] 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 --- 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 From 517d9fbe63fbd7e72445dce1cb3f3d8457d838cb Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Aug 14 2018 21:17:25 +0000 Subject: [PATCH 2/2] Makefile: add missing DESTDIR variable use Patch borrowed from OpenEmbedded, available at recipes/libaio/libaio-0.3.106/destdir.patch in their source tree. It just adds support for the traditional DESTDIR variable to install the library in a different sysroot than the normal /. Signed-off-by: Thomas Petazzoni --- diff --git a/Makefile b/Makefile index e9dbdb0..c1fb831 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ all: @$(MAKE) -C src install: - @$(MAKE) -C src install prefix=$(prefix) includedir=$(includedir) libdir=$(libdir) + @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir) check: @$(MAKE) -C harness check