Line 0
Link Here
|
|
|
1 |
diff -urN a/nss/lib/ckfw/builtins/certdata.txt b/nss/lib/ckfw/builtins/certdata.txt |
2 |
--- a/nss/lib/ckfw/builtins/certdata.txt 2015-01-22 13:49:26.000000000 -0600 |
Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2015 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/dev-libs/nss/nss-3.19.1.ebuild,v 1.1 2015/06/01 21:11:59 axs Exp $ |
4 |
|
5 |
EAPI=5 |
6 |
inherit eutils flag-o-matic multilib toolchain-funcs multilib-minimal |
7 |
|
8 |
NSPR_VER="4.10.8" |
9 |
RTM_NAME="NSS_${PV//./_}_RTM" |
10 |
# Rev of https://git.fedorahosted.org/cgit/nss-pem.git |
11 |
PEM_GIT_REV="015ae754dd9f6fbcd7e52030ec9732eb27fc06a8" |
12 |
PEM_P="${PN}-pem-${PEM_GIT_REV}" |
13 |
|
14 |
DESCRIPTION="Mozilla's Network Security Services library that implements PKI support" |
15 |
HOMEPAGE="http://www.mozilla.org/projects/security/pki/nss/" |
16 |
SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz |
17 |
cacert? ( http://dev.gentoo.org/~anarchy/patches/${PN}-3.14.1-add_spi+cacerts_ca_certs.patch ) |
18 |
nss-pem? ( https://git.fedorahosted.org/cgit/nss-pem.git/snapshot/${PEM_P}.tar.bz2 )" |
19 |
|
20 |
LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" |
21 |
SLOT="0" |
22 |
KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86" |
23 |
IUSE="+cacert +nss-pem utils" |
24 |
CDEPEND=">=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}] |
25 |
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]" |
26 |
DEPEND=">=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] |
27 |
>=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] |
28 |
${CDEPEND}" |
29 |
RDEPEND=">=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}] |
30 |
${CDEPEND} |
31 |
abi_x86_32? ( |
32 |
!<=app-emulation/emul-linux-x86-baselibs-20140508-r12 |
33 |
!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] |
34 |
)" |
35 |
|
36 |
RESTRICT="test" |
37 |
|
38 |
S="${WORKDIR}/${P}/${PN}" |
39 |
|
40 |
MULTILIB_CHOST_TOOLS=( |
41 |
/usr/bin/nss-config |
42 |
) |
43 |
|
44 |
src_unpack() { |
45 |
unpack ${A} |
46 |
if use nss-pem ; then |
47 |
mv "${PEM_P}"/nss/lib/ckfw/pem/ "${S}"/lib/ckfw/ || die |
48 |
fi |
49 |
} |
50 |
|
51 |
src_prepare() { |
52 |
# Custom changes for gentoo |
53 |
epatch "${FILESDIR}/${PN}-3.17.1-gentoo-fixups.patch" |
54 |
epatch "${FILESDIR}/${PN}-3.15-gentoo-fixup-warnings.patch" |
55 |
use cacert && epatch "${DISTDIR}/${PN}-3.14.1-add_spi+cacerts_ca_certs.patch" |
56 |
use nss-pem && epatch "${FILESDIR}/${PN}-3.15.4-enable-pem.patch" |
57 |
epatch "${FILESDIR}/nss-3.14.2-solaris-gcc.patch" |
58 |
epatch "${FILESDIR}/${PN}-cacert-class3.patch" # 521462 |
59 |
|
60 |
epatch "${FILESDIR}/${PN}-3.16-musl.patch" |
61 |
|
62 |
pushd coreconf >/dev/null || die |
63 |
# hack nspr paths |
64 |
echo 'INCLUDES += -I$(DIST)/include/dbm' \ |
65 |
>> headers.mk || die "failed to append include" |
66 |
|
67 |
# modify install path |
68 |
sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \ |
69 |
-i source.mk || die |
70 |
|
71 |
# Respect LDFLAGS |
72 |
sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk |
73 |
popd >/dev/null || die |
74 |
|
75 |
# Fix pkgconfig file for Prefix |
76 |
sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \ |
77 |
config/Makefile || die |
78 |
|
79 |
# use host shlibsign if need be #436216 |
80 |
if tc-is-cross-compiler ; then |
81 |
sed -i \ |
82 |
-e 's:"${2}"/shlibsign:shlibsign:' \ |
83 |
cmd/shlibsign/sign.sh || die |
84 |
fi |
85 |
|
86 |
# dirty hack |
87 |
sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \ |
88 |
lib/ssl/config.mk || die |
89 |
sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \ |
90 |
cmd/platlibs.mk || die |
91 |
|
92 |
multilib_copy_sources |
93 |
|
94 |
strip-flags |
95 |
} |
96 |
|
97 |
multilib_src_configure() { |
98 |
# Ensure we stay multilib aware |
99 |
sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die |
100 |
} |
101 |
|
102 |
nssarch() { |
103 |
# Most of the arches are the same as $ARCH |
104 |
local t=${1:-${CHOST}} |
105 |
case ${t} in |
106 |
aarch64*)echo "aarch64";; |
107 |
hppa*) echo "parisc";; |
108 |
i?86*) echo "i686";; |
109 |
x86_64*) echo "x86_64";; |
110 |
*) tc-arch ${t};; |
111 |
esac |
112 |
} |
113 |
|
114 |
nssbits() { |
115 |
local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS" |
116 |
if [[ ${1} == BUILD_ ]]; then |
117 |
cc=$(tc-getBUILD_CC) |
118 |
else |
119 |
cc=$(tc-getCC) |
120 |
fi |
121 |
echo > "${T}"/test.c || die |
122 |
${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die |
123 |
case $(file "${T}/${1}test.o") in |
124 |
*32-bit*x86-64*) echo USE_X32=1;; |
125 |
*64-bit*|*ppc64*|*x86_64*) echo USE_64=1;; |
126 |
*32-bit*|*ppc*|*i386*) ;; |
127 |
*) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";; |
128 |
esac |
129 |
} |
130 |
|
131 |
multilib_src_compile() { |
132 |
# use ABI to determine bit'ness, or fallback if unset |
133 |
local buildbits mybits |
134 |
case "${ABI}" in |
135 |
n32) mybits="USE_N32=1";; |
136 |
x32) mybits="USE_X32=1";; |
137 |
s390x|*64) mybits="USE_64=1";; |
138 |
${DEFAULT_ABI}) |
139 |
einfo "Running compilation test to determine bit'ness" |
140 |
mybits=$(nssbits) |
141 |
;; |
142 |
esac |
143 |
# bitness of host may differ from target |
144 |
if tc-is-cross-compiler; then |
145 |
buildbits=$(nssbits BUILD_) |
146 |
fi |
147 |
|
148 |
local makeargs=( |
149 |
CC="$(tc-getCC)" |
150 |
AR="$(tc-getAR) rc \$@" |
151 |
RANLIB="$(tc-getRANLIB)" |
152 |
OPTIMIZER= |
153 |
${mybits} |
154 |
) |
155 |
|
156 |
# Take care of nspr settings #436216 |
157 |
local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)" |
158 |
unset NSPR_INCLUDE_DIR |
159 |
|
160 |
# Do not let `uname` be used. |
161 |
if use kernel_linux ; then |
162 |
makeargs+=( |
163 |
OS_TARGET=Linux |
164 |
OS_RELEASE=2.6 |
165 |
OS_TEST="$(nssarch)" |
166 |
) |
167 |
fi |
168 |
|
169 |
export BUILD_OPT=1 |
170 |
export NSS_USE_SYSTEM_SQLITE=1 |
171 |
export NSDISTMODE=copy |
172 |
export NSS_ENABLE_ECC=1 |
173 |
export FREEBL_NO_DEPEND=1 |
174 |
export ASFLAGS="" |
175 |
|
176 |
local d |
177 |
|
178 |
# Build the host tools first. |
179 |
LDFLAGS="${BUILD_LDFLAGS}" \ |
180 |
XCFLAGS="${BUILD_CFLAGS}" \ |
181 |
NSPR_LIB_DIR="${T}/fakedir" \ |
182 |
emake -j1 -C coreconf \ |
183 |
CC="$(tc-getBUILD_CC)" \ |
184 |
${buildbits:-${mybits}} |
185 |
makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) |
186 |
|
187 |
# Then build the target tools. |
188 |
for d in . lib/dbm ; do |
189 |
CPPFLAGS="${myCPPFLAGS}" \ |
190 |
XCFLAGS="${CFLAGS} ${CPPFLAGS}" \ |
191 |
NSPR_LIB_DIR="${T}/fakedir" \ |
192 |
emake -j1 "${makeargs[@]}" -C ${d} |
193 |
done |
194 |
} |
195 |
|
196 |
# Altering these 3 libraries breaks the CHK verification. |
197 |
# All of the following cause it to break: |
198 |
# - stripping |
199 |
# - prelink |
200 |
# - ELF signing |
201 |
# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html |
202 |
# Either we have to NOT strip them, or we have to forcibly resign after |
203 |
# stripping. |
204 |
#local_libdir="$(get_libdir)" |
205 |
#export STRIP_MASK=" |
206 |
# */${local_libdir}/libfreebl3.so* |
207 |
# */${local_libdir}/libnssdbm3.so* |
208 |
# */${local_libdir}/libsoftokn3.so*" |
209 |
|
210 |
export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3" |
211 |
|
212 |
generate_chk() { |
213 |
local shlibsign="$1" |
214 |
local libdir="$2" |
215 |
einfo "Resigning core NSS libraries for FIPS validation" |
216 |
shift 2 |
217 |
local i |
218 |
for i in ${NSS_CHK_SIGN_LIBS} ; do |
219 |
local libname=lib${i}.so |
220 |
local chkname=lib${i}.chk |
221 |
"${shlibsign}" \ |
222 |
-i "${libdir}"/${libname} \ |
223 |
-o "${libdir}"/${chkname}.tmp \ |
224 |
&& mv -f \ |
225 |
"${libdir}"/${chkname}.tmp \ |
226 |
"${libdir}"/${chkname} \ |
227 |
|| die "Failed to sign ${libname}" |
228 |
done |
229 |
} |
230 |
|
231 |
cleanup_chk() { |
232 |
local libdir="$1" |
233 |
shift 1 |
234 |
local i |
235 |
for i in ${NSS_CHK_SIGN_LIBS} ; do |
236 |
local libfname="${libdir}/lib${i}.so" |
237 |
# If the major version has changed, then we have old chk files. |
238 |
[ ! -f "${libfname}" -a -f "${libfname}.chk" ] \ |
239 |
&& rm -f "${libfname}.chk" |
240 |
done |
241 |
} |
242 |
|
243 |
multilib_src_install() { |
244 |
pushd dist >/dev/null || die |
245 |
|
246 |
dodir /usr/$(get_libdir) |
247 |
cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed" |
248 |
cp -L -t "${ED}"/usr/$(get_libdir) */lib/{libcrmf,libfreebl}.a || die "copying libs failed" |
249 |
|
250 |
# Install nss-config and pkgconfig file |
251 |
dodir /usr/bin |
252 |
cp -L */bin/nss-config "${ED}"/usr/bin || die |
253 |
dodir /usr/$(get_libdir)/pkgconfig |
254 |
cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die |
255 |
|
256 |
# create an nss-softokn.pc from nss.pc for libfreebl and some private headers |
257 |
# bug 517266 |
258 |
sed -e 's#Libs:#Libs: -lfreebl#' \ |
259 |
-e 's#Cflags:#Cflags: -I${includedir}/private#' \ |
260 |
*/lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \ |
261 |
|| die "could not create nss-softokn.pc" |
262 |
|
263 |
# all the include files |
264 |
insinto /usr/include/nss |
265 |
doins public/nss/*.h |
266 |
insinto /usr/include/nss/private |
267 |
doins private/nss/{blapi,alghmac}.h |
268 |
|
269 |
popd >/dev/null || die |
270 |
|
271 |
local f nssutils |
272 |
# Always enabled because we need it for chk generation. |
273 |
nssutils="shlibsign" |
274 |
|
275 |
if multilib_is_native_abi ; then |
276 |
if use utils; then |
277 |
# The tests we do not need to install. |
278 |
#nssutils_test="bltest crmftest dbtest dertimetest |
279 |
#fipstest remtest sdrtest" |
280 |
nssutils="addbuiltin atob baddbdir btoa certcgi certutil checkcert |
281 |
cmsutil conflict crlutil derdump digest makepqg mangle modutil multinit |
282 |
nonspr10 ocspclnt oidcalc p7content p7env p7sign p7verify pk11mode |
283 |
pk12util pp rsaperf selfserv shlibsign signtool signver ssltap strsclnt |
284 |
symkeyutil tstclnt vfychain vfyserv" |
285 |
# install man-pages for utils (bug #516810) |
286 |
doman doc/nroff/*.1 |
287 |
fi |
288 |
pushd dist/*/bin >/dev/null || die |
289 |
for f in ${nssutils}; do |
290 |
dobin ${f} |
291 |
done |
292 |
popd >/dev/null || die |
293 |
fi |
294 |
|
295 |
# Prelink breaks the CHK files. We don't have any reliable way to run |
296 |
# shlibsign after prelink. |
297 |
local l libs=() liblist |
298 |
for l in ${NSS_CHK_SIGN_LIBS} ; do |
299 |
libs+=("${EPREFIX}/usr/$(get_libdir)/lib${l}.so") |
300 |
done |
301 |
liblist=$(printf '%s:' "${libs[@]}") |
302 |
echo -e "PRELINK_PATH_MASK=${liblist%:}" > "${T}/90nss-${ABI}" |
303 |
doenvd "${T}/90nss-${ABI}" |
304 |
} |
305 |
|
306 |
pkg_postinst() { |
307 |
multilib_pkg_postinst() { |
308 |
# We must re-sign the libraries AFTER they are stripped. |
309 |
local shlibsign="${EROOT}/usr/bin/shlibsign" |
310 |
# See if we can execute it (cross-compiling & such). #436216 |
311 |
"${shlibsign}" -h >&/dev/null |
312 |
if [[ $? -gt 1 ]] ; then |
313 |
shlibsign="shlibsign" |
314 |
fi |
315 |
generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir) |
316 |
} |
317 |
|
318 |
multilib_foreach_abi multilib_pkg_postinst |
319 |
} |
320 |
|
321 |
pkg_postrm() { |
322 |
multilib_pkg_postrm() { |
323 |
cleanup_chk "${EROOT}"/usr/$(get_libdir) |
324 |
} |
325 |
|
326 |
multilib_foreach_abi multilib_pkg_postrm |
327 |
} |