blob: 3a8e5d4b87802119172dabef5341f7ea5ecc6d64 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "Mozilla's SSL and TLS implementation"
2DESCRIPTION = "Network Security Services (NSS) is a set of libraries \
3designed to support cross-platform development of \
4security-enabled client and server applications. \
5Applications built with NSS can support SSL v2 and v3, \
6TLS, PKCS 5, PKCS 7, PKCS 11, PKCS 12, S/MIME, X.509 \
7v3 certificates, and other security standards."
8HOMEPAGE = "http://www.mozilla.org/projects/security/pki/nss/"
9SECTION = "libs"
10
11LICENSE = "MPL-2.0 | (MPL-2.0 & GPL-2.0+) | (MPL-2.0 & LGPL-2.1+)"
12
13LIC_FILES_CHKSUM = "file://nss/COPYING;md5=3b1e88e1b9c0b5a4b2881d46cce06a18 \
14 file://nss/lib/freebl/mpi/doc/LICENSE;md5=491f158d09d948466afce85d6f1fe18f \
15 file://nss/lib/freebl/mpi/doc/LICENSE-MPL;md5=5d425c8f3157dbf212db2ec53d9e5132"
16
17VERSION_DIR = "${@d.getVar('BP').upper().replace('-', '_').replace('.', '_') + '_RTM'}"
18
19SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${VERSION_DIR}/src/${BP}.tar.gz \
20 file://nss.pc.in \
21 file://signlibs.sh \
22 file://0001-nss-fix-support-cross-compiling.patch \
23 file://nss-no-rpath-for-cross-compiling.patch \
24 file://nss-fix-incorrect-shebang-of-perl.patch \
25 file://nss-fix-nsinstall-build.patch \
26 file://disable-Wvarargs-with-clang.patch \
27 file://pqg.c-ULL_addend.patch \
28 file://blank-cert9.db \
29 file://blank-key4.db \
30 file://system-pkcs11.txt \
Brad Bishopa5c52ff2018-11-23 10:55:50 +130031 file://nss-fix-SHA_HTONL-bug-for-arm-32be.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032 "
33
34SRC_URI[md5sum] = "10720fc70fd483de1b085402fb10ed59"
35SRC_URI[sha256sum] = "6be64dd76f212415cc8bc34343ac1e7389048db4db9a023a84873c411dc5864b"
36
37UPSTREAM_CHECK_URI = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Releases"
38UPSTREAM_CHECK_REGEX = "NSS_(?P<pver>.+)_release_notes"
39
40inherit siteinfo
41
42DEPENDS = "sqlite3 nspr zlib nss-native"
43DEPENDS_class-native = "sqlite3-native nspr-native zlib-native"
44RDEPENDS_${PN}-smime = "perl"
45
46TD = "${S}/tentative-dist"
47TDS = "${S}/tentative-dist-staging"
48
49TARGET_CC_ARCH += "${LDFLAGS}"
50
51do_configure_prepend_libc-musl () {
52 sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
53}
54
55do_compile_prepend_class-native() {
56 export NSPR_INCLUDE_DIR=${STAGING_INCDIR_NATIVE}
57 export NSPR_LIB_DIR=${STAGING_LIBDIR_NATIVE}
58 export NSS_ENABLE_WERROR=0
59}
60
61do_compile_prepend_class-nativesdk() {
62 export LDFLAGS=""
63}
64
65do_compile_prepend_class-native() {
66 # Need to set RPATH so that chrpath will do its job correctly
67 RPATH="-Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} -Wl,-rpath-link,${STAGING_BASE_LIBDIR_NATIVE} -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE}"
68}
69
70do_compile() {
71 export CROSS_COMPILE=1
72 export NATIVE_CC="${BUILD_CC}"
73 export NATIVE_FLAGS="${BUILD_CFLAGS}"
74 export BUILD_OPT=1
75
76 export FREEBL_NO_DEPEND=1
77 export FREEBL_LOWHASH=1
78
79 export LIBDIR=${libdir}
80 export MOZILLA_CLIENT=1
81 export NS_USE_GCC=1
82 export NSS_USE_SYSTEM_SQLITE=1
83 export NSS_ENABLE_ECC=1
84
85 export OS_RELEASE=3.4
86 export OS_TARGET=Linux
87 export OS_ARCH=Linux
88
89 if [ "${TARGET_ARCH}" = "powerpc" ]; then
90 OS_TEST=ppc
91 elif [ "${TARGET_ARCH}" = "powerpc64" ]; then
92 OS_TEST=ppc64
93 elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then
94 OS_TEST=mips
95 elif [ "${TARGET_ARCH}" = "aarch64_be" ]; then
96 OS_TEST="aarch64"
97 else
98 OS_TEST="${TARGET_ARCH}"
99 fi
100
101 if [ "${SITEINFO_BITS}" = "64" ]; then
102 export USE_64=1
103 elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then
104 export USE_X32=1
105 fi
106
107 export NSS_DISABLE_GTESTS=1
108
109 # We can modify CC in the environment, but if we set it via an
110 # argument to make, nsinstall, a host program, will also build with it!
111 #
112 # nss pretty much does its own thing with CFLAGS, so we put them into CC.
113 # Optimization will get clobbered, but most of the stuff will survive.
114 # The motivation for this is to point to the correct place for debug
115 # source files and CFLAGS does that. Nothing uses CCC.
116 #
117 export CC="${CC} ${CFLAGS}"
118 make -C ./nss CCC="${CXX} -g" \
119 OS_TEST=${OS_TEST} \
120 RPATH="${RPATH}"
121}
122do_compile[vardepsexclude] += "SITEINFO_BITS"
123
124
125do_install_prepend_class-nativesdk() {
126 export LDFLAGS=""
127}
128
129do_install() {
130 export CROSS_COMPILE=1
131 export NATIVE_CC="${BUILD_CC}"
132 export BUILD_OPT=1
133
134 export FREEBL_NO_DEPEND=1
135
136 export LIBDIR=${libdir}
137 export MOZILLA_CLIENT=1
138 export NS_USE_GCC=1
139 export NSS_USE_SYSTEM_SQLITE=1
140 export NSS_ENABLE_ECC=1
141
142 export OS_RELEASE=3.4
143 export OS_TARGET=Linux
144 export OS_ARCH=Linux
145
146 if [ "${TARGET_ARCH}" = "powerpc" ]; then
147 OS_TEST=ppc
148 elif [ "${TARGET_ARCH}" = "powerpc64" ]; then
149 OS_TEST=ppc64
150 elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then
151 OS_TEST=mips
152 elif [ "${TARGET_ARCH}" = "aarch64_be" ]; then
153 CPU_ARCH=aarch64
154 OS_TEST="aarch64"
155 else
156 OS_TEST="${TARGET_ARCH}"
157 fi
158 if [ "${SITEINFO_BITS}" = "64" ]; then
159 export USE_64=1
160 elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then
161 export USE_X32=1
162 fi
163
164 export NSS_DISABLE_GTESTS=1
165
166 make -C ./nss \
167 CCC="${CXX}" \
168 OS_TEST=${OS_TEST} \
169 SOURCE_LIB_DIR="${TD}/${libdir}" \
170 SOURCE_BIN_DIR="${TD}/${bindir}" \
171 install
172
173 install -d ${D}/${libdir}/
174 for file in ${S}/dist/*.OBJ/lib/*.so; do
175 echo "Installing `basename $file`..."
176 cp $file ${D}/${libdir}/
177 done
178
179 for shared_lib in ${TD}/${libdir}/*.so.*; do
180 if [ -f $shared_lib ]; then
181 cp $shared_lib ${D}/${libdir}
182 ln -sf $(basename $shared_lib) ${D}/${libdir}/$(basename $shared_lib .1oe)
183 fi
184 done
185 for shared_lib in ${TD}/${libdir}/*.so; do
186 if [ -f $shared_lib -a ! -e ${D}/${libdir}/$shared_lib ]; then
187 cp $shared_lib ${D}/${libdir}
188 fi
189 done
190
191 install -d ${D}/${includedir}/nss3
192 install -m 644 -t ${D}/${includedir}/nss3 dist/public/nss/*
193
194 install -d ${D}/${bindir}
195 for binary in ${TD}/${bindir}/*; do
196 install -m 755 -t ${D}/${bindir} $binary
197 done
198}
199do_install[vardepsexclude] += "SITEINFO_BITS"
200
201do_install_append() {
202 # Create empty .chk files for the NSS libraries at build time. They could
203 # be regenerated at target's boot time.
204 for file in libsoftokn3.chk libfreebl3.chk libnssdbm3.chk; do
205 touch ${D}/${libdir}/$file
206 chmod 755 ${D}/${libdir}/$file
207 done
208 install -D -m 755 ${WORKDIR}/signlibs.sh ${D}/${bindir}/signlibs.sh
209
210 install -d ${D}${libdir}/pkgconfig/
211 sed 's/%NSS_VERSION%/${PV}/' ${WORKDIR}/nss.pc.in | sed 's/%NSPR_VERSION%/4.9.2/' > ${D}${libdir}/pkgconfig/nss.pc
212 sed -i s:OEPREFIX:${prefix}:g ${D}${libdir}/pkgconfig/nss.pc
213 sed -i s:OEEXECPREFIX:${exec_prefix}:g ${D}${libdir}/pkgconfig/nss.pc
214 sed -i s:OELIBDIR:${libdir}:g ${D}${libdir}/pkgconfig/nss.pc
215 sed -i s:OEINCDIR:${includedir}/nss3:g ${D}${libdir}/pkgconfig/nss.pc
216}
217
218do_install_append_class-target() {
219 # It used to call certutil to create a blank certificate with empty password at
220 # build time, but the checksum of key4.db changes every time when certutil is called.
221 # It causes non-determinism issue, so provide databases with a blank certificate
222 # which are originally from output of nss in qemux86-64 build. You can get these
223 # databases by:
224 # certutil -N -d sql:/database/path/ --empty-password
225 install -d ${D}${sysconfdir}/pki/nssdb/
226 install -m 0644 ${WORKDIR}/blank-cert9.db ${D}${sysconfdir}/pki/nssdb/cert9.db
227 install -m 0644 ${WORKDIR}/blank-key4.db ${D}${sysconfdir}/pki/nssdb/key4.db
228 install -m 0644 ${WORKDIR}/system-pkcs11.txt ${D}${sysconfdir}/pki/nssdb/pkcs11.txt
229}
230
231PACKAGE_WRITE_DEPS += "nss-native"
232pkg_postinst_${PN} () {
233 if [ -n "$D" ]; then
234 for I in $D${libdir}/lib*.chk; do
235 DN=`dirname $I`
236 BN=`basename $I .chk`
237 FN=$DN/$BN.so
238 shlibsign -i $FN
239 if [ $? -ne 0 ]; then
240 exit 1
241 fi
242 done
243 else
244 signlibs.sh
245 fi
246}
247
248PACKAGES =+ "${PN}-smime"
249FILES_${PN}-smime = "\
250 ${bindir}/smime \
251"
252FILES_${PN} = "\
253 ${sysconfdir} \
254 ${bindir} \
255 ${libdir}/lib*.chk \
256 ${libdir}/lib*.so \
257 "
258FILES_${PN}-dev = "\
259 ${libdir}/nss \
260 ${libdir}/pkgconfig/* \
261 ${includedir}/* \
262 "
263
264BBCLASSEXTEND = "native nativesdk"
265