Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/nspr/
Date: Sat, 06 Aug 2022 07:50:26
Message-Id: 1659772221.113e984e581c26bec5f994ab62085564354d28c9.juippis@gentoo
1 commit: 113e984e581c26bec5f994ab62085564354d28c9
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 6 07:50:00 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 6 07:50:21 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=113e984e
7
8 dev-libs/nspr: add 4.34.1
9
10 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
11
12 dev-libs/nspr/Manifest | 1 +
13 dev-libs/nspr/nspr-4.34.1.ebuild | 157 +++++++++++++++++++++++++++++++++++++++
14 2 files changed, 158 insertions(+)
15
16 diff --git a/dev-libs/nspr/Manifest b/dev-libs/nspr/Manifest
17 index 154a8b995391..afcc81a54129 100644
18 --- a/dev-libs/nspr/Manifest
19 +++ b/dev-libs/nspr/Manifest
20 @@ -1,2 +1,3 @@
21 DIST nspr-4.33.tar.gz 1078948 BLAKE2B b46e1c02ab7e5c442288a2cba2868166adb9461950d35fcd76074e3340734057f2b1bbeb3c700f38edf3710323ffd34576dd644814c379033de2a380c54d4fe3 SHA512 8064f826c977f1302a341ca7a7aaf7977b5d10102062c030b1d42b856638e3408ab262447e8c7cfd5a98879b9b1043d17ceae66fbb1e5ed86d6bc3531f26667e
22 +DIST nspr-4.34.1.tar.gz 1096874 BLAKE2B be12bda63a72d25a60542c5cdadaa7dc59ad2d40d41affc0af5eab07659129ff235a62227a78285e4c00bc72a365b49691658aee7818ffc4c5d014aa0c2b0df7 SHA512 b77226c3fbba6fc9acc90deb8496370dba1384de72ce564524c03bc239846fd17c27d7e1fd7ce99161faafdd8c92413ee58ce1a74a41c786759210bbab478991
23 DIST nspr-4.34.tar.gz 1096407 BLAKE2B 61199c1319578570f9569011a2fea8ec6b8c4e8337b03517d1b0e1a22749a7449feb2152c348f3a1d73fefa7aa5067be460f4cbc1728c479309f4a2592424fdf SHA512 4cfac886c14cf7df4c4b79fa1c3bc92e1b14260c9c3018fa2562060d62fecb4e66c0b4e8f7edf4f4823def784a919d99dde88a89674f0cd8a644310b0569ead4
24
25 diff --git a/dev-libs/nspr/nspr-4.34.1.ebuild b/dev-libs/nspr/nspr-4.34.1.ebuild
26 new file mode 100644
27 index 000000000000..90c38eb08772
28 --- /dev/null
29 +++ b/dev-libs/nspr/nspr-4.34.1.ebuild
30 @@ -0,0 +1,157 @@
31 +# Copyright 1999-2022 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=8
35 +
36 +inherit autotools toolchain-funcs multilib-minimal
37 +
38 +MIN_PV="$(ver_cut 2)"
39 +
40 +DESCRIPTION="Netscape Portable Runtime"
41 +HOMEPAGE="https://www.mozilla.org/projects/nspr/"
42 +SRC_URI="https://archive.mozilla.org/pub/nspr/releases/v${PV}/src/${P}.tar.gz"
43 +
44 +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
45 +SLOT="0"
46 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86-solaris"
47 +IUSE="debug"
48 +
49 +MULTILIB_CHOST_TOOLS=(
50 + /usr/bin/nspr-config
51 +)
52 +
53 +PATCHES=(
54 + "${FILESDIR}"/${PN}-4.23-prtime.patch
55 + "${FILESDIR}"/${PN}-4.7.1-solaris.patch
56 + "${FILESDIR}"/${PN}-4.10.6-solaris.patch
57 + "${FILESDIR}"/${PN}-4.8.4-darwin-install_name.patch
58 + "${FILESDIR}"/${PN}-4.8.9-link-flags.patch
59 + # We do not need to pass -L$libdir via nspr-config --libs
60 + "${FILESDIR}"/${PN}-4.9.5_nspr_config.patch
61 + "${FILESDIR}"/${PN}-4.33-loong.patch
62 +)
63 +
64 +QA_CONFIGURE_OPTIONS="--disable-static"
65 +
66 +src_prepare() {
67 + cd "${S}"/nspr || die
68 +
69 + default
70 +
71 + use elibc_musl && eapply "${FILESDIR}"/${PN}-4.21-ipv6-musl-support.patch
72 +
73 + # rename configure.in to configure.ac for new autotools compatibility
74 + if [[ -e "${S}"/nspr/configure.in ]] ; then
75 + einfo "Renaming configure.in to configure.ac"
76 + mv "${S}"/nspr/configure.{in,ac} || die
77 + else
78 + elog "configure.in rename logic can be removed from ebuild."
79 + fi
80 +
81 + # We must run eautoconf to regenerate configure
82 + eautoconf
83 +
84 + # make sure it won't find Perl out of Prefix
85 + sed -i -e "s/perl5//g" "${S}"/nspr/configure || die
86 +
87 + # Respect LDFLAGS
88 + sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \
89 + "${S}"/nspr/config/rules.mk || die
90 +}
91 +
92 +multilib_src_configure() {
93 + # We use the standard BUILD_xxx but nspr uses HOST_xxx
94 + tc-export_build_env BUILD_CC
95 + export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS}
96 + tc-export AR AS CC CXX RANLIB
97 + [[ ${CBUILD} != ${CHOST} ]] \
98 + && export CROSS_COMPILE=1 \
99 + || unset CROSS_COMPILE
100 +
101 + local myconf=(
102 + --libdir="${EPREFIX}/usr/$(get_libdir)"
103 + $(use_enable debug)
104 + $(use_enable !debug optimize)
105 + )
106 +
107 + # The configure has some fancy --enable-{{n,x}32,64bit} switches
108 + # that trigger some code conditional to platform & arch. This really
109 + # matters for the few common arches (x86, ppc) but we pass a little
110 + # more of them to be future-proof.
111 +
112 + # use ABI first, this will work for most cases
113 + case "${ABI}" in
114 + alpha|arm|hppa|m68k|o32|ppc|s390|sh|sparc|x86) ;;
115 + n32) myconf+=( --enable-n32 );;
116 + x32) myconf+=( --enable-x32 );;
117 + s390x|*64) myconf+=( --enable-64bit );;
118 + default) # no abi actually set, fall back to old check
119 + einfo "Running a short build test to determine 64bit'ness"
120 + echo > "${T}"/test.c || die
121 + ${CC} ${CFLAGS} ${CPPFLAGS} -c "${T}"/test.c -o "${T}"/test.o || die
122 + case $(file "${T}"/test.o) in
123 + *32-bit*x86-64*) myconf+=( --enable-x32 );;
124 + *64-bit*|*ppc64*|*x86_64*) myconf+=( --enable-64bit );;
125 + *32-bit*|*ppc*|*i386*) ;;
126 + *) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
127 + esac ;;
128 + *) ;;
129 + esac
130 +
131 + # Ancient autoconf needs help finding the right tools.
132 + LC_ALL="C" ECONF_SOURCE="${S}/nspr" \
133 + ac_cv_path_AR="${AR}" \
134 + ac_cv_path_AS="${AS}" \
135 + econf "${myconf[@]}"
136 +}
137 +
138 +multilib_src_test() {
139 + # https://firefox-source-docs.mozilla.org/nspr/running_nspr_tests.html
140 + cd "${BUILD_DIR}/pr/tests" || die
141 + einfo "Building tests"
142 + emake
143 +
144 + einfo "Running test suite"
145 + ../../../${P}/${PN}/pr/tests/runtests.pl | tee "${T}"/${ABI}-tests.log
146 +
147 + # Needed to check if runtests.pl itself or the tee (somehow) failed
148 + # (can't use die with pipes to check each component)
149 + [[ ${PIPESTATUS[@]} == "0 0" ]] || die "Tests failed to run!"
150 +
151 + local known_failures=(
152 + # network-sandbox related?
153 + cltsrv
154 + # network-sandbox related?
155 + gethost
156 + )
157 +
158 + local known_failure
159 + for known_failure in "${known_failures[@]}" ; do
160 + sed -i -e "/${known_failure}.*FAILED/d" "${T}"/${ABI}-tests.log || die
161 + done
162 +
163 + # But to actually check the test results, we examine the log.
164 + if grep -q "FAILED" "${T}"/${ABI}-tests.log ; then
165 + die "Test failure for ${ABI}!"
166 + fi
167 +}
168 +
169 +multilib_src_install() {
170 + # Their build system is royally confusing, as usual
171 + MINOR_VERSION=${MIN_PV} # Used for .so version
172 + emake DESTDIR="${D}" install
173 +
174 + einfo "removing static libraries as upstream has requested!"
175 + rm "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries."
176 +
177 + # install nspr-config
178 + dobin config/nspr-config
179 +
180 + # Remove stupid files in /usr/bin
181 + rm "${ED}"/usr/bin/prerr.properties || die
182 +
183 + # This is used only to generate prerr.c and prerr.h at build time.
184 + # No other projects use it, and we don't want to depend on perl.
185 + # Talked to upstream and they agreed w/punting.
186 + rm "${ED}"/usr/bin/compile-et.pl || die
187 +}