Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/kexec-tools/
Date: Sun, 03 May 2020 19:01:59
Message-Id: 1588532471.b4aa565ce155f21bad4f3365268c7e7f3e370f23.whissi@gentoo
1 commit: b4aa565ce155f21bad4f3365268c7e7f3e370f23
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Sun May 3 19:00:08 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sun May 3 19:01:11 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4aa565c
7
8 sys-apps/kexec-tools: respect CFLAGS for purgatory
9
10 Only when building purgatory, replace -mfunction-return=thunk and
11 -mindirect-branch=thunk flags with similar -mfunction-return=thunk-inline
12 and -mindirect-branch=thunk-inline flags, which are not incompatible
13 with flags added by build system.
14
15 Closes: https://bugs.gentoo.org/646536
16 Closes: https://bugs.gentoo.org/692930
17 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
18 Package-Manager: Portage-2.3.99, Repoman-2.3.22
19 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
20
21 sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild | 24 +++++++++++++++++--
22 sys-apps/kexec-tools/kexec-tools-9999.ebuild | 28 +++++++++++++++++++----
23 2 files changed, 46 insertions(+), 6 deletions(-)
24
25 diff --git a/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild b/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild
26 index 85f71ffaf47..3cfa2914c93 100644
27 --- a/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild
28 +++ b/sys-apps/kexec-tools/kexec-tools-2.0.20-r1.ebuild
29 @@ -3,7 +3,7 @@
30
31 EAPI=7
32
33 -inherit flag-o-matic libtool linux-info systemd
34 +inherit libtool linux-info systemd
35
36 if [[ ${PV} == "9999" ]] ; then
37 inherit git-r3 autotools
38 @@ -46,12 +46,15 @@ pkg_setup() {
39
40 src_prepare() {
41 default
42 +
43 + # Append PURGATORY_EXTRA_CFLAGS flags set by configure, instead of overriding them completely.
44 + sed -e "/^PURGATORY_EXTRA_CFLAGS =/s/=/+=/" -i Makefile.in || die
45 +
46 if [[ "${PV}" == 9999 ]] ; then
47 eautoreconf
48 else
49 elibtoolize
50 fi
51 - filter-flags '-mindirect-branch=thunk*'
52 }
53
54 src_configure() {
55 @@ -64,6 +67,23 @@ src_configure() {
56 econf "${myeconfargs[@]}"
57 }
58
59 +src_compile() {
60 + # Respect CFLAGS for purgatory.
61 + # purgatory/Makefile uses PURGATORY_EXTRA_CFLAGS variable.
62 + # -mfunction-return=thunk and -mindirect-branch=thunk conflict with
63 + # -mcmodel=large which is added by build system.
64 + # Replace them with -mfunction-return=thunk-inline and -mindirect-branch=thunk-inline.
65 + local flag flags=()
66 + for flag in ${CFLAGS}; do
67 + [[ ${flag} == -mfunction-return=thunk ]] && flag="-mfunction-return=thunk-inline"
68 + [[ ${flag} == -mindirect-branch=thunk ]] && flag="-mindirect-branch=thunk-inline"
69 + flags+=("${flag}")
70 + done
71 + local -x PURGATORY_EXTRA_CFLAGS="${flags[*]}"
72 +
73 + default
74 +}
75 +
76 src_install() {
77 default
78
79
80 diff --git a/sys-apps/kexec-tools/kexec-tools-9999.ebuild b/sys-apps/kexec-tools/kexec-tools-9999.ebuild
81 index 99c3438156f..77c5d7c6e59 100644
82 --- a/sys-apps/kexec-tools/kexec-tools-9999.ebuild
83 +++ b/sys-apps/kexec-tools/kexec-tools-9999.ebuild
84 @@ -1,9 +1,9 @@
85 -# Copyright 1999-2019 Gentoo Authors
86 +# Copyright 1999-2020 Gentoo Authors
87 # Distributed under the terms of the GNU General Public License v2
88
89 EAPI=7
90
91 -inherit flag-o-matic libtool linux-info systemd
92 +inherit libtool linux-info systemd
93
94 if [[ ${PV} == "9999" ]] ; then
95 inherit git-r3 autotools
96 @@ -11,7 +11,7 @@ if [[ ${PV} == "9999" ]] ; then
97 else
98 SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kexec/${P/_/-}.tar.xz"
99 [[ "${PV}" == *_rc* ]] || \
100 - KEYWORDS="~amd64 ~arm64 ~hppa ~ppc64 ~x86"
101 + KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
102 fi
103
104 DESCRIPTION="Load another kernel from the currently executing Linux kernel"
105 @@ -44,12 +44,15 @@ pkg_setup() {
106
107 src_prepare() {
108 default
109 +
110 + # Append PURGATORY_EXTRA_CFLAGS flags set by configure, instead of overriding them completely.
111 + sed -e "/^PURGATORY_EXTRA_CFLAGS =/s/=/+=/" -i Makefile.in || die
112 +
113 if [[ "${PV}" == 9999 ]] ; then
114 eautoreconf
115 else
116 elibtoolize
117 fi
118 - filter-flags '-mindirect-branch=thunk*'
119 }
120
121 src_configure() {
122 @@ -62,6 +65,23 @@ src_configure() {
123 econf "${myeconfargs[@]}"
124 }
125
126 +src_compile() {
127 + # Respect CFLAGS for purgatory.
128 + # purgatory/Makefile uses PURGATORY_EXTRA_CFLAGS variable.
129 + # -mfunction-return=thunk and -mindirect-branch=thunk conflict with
130 + # -mcmodel=large which is added by build system.
131 + # Replace them with -mfunction-return=thunk-inline and -mindirect-branch=thunk-inline.
132 + local flag flags=()
133 + for flag in ${CFLAGS}; do
134 + [[ ${flag} == -mfunction-return=thunk ]] && flag="-mfunction-return=thunk-inline"
135 + [[ ${flag} == -mindirect-branch=thunk ]] && flag="-mindirect-branch=thunk-inline"
136 + flags+=("${flag}")
137 + done
138 + local -x PURGATORY_EXTRA_CFLAGS="${flags[*]}"
139 +
140 + default
141 +}
142 +
143 src_install() {
144 default