xref: /OK3568_Linux_fs/buildroot/package/libzlib/libzlib.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# libzlib
4#
5################################################################################
6
7LIBZLIB_VERSION = 1.2.11
8LIBZLIB_SOURCE = zlib-$(LIBZLIB_VERSION).tar.xz
9LIBZLIB_SITE = http://www.zlib.net
10LIBZLIB_LICENSE = Zlib
11LIBZLIB_LICENSE_FILES = README
12LIBZLIB_INSTALL_STAGING = YES
13LIBZLIB_PROVIDES = zlib
14LIBZLIB_CPE_ID_VENDOR = gnu
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
65define HOST_LIBZLIB_INSTALL_CMDS
66	$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) LDCONFIG=true install
67endef
68
69$(eval $(generic-package))
70$(eval $(host-generic-package))
71