1 |
commit: f86cb89cde8192adfdab42ee0b69109ddc12f1bd |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 01:01:00 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 01:03:32 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f86cb89c |
7 |
|
8 |
dev-lang/spidermonkey: add USE=lto |
9 |
|
10 |
Forcing LTO via CFLAGS is not enough -- we need to tell build system |
11 |
that we want to use LTO. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/746947 |
14 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
15 |
|
16 |
dev-lang/spidermonkey/metadata.xml | 1 + |
17 |
dev-lang/spidermonkey/spidermonkey-78.3.1.ebuild | 14 ++++++++++++-- |
18 |
2 files changed, 13 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/dev-lang/spidermonkey/metadata.xml b/dev-lang/spidermonkey/metadata.xml |
21 |
index fc9478d330b..c97143567bf 100644 |
22 |
--- a/dev-lang/spidermonkey/metadata.xml |
23 |
+++ b/dev-lang/spidermonkey/metadata.xml |
24 |
@@ -9,6 +9,7 @@ |
25 |
<flag name="custom-optimization">Build with user-specified compiler optimizations |
26 |
(-Os, -O0, -O1, -O2, -O3) from CFLAGS (unsupported)</flag> |
27 |
<flag name="debug">Enable assertions to allow for easier debugging of programs that link to spidermonkey -- note this will often crash software on regular end-user systems</flag> |
28 |
+ <flag name="lto">Enable Link Time Optimization (LTO)</flag> |
29 |
<flag name="system-icu">Use the system-wide <pkg>dev-libs/icu</pkg> instead of bundled -- note, only takes effect when icu flag is enabled</flag> |
30 |
</use> |
31 |
</pkgmetadata> |
32 |
|
33 |
diff --git a/dev-lang/spidermonkey/spidermonkey-78.3.1.ebuild b/dev-lang/spidermonkey/spidermonkey-78.3.1.ebuild |
34 |
index a0ec34c118f..1694f51c184 100644 |
35 |
--- a/dev-lang/spidermonkey/spidermonkey-78.3.1.ebuild |
36 |
+++ b/dev-lang/spidermonkey/spidermonkey-78.3.1.ebuild |
37 |
@@ -7,7 +7,7 @@ PYTHON_COMPAT=( python3_{6..9} ) |
38 |
|
39 |
WANT_AUTOCONF="2.1" |
40 |
|
41 |
-inherit autotools check-reqs multiprocessing python-any-r1 toolchain-funcs |
42 |
+inherit autotools check-reqs flag-o-matic multiprocessing python-any-r1 toolchain-funcs |
43 |
|
44 |
MY_PN="mozjs" |
45 |
MY_PV="${PV/_pre*}" # Handle Gentoo pre-releases |
46 |
@@ -53,7 +53,7 @@ KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc64 ~s390 ~x86" |
47 |
|
48 |
SLOT="78" |
49 |
LICENSE="MPL-2.0" |
50 |
-IUSE="cpu_flags_arm_neon debug +jit test" |
51 |
+IUSE="cpu_flags_arm_neon debug +jit lto test" |
52 |
|
53 |
RESTRICT="!test? ( test )" |
54 |
|
55 |
@@ -107,6 +107,8 @@ pkg_setup() { |
56 |
src_prepare() { |
57 |
pushd ../.. &>/dev/null || die |
58 |
|
59 |
+ use lto && rm -v "${WORKDIR}"/firefox-patches/*-LTO-Only-enable-LTO-*.patch |
60 |
+ |
61 |
eapply "${WORKDIR}"/firefox-patches |
62 |
eapply "${WORKDIR}"/spidermonkey-patches |
63 |
|
64 |
@@ -175,6 +177,14 @@ src_configure() { |
65 |
fi |
66 |
fi |
67 |
|
68 |
+ # Tell build system that we want to use LTO |
69 |
+ if use lto ; then |
70 |
+ myeconfargs+=( --enable-lto ) |
71 |
+ fi |
72 |
+ |
73 |
+ # LTO flag was handled via configure |
74 |
+ filter-flags '-flto*' |
75 |
+ |
76 |
# Forcing system-icu allows us to skip patching bundled ICU for PPC |
77 |
# and other minor arches |
78 |
ECONF_SOURCE="${S}" \ |