Skip to contentSkip to conversation

zlib: fix shared lib logic for static-only targets

PATCH Superseded Mike Frysinger 3 participants 5 messages Nov 20, 2010 – Nov 24, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zlib: fix shared lib logic for static-only targets

FLAT targets only support static libraries. The zlib code atm though assumes a libz.so is always created. So have the install target check to see if libz.so exists before trying to install it.

While we're here, also punt the package-local stripping.

---
 package/zlib/zlib.mk |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
package/zlib/zlib.mk +3 -2
index 751cfc1..a4da4fa 100644
@@ -72,8 +72,9 @@ endif
 
 define ZLIB_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
-	cp -dpf $(@D)/libz.so* $(TARGET_DIR)/usr/lib
-	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libz.so*
+	if [ -e "$(@D)/libz.so" ]; then \
+		cp -dpf $(@D)/libz.so* $(TARGET_DIR)/usr/lib; \
+	fi
 	$(INSTALL) -D $(@D)/libz.a $(TARGET_DIR)/usr/lib/libz.a
 	$(ZLIB_INSTALL_TARGET_HEADERS)
 endef
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH v2 1/1 zlib: fix shared lib logic for static-only targets

FLAT targets only support static libraries. The zlib code atm though assumes a libz.so is always created. So have the targets check to see if libz.so exists before trying to work with it.

While we're here, also punt the package-local stripping.

---
v2
- fix all install targets

 package/zlib/zlib.mk |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
package/zlib/zlib.mk +9 -4
index 751cfc1..759ab1f 100644
@@ -53,14 +53,18 @@ define ZLIB_INSTALL_STAGING_CMDS
 	$(INSTALL) -D $(@D)/libz.a $(STAGING_DIR)/usr/lib/libz.a
 	$(INSTALL) -D $(@D)/zlib.h $(STAGING_DIR)/usr/include/zlib.h
 	$(INSTALL) $(@D)/zconf.h $(STAGING_DIR)/usr/include/
-	cp -dpf $(@D)/libz.so* $(STAGING_DIR)/usr/lib/
+	if [ -e "$(@D)/libz.so" ]; then \
+		cp -dpf $(@D)/libz.so* $(STAGING_DIR)/usr/lib/; \
+	fi
 endef
 
 define HOST_ZLIB_INSTALL_CMDS
 	$(INSTALL) -D $(@D)/libz.a $(HOST_DIR)/usr/lib/libz.a
 	$(INSTALL) -D $(@D)/zlib.h $(HOST_DIR)/usr/include/zlib.h
 	$(INSTALL) $(@D)/zconf.h $(HOST_DIR)/usr/include/
-	cp -dpf $(@D)/libz.so* $(HOST_DIR)/usr/lib/
+	if [ -e "$(@D)/libz.so" ]; then \
+		cp -dpf $(@D)/libz.so* $(HOST_DIR)/usr/lib/; \
+	fi
 endef
 
 ifeq ($(BR2_HAVE_DEVFILES),y)
@@ -72,8 +76,9 @@ endif
 
 define ZLIB_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
-	cp -dpf $(@D)/libz.so* $(TARGET_DIR)/usr/lib
-	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libz.so*
+	if [ -e "$(@D)/libz.so" ]; then \
+		cp -dpf $(@D)/libz.so* $(TARGET_DIR)/usr/lib; \
+	fi
 	$(INSTALL) -D $(@D)/libz.a $(TARGET_DIR)/usr/lib/libz.a
 	$(ZLIB_INSTALL_TARGET_HEADERS)
 endef
Signature · 1 line
1.7.3.2
#2 lore raw

PATCH v2 1/1 zlib: fix shared lib logic for static-only targets

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mike" == Mike Frysinger <[email protected]> writes:

Mike> FLAT targets only support static libraries. The zlib code atm though Mike> assumes a libz.so is always created. So have the targets check to see Mike> if libz.so exists before trying to work with it.

Mike> While we're here, also punt the package-local stripping.

Thanks, but I prefer to simply use zlib's own 'make install' instead, instead of repeating these steps 3 times. I've committed a change to do so in git.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 1/1 zlib: fix shared lib logic for static-only targets

Quoted 11 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mike" == Mike Frysinger <[email protected]> writes:

Mike> FLAT targets only support static libraries. The zlib code atm though Mike> assumes a libz.so is always created. So have the targets check to see Mike> if libz.so exists before trying to work with it.

Mike> While we're here, also punt the package-local stripping.

Thanks, but I prefer to simply use zlib's own 'make install' instead, instead of repeating these steps 3 times. I've committed a change to do so in git.

hum there is a bug here in git ...

cd /home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5
/usr/bin/make -j1
-C /home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5 DESTDIR=/home/sergio/hardware/moviecube/buildroot/output/target install
make: Entering directory
`/home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5'
cp
libz.a /home/sergio/hardware/moviecube/buildroot/output/target/home/sergio/hardware/moviecube/buildroot/output/staging/usr/lib

cp libz.a to output/staging/ instead output/target ?
no worst , /home/sergio/hardware/moviecube/buildroot/output/target/ more /home/sergio/hardware/moviecube/buildroot/output/staging/usr/lib

Best regards,

Signature · 8 lines
S?rgio M. B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3309 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101124/2eb49216/attachment.bin>
#4 lore raw

PATCH v2 1/1 zlib: fix shared lib logic for static-only targets

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Sergio" == Sergio Monteiro Basto <[email protected]> writes:

Hi,

Sergio> hum there is a bug here in git ...

Sergio> cd /home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5
Sergio> /usr/bin/make -j1
Sergio> -C /home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5
Sergio> DESTDIR=/home/sergio/hardware/moviecube/buildroot/output/target install
Sergio> make: Entering directory
Sergio> `/home/sergio/hardware/moviecube/buildroot/output/build/zlib-1.2.5'
Sergio> cp
Sergio> libz.a /home/sergio/hardware/moviecube/buildroot/output/target/home/sergio/hardware/moviecube/buildroot/output/staging/usr/lib

Crap, that's because of the --libdir=$(STAGING_DIR).. I'm afraid I tested it without that line and added it back later, will fix asap.

Signature · 1 line
Bye, Peter Korsgaard