hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
################################################################################
#
# libzlib
#
################################################################################
 
LIBZLIB_VERSION = 1.2.11
LIBZLIB_SOURCE = zlib-$(LIBZLIB_VERSION).tar.xz
LIBZLIB_SITE = http://www.zlib.net
LIBZLIB_LICENSE = Zlib
LIBZLIB_LICENSE_FILES = README
LIBZLIB_INSTALL_STAGING = YES
LIBZLIB_PROVIDES = zlib
 
# 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)
LIBZLIB_PIC =
LIBZLIB_SHARED = --static
else
LIBZLIB_PIC = -fPIC
LIBZLIB_SHARED = --shared
endif
 
ifeq ($(BR2_RELRO_FULL), y)
LIBZLIB_LDFLAGS = $(filter-out -pie, $(TARGET_LDFLAGS))
else
LIBZLIB_LDFLAGS = $(TARGET_LDFLAGS)
endif
 
define LIBZLIB_CONFIGURE_CMDS
   (cd $(@D); rm -rf config.cache; \
       $(TARGET_CONFIGURE_ARGS) \
       $(TARGET_CONFIGURE_OPTS) \
       CFLAGS="$(TARGET_CFLAGS) $(LIBZLIB_PIC)" \
       LDFLAGS="$(LIBZLIB_LDFLAGS)" \
       ./configure \
       $(LIBZLIB_SHARED) \
       --prefix=/usr \
   )
endef
 
define HOST_LIBZLIB_CONFIGURE_CMDS
   (cd $(@D); rm -rf config.cache; \
       $(HOST_CONFIGURE_ARGS) \
       $(HOST_CONFIGURE_OPTS) \
       ./configure \
       --prefix="$(HOST_DIR)" \
       --sysconfdir="$(HOST_DIR)/etc" \
   )
endef
 
define LIBZLIB_BUILD_CMDS
   $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D)
endef
 
define HOST_LIBZLIB_BUILD_CMDS
   $(HOST_MAKE_ENV) $(MAKE1) -C $(@D)
endef
 
define LIBZLIB_INSTALL_STAGING_CMDS
   $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) LDCONFIG=true install
endef
 
define LIBZLIB_INSTALL_TARGET_CMDS
   $(TARGET_MAKE_ENV) $(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 LIBZLIB_RM_STATIC_STAGING
   rm -f $(STAGING_DIR)/usr/lib/libz.a
endef
LIBZLIB_POST_INSTALL_STAGING_HOOKS += LIBZLIB_RM_STATIC_STAGING
endif
 
define HOST_LIBZLIB_INSTALL_CMDS
   $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) LDCONFIG=true install
endef
 
$(eval $(generic-package))
$(eval $(host-generic-package))