Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/nss/
Date: Wed, 01 Dec 2021 17:28:18
Message-Id: 1638379691.4e38a2a73eee2d035983aaf05b21694979c0c128.whissi@gentoo
1 commit: 4e38a2a73eee2d035983aaf05b21694979c0c128
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 1 17:23:16 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 1 17:28:11 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e38a2a7
7
8 dev-libs/nss: bump to v3.68.1
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-libs/nss/Manifest | 1 +
14 dev-libs/nss/nss-3.68.1.ebuild | 367 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 368 insertions(+)
16
17 diff --git a/dev-libs/nss/Manifest b/dev-libs/nss/Manifest
18 index 6e917b1cda2c..385866c59d4e 100644
19 --- a/dev-libs/nss/Manifest
20 +++ b/dev-libs/nss/Manifest
21 @@ -1,4 +1,5 @@
22 DIST nss-3.63.1.tar.gz 82166899 BLAKE2B a3c1939d16dcb083fae819659c0a61ff1d4dab70c8a7fc4b176a391bf7cd22eae1c93c85533b6af15e1c1cd9fb6b007380741e0b1670f3891f298ffa1b309284 SHA512 62d1bc161fc8eea6be191dc23ec42042a2626e119b7329f6449cf78729775776fd8e9faebd0457c2413684c15be6e10722ee4a7087c7c3e103fe993f3acec730
23 +DIST nss-3.68.1.tar.gz 82405747 BLAKE2B 89a2e893d3af02b192d044049ec84462e53d96bf2ba9a88112b4dfde5af5c0d9a615ed94b5c97c26775de998cc38240d19d5f2e5eb2573a6715d2a7106d99fe3 SHA512 9aa932e8ba1a0c3bffd402f7129d03de30481bde712aaa197bc79d14b307179e691423aa0c6300767fce2c667917c8d2e2b38e361269b7671548d72435887f84
24 DIST nss-3.68.tar.gz 82405833 BLAKE2B 0a48c599bb3c97f41e41c5723e6c1b12d7f03469bf37593f62973817b7cbc9257b97a17ca2393d737bda51536c0b81169ec38b9ac6baa2c9dc7a61ae7817f103 SHA512 be1197320620ffc9c00aa8aec14de71b5c0bdbfc286309fcc5e995c74d1249cea798fd226ba613b345719238b73883af9f2bc28e1e1f698563767295df518a6e
25 DIST nss-3.69.1.tar.gz 82426679 BLAKE2B 71948a9fee08536c41da9916e6d2eb82bf52bf688c900eb283f83f0ac60498cce2d936950836b0bfb097ee9315860dbbd402a3b63ab28d23b3bd90523b65ead3 SHA512 26895e542e66bb99965da9832cd7f5b191336aa1027b2e90f194473dd8f6277909102f21833d988fa8d8b0e2178eaca9437b182d1155038abb0743eda2cc5697
26 DIST nss-3.69.tar.gz 82427268 BLAKE2B 1467c7f17b1d3d46fb4fcb1d19112585c24ec3d10125d7e954a87c3a6d0e20a300d2084a9480c88dad20274c500e1efb70143bb92b4a8110c2080abf3fe68dfe SHA512 9dd824b3e96aa5a032d5005cdf60a55efac23f69f3857cd1f4337f3ebad92fc2354bb05ed85f04a368e55306a46ebd17a91f7f432f1c191a96e99aecfa62cfdf
27
28 diff --git a/dev-libs/nss/nss-3.68.1.ebuild b/dev-libs/nss/nss-3.68.1.ebuild
29 new file mode 100644
30 index 000000000000..df232f044ef4
31 --- /dev/null
32 +++ b/dev-libs/nss/nss-3.68.1.ebuild
33 @@ -0,0 +1,367 @@
34 +# Copyright 1999-2021 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +inherit flag-o-matic multilib toolchain-funcs multilib-minimal
40 +
41 +NSPR_VER="4.32"
42 +RTM_NAME="NSS_${PV//./_}_RTM"
43 +
44 +DESCRIPTION="Mozilla's Network Security Services library that implements PKI support"
45 +HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS"
46 +SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz
47 + cacert? ( https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r2.patch )"
48 +
49 +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
50 +SLOT="0"
51 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris"
52 +IUSE="cacert utils cpu_flags_ppc_altivec cpu_flags_ppc_vsx"
53 +# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND
54 +RDEPEND="
55 + >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}]
56 + >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}]
57 + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
58 + virtual/pkgconfig
59 +"
60 +DEPEND="${RDEPEND}"
61 +BDEPEND="dev-lang/perl"
62 +
63 +RESTRICT="test"
64 +
65 +S="${WORKDIR}/${P}/${PN}"
66 +
67 +MULTILIB_CHOST_TOOLS=(
68 + /usr/bin/nss-config
69 +)
70 +
71 +PATCHES=(
72 + # Custom changes for gentoo
73 + "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch"
74 + "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch"
75 + "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch"
76 +)
77 +
78 +src_prepare() {
79 + default
80 +
81 + if use cacert ; then
82 + eapply -p2 "${DISTDIR}"/nss-cacert-class1-class3-r2.patch
83 + fi
84 +
85 + pushd coreconf >/dev/null || die
86 + # hack nspr paths
87 + echo 'INCLUDES += -I$(DIST)/include/dbm' \
88 + >> headers.mk || die "failed to append include"
89 +
90 + # modify install path
91 + sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \
92 + -i source.mk || die
93 +
94 + # Respect LDFLAGS
95 + sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk
96 + popd >/dev/null || die
97 +
98 + # Fix pkgconfig file for Prefix
99 + sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \
100 + config/Makefile || die
101 +
102 + # use host shlibsign if need be #436216
103 + if tc-is-cross-compiler ; then
104 + sed -i \
105 + -e 's:"${2}"/shlibsign:shlibsign:' \
106 + cmd/shlibsign/sign.sh || die
107 + fi
108 +
109 + # dirty hack
110 + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \
111 + lib/ssl/config.mk || die
112 + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \
113 + cmd/platlibs.mk || die
114 +
115 + multilib_copy_sources
116 +
117 + strip-flags
118 +}
119 +
120 +multilib_src_configure() {
121 + # Ensure we stay multilib aware
122 + sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die
123 +}
124 +
125 +nssarch() {
126 + # Most of the arches are the same as $ARCH
127 + local t=${1:-${CHOST}}
128 + case ${t} in
129 + *86*-pc-solaris2*) echo "i86pc" ;;
130 + aarch64*) echo "aarch64" ;;
131 + hppa*) echo "parisc" ;;
132 + i?86*) echo "i686" ;;
133 + x86_64*) echo "x86_64" ;;
134 + *) tc-arch ${t} ;;
135 + esac
136 +}
137 +
138 +nssbits() {
139 + local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS"
140 + if [[ ${1} == BUILD_ ]]; then
141 + cc=$(tc-getBUILD_CC)
142 + else
143 + cc=$(tc-getCC)
144 + fi
145 + echo > "${T}"/test.c || die
146 + ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die
147 + case $(file "${T}/${1}test.o") in
148 + *32-bit*x86-64*) echo USE_X32=1;;
149 + *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;;
150 + *32-bit*|*ppc*|*i386*) ;;
151 + *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";;
152 + esac
153 +}
154 +
155 +multilib_src_compile() {
156 + # use ABI to determine bit'ness, or fallback if unset
157 + local buildbits mybits
158 + case "${ABI}" in
159 + n32) mybits="USE_N32=1";;
160 + x32) mybits="USE_X32=1";;
161 + s390x|*64) mybits="USE_64=1";;
162 + ${DEFAULT_ABI})
163 + einfo "Running compilation test to determine bit'ness"
164 + mybits=$(nssbits)
165 + ;;
166 + esac
167 + # bitness of host may differ from target
168 + if tc-is-cross-compiler; then
169 + buildbits=$(nssbits BUILD_)
170 + fi
171 +
172 + local makeargs=(
173 + CC="$(tc-getCC)"
174 + CCC="$(tc-getCXX)"
175 + AR="$(tc-getAR) rc \$@"
176 + RANLIB="$(tc-getRANLIB)"
177 + OPTIMIZER=
178 + ${mybits}
179 + )
180 +
181 + # Take care of nspr settings #436216
182 + local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)"
183 + unset NSPR_INCLUDE_DIR
184 +
185 + export NSS_ALLOW_SSLKEYLOGFILE=1
186 + export NSS_ENABLE_WERROR=0 #567158
187 + export BUILD_OPT=1
188 + export NSS_USE_SYSTEM_SQLITE=1
189 + export NSDISTMODE=copy
190 + export FREEBL_NO_DEPEND=1
191 + export FREEBL_LOWHASH=1
192 + export NSS_SEED_ONLY_DEV_URANDOM=1
193 + export USE_SYSTEM_ZLIB=1
194 + export ZLIB_LIBS=-lz
195 + export ASFLAGS=""
196 + # Fix build failure on arm64
197 + export NS_USE_GCC=1
198 + # Detect compiler type and set proper environment value
199 + if tc-is-gcc; then
200 + export CC_IS_GCC=1
201 + elif tc-is-clang; then
202 + export CC_IS_CLANG=1
203 + fi
204 +
205 + # explicitly disable altivec/vsx if not requested
206 + # https://bugs.gentoo.org/789114
207 + case ${ARCH} in
208 + ppc*)
209 + use cpu_flags_ppc_altivec || export NSS_DISABLE_ALTIVEC=1
210 + use cpu_flags_ppc_vsx || export NSS_DISABLE_CRYPTO_VSX=1
211 + ;;
212 + esac
213 +
214 + local d
215 +
216 + # Build the host tools first.
217 + LDFLAGS="${BUILD_LDFLAGS}" \
218 + XCFLAGS="${BUILD_CFLAGS}" \
219 + NSPR_LIB_DIR="${T}/fakedir" \
220 + emake -j1 -C coreconf \
221 + CC="$(tc-getBUILD_CC)" \
222 + ${buildbits-${mybits}}
223 + makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" )
224 +
225 + # Then build the target tools.
226 + for d in . lib/dbm ; do
227 + CPPFLAGS="${myCPPFLAGS}" \
228 + XCFLAGS="${CFLAGS} ${CPPFLAGS}" \
229 + NSPR_LIB_DIR="${T}/fakedir" \
230 + emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)"
231 + done
232 +}
233 +
234 +# Altering these 3 libraries breaks the CHK verification.
235 +# All of the following cause it to break:
236 +# - stripping
237 +# - prelink
238 +# - ELF signing
239 +# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html
240 +# Either we have to NOT strip them, or we have to forcibly resign after
241 +# stripping.
242 +#local_libdir="$(get_libdir)"
243 +#export STRIP_MASK="
244 +# */${local_libdir}/libfreebl3.so*
245 +# */${local_libdir}/libnssdbm3.so*
246 +# */${local_libdir}/libsoftokn3.so*"
247 +
248 +export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3"
249 +
250 +generate_chk() {
251 + local shlibsign="$1"
252 + local libdir="$2"
253 + einfo "Resigning core NSS libraries for FIPS validation"
254 + shift 2
255 + local i
256 + for i in ${NSS_CHK_SIGN_LIBS} ; do
257 + local libname=lib${i}.so
258 + local chkname=lib${i}.chk
259 + "${shlibsign}" \
260 + -i "${libdir}"/${libname} \
261 + -o "${libdir}"/${chkname}.tmp \
262 + && mv -f \
263 + "${libdir}"/${chkname}.tmp \
264 + "${libdir}"/${chkname} \
265 + || die "Failed to sign ${libname}"
266 + done
267 +}
268 +
269 +cleanup_chk() {
270 + local libdir="$1"
271 + shift 1
272 + local i
273 + for i in ${NSS_CHK_SIGN_LIBS} ; do
274 + local libfname="${libdir}/lib${i}.so"
275 + # If the major version has changed, then we have old chk files.
276 + [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \
277 + && rm -f "${libfname}.chk"
278 + done
279 +}
280 +
281 +multilib_src_install() {
282 + pushd dist >/dev/null || die
283 +
284 + dodir /usr/$(get_libdir)
285 + cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed"
286 + local i
287 + for i in crmf freebl nssb nssckfw ; do
288 + cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed"
289 + done
290 +
291 + # Install nss-config and pkgconfig file
292 + dodir /usr/bin
293 + cp -L */bin/nss-config "${ED}"/usr/bin || die
294 + dodir /usr/$(get_libdir)/pkgconfig
295 + cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die
296 +
297 + # create an nss-softokn.pc from nss.pc for libfreebl and some private headers
298 + # bug 517266
299 + sed -e 's#Libs:#Libs: -lfreebl#' \
300 + -e 's#Cflags:#Cflags: -I${includedir}/private#' \
301 + */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \
302 + || die "could not create nss-softokn.pc"
303 +
304 + # all the include files
305 + insinto /usr/include/nss
306 + doins public/nss/*.{h,api}
307 + insinto /usr/include/nss/private
308 + doins private/nss/{blapi,alghmac,cmac}.h
309 +
310 + popd >/dev/null || die
311 +
312 + local f nssutils
313 + # Always enabled because we need it for chk generation.
314 + nssutils=( shlibsign )
315 +
316 + if multilib_is_native_abi ; then
317 + if use utils; then
318 + # The tests we do not need to install.
319 + #nssutils_test="bltest crmftest dbtest dertimetest
320 + #fipstest remtest sdrtest"
321 + # checkcert utils has been removed in nss-3.22:
322 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545
323 + # https://hg.mozilla.org/projects/nss/rev/df1729d37870
324 + # certcgi has been removed in nss-3.36:
325 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602
326 + nssutils+=(
327 + addbuiltin
328 + atob
329 + baddbdir
330 + btoa
331 + certutil
332 + cmsutil
333 + conflict
334 + crlutil
335 + derdump
336 + digest
337 + makepqg
338 + mangle
339 + modutil
340 + multinit
341 + nonspr10
342 + ocspclnt
343 + oidcalc
344 + p7content
345 + p7env
346 + p7sign
347 + p7verify
348 + pk11mode
349 + pk12util
350 + pp
351 + rsaperf
352 + selfserv
353 + signtool
354 + signver
355 + ssltap
356 + strsclnt
357 + symkeyutil
358 + tstclnt
359 + vfychain
360 + vfyserv
361 + )
362 + # install man-pages for utils (bug #516810)
363 + doman doc/nroff/*.1
364 + fi
365 + pushd dist/*/bin >/dev/null || die
366 + for f in ${nssutils[@]}; do
367 + dobin ${f}
368 + done
369 + popd >/dev/null || die
370 + fi
371 +
372 + # Prelink breaks the CHK files. We don't have any reliable way to run
373 + # shlibsign after prelink.
374 + dodir /etc/prelink.conf.d
375 + printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \
376 + > "${ED}"/etc/prelink.conf.d/nss.conf
377 +}
378 +
379 +pkg_postinst() {
380 + multilib_pkg_postinst() {
381 + # We must re-sign the libraries AFTER they are stripped.
382 + local shlibsign="${EROOT}/usr/bin/shlibsign"
383 + # See if we can execute it (cross-compiling & such). #436216
384 + "${shlibsign}" -h >&/dev/null
385 + if [[ $? -gt 1 ]] ; then
386 + shlibsign="shlibsign"
387 + fi
388 + generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir)
389 + }
390 +
391 + multilib_foreach_abi multilib_pkg_postinst
392 +}
393 +
394 +pkg_postrm() {
395 + multilib_pkg_postrm() {
396 + cleanup_chk "${EROOT}"/usr/$(get_libdir)
397 + }
398 +
399 + multilib_foreach_abi multilib_pkg_postrm
400 +}