From 8e436ee7727164603dd8e9cc24af74872752b73e Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Mon, 8 Dec 2008 14:41:47 +0000 Subject: have zlib respect BR2_PREFER_STATIC_LIB The ARM uClinux BFLT format apparently doesn't support shared libs nor -fPIC. So let's distinguish between shared and non shared builds by having split rules for libz.a and libz.so based on BR2_PREFER_STATIC_LIB. Signed-off-by: Nicolas Pitre --- package/zlib/zlib.mk | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'package/zlib') diff --git a/package/zlib/zlib.mk b/package/zlib/zlib.mk index 27c1e0113..aa87ff7b7 100644 --- a/package/zlib/zlib.mk +++ b/package/zlib/zlib.mk @@ -18,13 +18,23 @@ $(ZLIB_DIR)/.patched: $(DL_DIR)/$(ZLIB_SOURCE) $(CONFIG_UPDATE) $(@D) touch $@ +ifneq ($(BR2_PREFER_STATIC_LIB),y) +ZLIB_PIC := -fPIC +ZLIB_SHARED := --shared +ZLIB_TARGET := $(TARGET_DIR)/usr/lib/libz.so +else +ZLIB_PIC := +ZLIB_SHARED := +ZLIB_TARGET := $(STAGING_DIR)/usr/lib/libz.a +endif + $(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.patched (cd $(ZLIB_DIR); rm -rf config.cache; \ $(TARGET_CONFIGURE_ARGS) \ $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS) -fPIC" \ + CFLAGS="$(TARGET_CFLAGS) $(ZLIB_PIC)" \ ./configure \ - --shared \ + $(ZLIB_SHARED) \ --prefix=/usr \ --exec-prefix=$(STAGING_DIR)/usr/bin \ --libdir=$(STAGING_DIR)/usr/lib \ @@ -32,14 +42,17 @@ $(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.patched ) touch $@ -$(ZLIB_DIR)/libz.so: $(ZLIB_DIR)/.configured +$(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured $(MAKE) -C $(ZLIB_DIR) all libz.a touch -c $@ -$(STAGING_DIR)/usr/lib/libz.so: $(ZLIB_DIR)/libz.so +$(STAGING_DIR)/usr/lib/libz.a: $(ZLIB_DIR)/libz.a $(INSTALL) -D $(ZLIB_DIR)/libz.a $(STAGING_DIR)/usr/lib/libz.a $(INSTALL) -D $(ZLIB_DIR)/zlib.h $(STAGING_DIR)/usr/include/zlib.h $(INSTALL) $(ZLIB_DIR)/zconf.h $(STAGING_DIR)/usr/include/ + touch -c $@ + +$(STAGING_DIR)/usr/lib/libz.so: $(STAGING_DIR)/usr/lib/libz.a $(INSTALL) $(ZLIB_DIR)/libz.so* $(STAGING_DIR)/usr/lib/ touch -c $@ @@ -49,7 +62,7 @@ $(TARGET_DIR)/usr/lib/libz.so: $(STAGING_DIR)/usr/lib/libz.so -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $@ touch -c $@ -$(TARGET_DIR)/usr/lib/libz.a: $(STAGING_DIR)/usr/lib/libz.so +$(TARGET_DIR)/usr/lib/libz.a: $(STAGING_DIR)/usr/lib/libz.a $(INSTALL) -D $(STAGING_DIR)/usr/include/zlib.h $(TARGET_DIR)/usr/include/zlib.h $(INSTALL) $(STAGING_DIR)/usr/include/zconf.h $(TARGET_DIR)/usr/include/ $(INSTALL) -D $(STAGING_DIR)/usr/lib/libz.a $(TARGET_DIR)/usr/lib/libz.a @@ -57,7 +70,7 @@ $(TARGET_DIR)/usr/lib/libz.a: $(STAGING_DIR)/usr/lib/libz.so zlib-headers: $(TARGET_DIR)/usr/lib/libz.a -zlib: uclibc $(TARGET_DIR)/usr/lib/libz.so +zlib: uclibc $(ZLIB_TARGET) zlib-source: $(DL_DIR)/$(ZLIB_SOURCE) -- cgit v1.2.3