1
- # Copyright 1999-2022 Gentoo Authors
1
+ # Copyright 1999-2023 Gentoo Authors
2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
- EAPI=7
4
+ EAPI=8
5
5
6
- inherit autotools toolchain-funcs multilib-minimal
6
+ inherit autotools flag-o-matic toolchain-funcs multilib-minimal
7
7
8
8
MIN_PV=" $( ver_cut 2) "
9
9
@@ -13,29 +13,34 @@ SRC_URI="https://archive.mozilla.org/pub/nspr/releases/v${PV}/src/${P}.tar.gz"
13
13
14
14
LICENSE=" || ( MPL-2.0 GPL-2 LGPL-2.1 )"
15
15
SLOT=" 0"
16
- KEYWORDS=" ~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris ~x86 -solaris"
16
+ KEYWORDS=" ~alpha amd64 arm arm64 hppa ~ia64 ~loong ~ m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
17
17
IUSE=" debug"
18
18
19
19
MULTILIB_CHOST_TOOLS=(
20
20
/usr/bin/nspr-config
21
21
)
22
22
23
23
PATCHES=(
24
+ " ${FILESDIR} " /${PN} -4.10.6-solaris.patch
24
25
" ${FILESDIR} " /${PN} -4.23-prtime.patch
25
26
" ${FILESDIR} " /${PN} -4.7.1-solaris.patch
26
- " ${FILESDIR} " /${PN} -4.10.6-solaris.patch
27
27
" ${FILESDIR} " /${PN} -4.8.4-darwin-install_name.patch
28
28
" ${FILESDIR} " /${PN} -4.8.9-link-flags.patch
29
29
# We do not need to pass -L$libdir via nspr-config --libs
30
30
" ${FILESDIR} " /${PN} -4.9.5_nspr_config.patch
31
31
)
32
32
33
+ QA_CONFIGURE_OPTIONS=" --disable-static"
34
+
33
35
src_prepare () {
34
36
cd " ${S} " /nspr || die
35
37
36
38
default
37
39
38
- use elibc_musl && eapply " ${FILESDIR} " /${PN} -4.21-ipv6-musl-support.patch
40
+ if use elibc_musl; then
41
+ eapply " ${FILESDIR} " /${PN} -4.21-ipv6-musl-support.patch
42
+ eapply " ${FILESDIR} " /nspr-4.35-bgo-905998-lfs64-musl.patch
43
+ fi
39
44
40
45
# rename configure.in to configure.ac for new autotools compatibility
41
46
if [[ -e " ${S} " /nspr/configure.in ]] ; then
@@ -57,6 +62,9 @@ src_prepare() {
57
62
}
58
63
59
64
multilib_src_configure () {
65
+ # The build system overrides user optimization level based on a configure flag. #886987
66
+ local my_optlvl=$( get-flag ' -O*' )
67
+
60
68
# We use the standard BUILD_xxx but nspr uses HOST_xxx
61
69
tc-export_build_env BUILD_CC
62
70
export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS}
@@ -65,11 +73,15 @@ multilib_src_configure() {
65
73
&& export CROSS_COMPILE=1 \
66
74
|| unset CROSS_COMPILE
67
75
68
- local myconf=(
69
- --libdir=" ${EPREFIX} /usr/$( get_libdir) "
70
- $( use_enable debug)
71
- $( use_enable ! debug optimize)
72
- )
76
+ local myconf=( --libdir=" ${EPREFIX} /usr/$( get_libdir) " )
77
+
78
+ # Optimization is disabled when debug is enabled.
79
+ if use debug; then
80
+ myconf+=( --enable-debug )
81
+ else
82
+ myconf+=( --disable-debug )
83
+ myconf+=( --enable-optimize=" ${my_optlvl} " )
84
+ fi
73
85
74
86
# The configure has some fancy --enable-{{n,x}32,64bit} switches
75
87
# that trigger some code conditional to platform & arch. This really
@@ -102,6 +114,37 @@ multilib_src_configure() {
102
114
econf " ${myconf[@]} "
103
115
}
104
116
117
+ multilib_src_test () {
118
+ # https://firefox-source-docs.mozilla.org/nspr/running_nspr_tests.html
119
+ cd " ${BUILD_DIR} /pr/tests" || die
120
+ einfo " Building tests"
121
+ emake
122
+
123
+ einfo " Running test suite"
124
+ ../../../${P} /${PN} /pr/tests/runtests.pl | tee " ${T} " /${ABI} -tests.log
125
+
126
+ # Needed to check if runtests.pl itself or the tee (somehow) failed
127
+ # (can't use die with pipes to check each component)
128
+ [[ ${PIPESTATUS[@]} == " 0 0" ]] || die " Tests failed to run!"
129
+
130
+ local known_failures=(
131
+ # network-sandbox related?
132
+ cltsrv
133
+ # network-sandbox related?
134
+ gethost
135
+ )
136
+
137
+ local known_failure
138
+ for known_failure in " ${known_failures[@]} " ; do
139
+ sed -i -e " /${known_failure} .*FAILED/d" " ${T} " /${ABI} -tests.log || die
140
+ done
141
+
142
+ # But to actually check the test results, we examine the log.
143
+ if grep -q " FAILED" " ${T} " /${ABI} -tests.log ; then
144
+ die " Test failure for ${ABI} !"
145
+ fi
146
+ }
147
+
105
148
multilib_src_install () {
106
149
# Their build system is royally confusing, as usual
107
150
MINOR_VERSION=${MIN_PV} # Used for .so version
0 commit comments