aec9daf6feaf9b7a01fd281c008ec41d26d9b2a9
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / zlib / zlib.mk
1 ################################################################################
2 #
3 # zlib
4 #
5 ################################################################################
6
7 ZLIB_VERSION = 1.2.8
8 ZLIB_SOURCE = zlib-$(ZLIB_VERSION).tar.xz
9 ZLIB_SITE = http://downloads.sourceforge.net/project/libpng/zlib/$(ZLIB_VERSION)
10 ZLIB_LICENSE = zlib license
11 ZLIB_LICENSE_FILES = README
12 ZLIB_INSTALL_STAGING = YES
13
14 # It is not possible to build only a shared version of zlib, so we build both
15 # shared and static, unless we only want the static libs, and we eventually
16 # selectively remove what we do not want
17 ifeq ($(BR2_STATIC_LIBS),y)
18 ZLIB_PIC =
19 ZLIB_SHARED = --static
20 else
21 ZLIB_PIC = -fPIC
22 ZLIB_SHARED = --shared
23 endif
24
25 define ZLIB_CONFIGURE_CMDS
26         (cd $(@D); rm -rf config.cache; \
27                 $(TARGET_CONFIGURE_ARGS) \
28                 $(TARGET_CONFIGURE_OPTS) \
29                 CFLAGS="$(TARGET_CFLAGS) $(ZLIB_PIC)" \
30                 ./configure \
31                 $(ZLIB_SHARED) \
32                 --prefix=/usr \
33         )
34 endef
35
36 define HOST_ZLIB_CONFIGURE_CMDS
37         (cd $(@D); rm -rf config.cache; \
38                 $(HOST_CONFIGURE_ARGS) \
39                 $(HOST_CONFIGURE_OPTS) \
40                 ./configure \
41                 --prefix="$(HOST_DIR)/usr" \
42                 --sysconfdir="$(HOST_DIR)/etc" \
43         )
44 endef
45
46 define ZLIB_BUILD_CMDS
47         $(MAKE1) -C $(@D)
48 endef
49
50 define HOST_ZLIB_BUILD_CMDS
51         $(MAKE1) -C $(@D)
52 endef
53
54 define ZLIB_INSTALL_STAGING_CMDS
55         $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) LDCONFIG=true install
56 endef
57
58 define ZLIB_INSTALL_TARGET_CMDS
59         $(MAKE1) -C $(@D) DESTDIR=$(TARGET_DIR) LDCONFIG=true install
60 endef
61
62 # We don't care removing the .a from target, since it not used at link
63 # time to build other packages, and it is anyway removed later before
64 # assembling the filesystem images anyway.
65 ifeq ($(BR2_SHARED_LIBS),y)
66 define ZLIB_RM_STATIC_STAGING
67         rm -f $(STAGING_DIR)/usr/lib/libz.a
68 endef
69 ZLIB_POST_INSTALL_STAGING_HOOKS += ZLIB_RM_STATIC_STAGING
70 endif
71
72 define HOST_ZLIB_INSTALL_CMDS
73         $(MAKE1) -C $(@D) LDCONFIG=true install
74 endef
75
76 $(eval $(generic-package))
77 $(eval $(host-generic-package))