1################################################################################ 2# 3# libzlib 4# 5################################################################################ 6 7LIBZLIB_VERSION = 1.3.1 8LIBZLIB_SOURCE = zlib-$(LIBZLIB_VERSION).tar.xz 9LIBZLIB_SITE = https://www.zlib.net 10LIBZLIB_LICENSE = Zlib 11LIBZLIB_LICENSE_FILES = LICENSE 12LIBZLIB_INSTALL_STAGING = YES 13LIBZLIB_PROVIDES = zlib 14LIBZLIB_CPE_ID_VENDOR = zlib 15LIBZLIB_CPE_ID_PRODUCT = zlib 16 17# It is not possible to build only a shared version of zlib, so we build both 18# shared and static, unless we only want the static libs, and we eventually 19# selectively remove what we do not want 20ifeq ($(BR2_STATIC_LIBS),y) 21LIBZLIB_PIC = 22LIBZLIB_SHARED = --static 23else 24LIBZLIB_PIC = -fPIC 25LIBZLIB_SHARED = --shared 26endif 27 28define LIBZLIB_CONFIGURE_CMDS 29 (cd $(@D); rm -rf config.cache; \ 30 $(TARGET_CONFIGURE_ARGS) \ 31 $(TARGET_CONFIGURE_OPTS) \ 32 CFLAGS="$(TARGET_CFLAGS) $(LIBZLIB_PIC)" \ 33 ./configure \ 34 $(LIBZLIB_SHARED) \ 35 --prefix=/usr \ 36 ) 37endef 38 39define HOST_LIBZLIB_CONFIGURE_CMDS 40 (cd $(@D); rm -rf config.cache; \ 41 $(HOST_CONFIGURE_ARGS) \ 42 $(HOST_CONFIGURE_OPTS) \ 43 ./configure \ 44 --prefix="$(HOST_DIR)" \ 45 --sysconfdir="$(HOST_DIR)/etc" \ 46 ) 47endef 48 49define LIBZLIB_BUILD_CMDS 50 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) 51endef 52 53define HOST_LIBZLIB_BUILD_CMDS 54 $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) 55endef 56 57define LIBZLIB_INSTALL_STAGING_CMDS 58 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) LDCONFIG=true install 59endef 60 61define LIBZLIB_INSTALL_TARGET_CMDS 62 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR=$(TARGET_DIR) LDCONFIG=true install 63endef 64 65# We don't care removing the .a from target, since it not used at link 66# time to build other packages, and it is anyway removed later before 67# assembling the filesystem images anyway. 68ifeq ($(BR2_SHARED_LIBS),y) 69define LIBZLIB_RM_STATIC_STAGING 70 rm -f $(STAGING_DIR)/usr/lib/libz.a 71endef 72LIBZLIB_POST_INSTALL_STAGING_HOOKS += LIBZLIB_RM_STATIC_STAGING 73endif 74 75define HOST_LIBZLIB_INSTALL_CMDS 76 $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) LDCONFIG=true install 77endef 78 79$(eval $(generic-package)) 80$(eval $(host-generic-package)) 81