summaryrefslogtreecommitdiffstats
path: root/package/zlib/zlib.mk
blob: 5365b30efbdc682346687b63c25caf5700f820c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#############################################################
#
# zlib
#
#############################################################
ZLIB_VERSION:=1.2.3
ZLIB_SOURCE:=zlib-$(ZLIB_VERSION).tar.bz2
ZLIB_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/libpng
ZLIB_INSTALL_STAGING=YES

ifeq ($(BR2_PREFER_STATIC_LIB),y)
ZLIB_PIC :=
ZLIB_SHARED :=
else
ZLIB_PIC := -fPIC
ZLIB_SHARED := --shared
endif

define ZLIB_CONFIGURE_CMDS
	(cd $(@D); rm -rf config.cache; \
		$(TARGET_CONFIGURE_ARGS) \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS) $(ZLIB_PIC)" \
		./configure \
		$(ZLIB_SHARED) \
		--prefix=/usr \
		--exec-prefix=$(STAGING_DIR)/usr/bin \
		--libdir=$(STAGING_DIR)/usr/lib \
		--includedir=$(STAGING_DIR)/usr/include \
	)
endef

define ZLIB_BUILD_CMDS
	$(MAKE) -C $(@D) all libz.a
endef

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/
endef

ifeq ($(BR2_HAVE_DEVFILES),y)
define ZLIB_INSTALL_TARGET_HEADERS
	$(INSTALL) -D $(@D)/zlib.h $(STAGING_DIR)/usr/include/zlib.h
	$(INSTALL) $(@D)/zconf.h $(STAGING_DIR)/usr/include/
endef
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*
	$(INSTALL) -D $(@D)/libz.a $(TARGET_DIR)/usr/lib/libz.a
	$(ZLIB_INSTALL_TARGET_HEADERS)
endef

$(eval $(call GENTARGETS,package,zlib))