python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / openssl / openssl.mk
blob1536982f8bb3ef403b79c063a8e5dab72eb6a648
1 ################################################################################
3 # openssl
5 ################################################################################
7 OPENSSL_VERSION = 1.0.2k
8 OPENSSL_SITE = http://www.openssl.org/source
9 OPENSSL_LICENSE = OpenSSL or SSLeay
10 OPENSSL_LICENSE_FILES = LICENSE
11 OPENSSL_INSTALL_STAGING = YES
12 OPENSSL_DEPENDENCIES = zlib
13 HOST_OPENSSL_DEPENDENCIES = host-zlib
14 OPENSSL_TARGET_ARCH = generic32
15 OPENSSL_CFLAGS = $(TARGET_CFLAGS)
16 OPENSSL_PATCH = \
17 https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch?id=c8abcbe8de5d3b6cdd68c162f398c011ff6e2d9d \
18 https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/openssl/files/openssl-1.0.2a-parallel-obj-headers.patch?id=c8abcbe8de5d3b6cdd68c162f398c011ff6e2d9d \
19 https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/openssl/files/openssl-1.0.2a-parallel-install-dirs.patch?id=c8abcbe8de5d3b6cdd68c162f398c011ff6e2d9d \
20 https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/openssl/files/openssl-1.0.2a-parallel-symlinking.patch?id=c8abcbe8de5d3b6cdd68c162f398c011ff6e2d9d
22 # relocation truncated to fit: R_68K_GOT16O
23 ifeq ($(BR2_m68k_cf),y)
24 OPENSSL_CFLAGS += -mxgot
25 endif
27 ifeq ($(BR2_USE_MMU),)
28 OPENSSL_CFLAGS += -DHAVE_FORK=0
29 endif
31 ifeq ($(BR2_PACKAGE_HAS_CRYPTODEV),y)
32 OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
33 OPENSSL_DEPENDENCIES += cryptodev
34 endif
36 # Some architectures are optimized in OpenSSL
37 # Doesn't work for thumb-only (Cortex-M?)
38 ifeq ($(BR2_ARM_CPU_HAS_ARM),y)
39 OPENSSL_TARGET_ARCH = armv4
40 endif
41 ifeq ($(ARCH),aarch64)
42 OPENSSL_TARGET_ARCH = aarch64
43 endif
44 ifeq ($(ARCH),powerpc)
45 # 4xx cores seem to have trouble with openssl's ASM optimizations
46 ifeq ($(BR2_powerpc_401)$(BR2_powerpc_403)$(BR2_powerpc_405)$(BR2_powerpc_405fp)$(BR2_powerpc_440)$(BR2_powerpc_440fp),)
47 OPENSSL_TARGET_ARCH = ppc
48 endif
49 endif
50 ifeq ($(ARCH),powerpc64)
51 OPENSSL_TARGET_ARCH = ppc64
52 endif
53 ifeq ($(ARCH),powerpc64le)
54 OPENSSL_TARGET_ARCH = ppc64le
55 endif
56 ifeq ($(ARCH),x86_64)
57 OPENSSL_TARGET_ARCH = x86_64
58 endif
60 define HOST_OPENSSL_CONFIGURE_CMDS
61 (cd $(@D); \
62 $(HOST_CONFIGURE_OPTS) \
63 ./config \
64 --prefix=$(HOST_DIR)/usr \
65 --openssldir=$(HOST_DIR)/etc/ssl \
66 --libdir=/lib \
67 shared \
68 zlib-dynamic \
70 $(SED) "s#-O[0-9]#$(HOST_CFLAGS)#" $(@D)/Makefile
71 endef
73 define OPENSSL_CONFIGURE_CMDS
74 (cd $(@D); \
75 $(TARGET_CONFIGURE_ARGS) \
76 $(TARGET_CONFIGURE_OPTS) \
77 ./Configure \
78 linux-$(OPENSSL_TARGET_ARCH) \
79 --prefix=/usr \
80 --openssldir=/etc/ssl \
81 --libdir=/lib \
82 $(if $(BR2_TOOLCHAIN_HAS_THREADS),threads,no-threads) \
83 $(if $(BR2_STATIC_LIBS),no-shared,shared) \
84 no-rc5 \
85 enable-camellia \
86 enable-mdc2 \
87 enable-tlsext \
88 $(if $(BR2_STATIC_LIBS),zlib,zlib-dynamic) \
89 $(if $(BR2_STATIC_LIBS),no-dso) \
91 $(SED) "s#-march=[-a-z0-9] ##" -e "s#-mcpu=[-a-z0-9] ##g" $(@D)/Makefile
92 $(SED) "s#-O[0-9]#$(OPENSSL_CFLAGS)#" $(@D)/Makefile
93 $(SED) "s# build_tests##" $(@D)/Makefile
94 endef
96 # libdl is not available in a static build, and this is not implied by no-dso
97 ifeq ($(BR2_STATIC_LIBS),y)
98 define OPENSSL_FIXUP_STATIC_MAKEFILE
99 $(SED) 's#-ldl##g' $(@D)/Makefile
100 endef
101 OPENSSL_POST_CONFIGURE_HOOKS += OPENSSL_FIXUP_STATIC_MAKEFILE
102 endif
104 define HOST_OPENSSL_BUILD_CMDS
105 $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
106 endef
108 define OPENSSL_BUILD_CMDS
109 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
110 endef
112 define OPENSSL_INSTALL_STAGING_CMDS
113 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) INSTALL_PREFIX=$(STAGING_DIR) install
114 endef
116 define HOST_OPENSSL_INSTALL_CMDS
117 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
118 endef
120 define OPENSSL_INSTALL_TARGET_CMDS
121 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) INSTALL_PREFIX=$(TARGET_DIR) install
122 rm -rf $(TARGET_DIR)/usr/lib/ssl
123 rm -f $(TARGET_DIR)/usr/bin/c_rehash
124 endef
126 # libdl has no business in a static build
127 ifeq ($(BR2_STATIC_LIBS),y)
128 define OPENSSL_FIXUP_STATIC_PKGCONFIG
129 $(SED) 's#-ldl##' $(STAGING_DIR)/usr/lib/pkgconfig/libcrypto.pc
130 $(SED) 's#-ldl##' $(STAGING_DIR)/usr/lib/pkgconfig/libssl.pc
131 $(SED) 's#-ldl##' $(STAGING_DIR)/usr/lib/pkgconfig/openssl.pc
132 endef
133 OPENSSL_POST_INSTALL_STAGING_HOOKS += OPENSSL_FIXUP_STATIC_PKGCONFIG
134 endif
136 ifneq ($(BR2_STATIC_LIBS),y)
137 # libraries gets installed read only, so strip fails
138 define OPENSSL_INSTALL_FIXUPS_SHARED
139 chmod +w $(TARGET_DIR)/usr/lib/engines/lib*.so
140 for i in $(addprefix $(TARGET_DIR)/usr/lib/,libcrypto.so.* libssl.so.*); \
141 do chmod +w $$i; done
142 endef
143 OPENSSL_POST_INSTALL_TARGET_HOOKS += OPENSSL_INSTALL_FIXUPS_SHARED
144 endif
146 ifeq ($(BR2_PACKAGE_PERL),)
147 define OPENSSL_REMOVE_PERL_SCRIPTS
148 $(RM) -f $(TARGET_DIR)/etc/ssl/misc/{CA.pl,tsget}
149 endef
150 OPENSSL_POST_INSTALL_TARGET_HOOKS += OPENSSL_REMOVE_PERL_SCRIPTS
151 endif
153 ifeq ($(BR2_PACKAGE_OPENSSL_BIN),)
154 define OPENSSL_REMOVE_BIN
155 $(RM) -f $(TARGET_DIR)/usr/bin/openssl
156 $(RM) -f $(TARGET_DIR)/etc/ssl/misc/{CA.*,c_*}
157 endef
158 OPENSSL_POST_INSTALL_TARGET_HOOKS += OPENSSL_REMOVE_BIN
159 endif
161 ifneq ($(BR2_PACKAGE_OPENSSL_ENGINES),y)
162 define OPENSSL_REMOVE_OPENSSL_ENGINES
163 rm -rf $(TARGET_DIR)/usr/lib/engines
164 endef
165 OPENSSL_POST_INSTALL_TARGET_HOOKS += OPENSSL_REMOVE_OPENSSL_ENGINES
166 endif
168 $(eval $(generic-package))
169 $(eval $(host-generic-package))