ZLIB_LICENSE_FILES = README
ZLIB_INSTALL_STAGING = YES
+# It is not possible to build only a shared version of zlib, so we build both
+# shared and static, unless we only want the static libs, and we eventually
+# selectively remove what we do not want
ifeq ($(BR2_STATIC_LIBS),y)
ZLIB_PIC =
ZLIB_SHARED = --static
$(MAKE1) -C $(@D) DESTDIR=$(TARGET_DIR) LDCONFIG=true install
endef
+# We don't care removing the .a from target, since it not used at link
+# time to build other packages, and it is anyway removed later before
+# assembling the filesystem images anyway.
+ifeq ($(BR2_SHARED_LIBS),y)
+define ZLIB_RM_STATIC_STAGING
+ rm -f $(STAGING_DIR)/usr/lib/libz.a
+endef
+ZLIB_POST_INSTALL_STAGING_HOOKS += ZLIB_RM_STATIC_STAGING
+endif
+
define HOST_ZLIB_INSTALL_CMDS
$(MAKE1) -C $(@D) LDCONFIG=true install
endef