1 |
commit: b023986de7d466d361798bae98f45f8ba7a42e8a |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 7 10:40:14 2018 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 7 10:42:41 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b023986d |
7 |
|
8 |
sys-devel/binutils: fix ldscrips ${CTARGET} search path, bug #147155 |
9 |
|
10 |
This change fixes long-standing search path issue in Gentoo's binutils: |
11 |
|
12 |
Before the change search path was the following: |
13 |
/usr/${CTARGET}/lib/ldscripts |
14 |
Note: it points to $SYSROOT, not to native cross-tools. |
15 |
|
16 |
After the change search path is the following: |
17 |
/usr/${CHOST}/${CTARGET}/lib/ldscripts |
18 |
|
19 |
Added two notes to the ebuild on how things are supposed to work: |
20 |
- Note [slotting support] |
21 |
- Note [tooldir hack for ldscripts] |
22 |
|
23 |
Applied change to 2.30-r1 and live ebuilds. |
24 |
|
25 |
Reported-by: Heiko Rosemann |
26 |
Closes: https://bugs.gentoo.org/147155 |
27 |
Package-Manager: Portage-2.3.28, Repoman-2.3.9 |
28 |
|
29 |
...inutils-9999.ebuild => binutils-2.30-r1.ebuild} | 41 +++++++++++++++++++--- |
30 |
sys-devel/binutils/binutils-9999.ebuild | 36 +++++++++++++++++-- |
31 |
2 files changed, 70 insertions(+), 7 deletions(-) |
32 |
|
33 |
diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-2.30-r1.ebuild |
34 |
similarity index 85% |
35 |
copy from sys-devel/binutils/binutils-9999.ebuild |
36 |
copy to sys-devel/binutils/binutils-2.30-r1.ebuild |
37 |
index f0c8730c819..145bbe7e290 100644 |
38 |
--- a/sys-devel/binutils/binutils-9999.ebuild |
39 |
+++ b/sys-devel/binutils/binutils-2.30-r1.ebuild |
40 |
@@ -19,6 +19,8 @@ IUSE="+cxx doc multitarget +nls static-libs test" |
41 |
# for the patchsets |
42 |
# Default: dilfridge :) |
43 |
|
44 |
+PATCH_VER=1 |
45 |
+ |
46 |
case ${PV} in |
47 |
9999) |
48 |
BVER="git" |
49 |
@@ -29,10 +31,11 @@ case ${PV} in |
50 |
;; |
51 |
*) |
52 |
BVER=${PV} |
53 |
- SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.xz" |
54 |
+ SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${BVER}.tar.xz" |
55 |
;; |
56 |
esac |
57 |
SLOT="${BVER}" |
58 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" |
59 |
|
60 |
# |
61 |
# The Gentoo patchset |
62 |
@@ -146,10 +149,11 @@ src_configure() { |
63 |
INCPATH=${LIBPATH}/include |
64 |
DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER} |
65 |
if is_cross ; then |
66 |
- BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER} |
67 |
+ TOOLPATH=/usr/${CHOST}/${CTARGET} |
68 |
else |
69 |
- BINPATH=/usr/${CTARGET}/binutils-bin/${BVER} |
70 |
+ TOOLPATH=/usr/${CTARGET} |
71 |
fi |
72 |
+ BINPATH=${TOOLPATH}/binutils-bin/${BVER} |
73 |
|
74 |
# Make sure we filter $LINGUAS so that only ones that |
75 |
# actually work make it through #42033 |
76 |
@@ -251,7 +255,8 @@ src_configure() { |
77 |
|
78 |
src_compile() { |
79 |
cd "${MY_BUILDDIR}" |
80 |
- emake all |
81 |
+ # see Note [tooldir hack for ldscripts] |
82 |
+ emake tooldir="${EPREFIX}${TOOLPATH}" all |
83 |
|
84 |
# only build info pages if the user wants them |
85 |
if use doc ; then |
86 |
@@ -272,6 +277,7 @@ src_install() { |
87 |
local x d |
88 |
|
89 |
cd "${MY_BUILDDIR}" |
90 |
+ # see Note [tooldir hack for ldscripts] |
91 |
emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install |
92 |
rm -rf "${ED}"/${LIBPATH}/bin |
93 |
use static-libs || find "${ED}" -name '*.la' -delete |
94 |
@@ -380,3 +386,30 @@ pkg_postrm() { |
95 |
binutils-config ${CTARGET}-${BVER} |
96 |
fi |
97 |
} |
98 |
+ |
99 |
+# Note [slotting support] |
100 |
+# ----------------------- |
101 |
+# Gentoo's layout for binutils files is non-standard as Gentoo |
102 |
+# supports slotted installation for binutils. But many tools |
103 |
+# still expect binutils to reside in known locations. |
104 |
+# binutils-config package restores symlinks into known locations, |
105 |
+# like: |
106 |
+# /usr/bin/${CTARGET}-<tool> |
107 |
+# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips |
108 |
+# /usr/include/ |
109 |
+# |
110 |
+# Note [tooldir hack for ldscripts] |
111 |
+# --------------------------------- |
112 |
+# Build system does not ./configure to tweak evey location we need |
113 |
+# for slotting binutils. This note is about SCRIPTDIR define. |
114 |
+# |
115 |
+# SCRIPDIR defines 'ldscripts/' directory location. SCRIPDIR value |
116 |
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' |
117 |
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. |
118 |
+# Thus we can't just move files around after compilation finished. |
119 |
+# |
120 |
+# Our goal is the following: |
121 |
+# - at build-time set scriptdir to point to symlinked location: |
122 |
+# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) |
123 |
+# - at install-time set scriptdir to point to slotted location: |
124 |
+# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${BVER} |
125 |
|
126 |
diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild |
127 |
index f0c8730c819..1c3f3623a94 100644 |
128 |
--- a/sys-devel/binutils/binutils-9999.ebuild |
129 |
+++ b/sys-devel/binutils/binutils-9999.ebuild |
130 |
@@ -146,10 +146,11 @@ src_configure() { |
131 |
INCPATH=${LIBPATH}/include |
132 |
DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER} |
133 |
if is_cross ; then |
134 |
- BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER} |
135 |
+ TOOLPATH=/usr/${CHOST}/${CTARGET} |
136 |
else |
137 |
- BINPATH=/usr/${CTARGET}/binutils-bin/${BVER} |
138 |
+ TOOLPATH=/usr/${CTARGET} |
139 |
fi |
140 |
+ BINPATH=${TOOLPATH}/binutils-bin/${BVER} |
141 |
|
142 |
# Make sure we filter $LINGUAS so that only ones that |
143 |
# actually work make it through #42033 |
144 |
@@ -251,7 +252,8 @@ src_configure() { |
145 |
|
146 |
src_compile() { |
147 |
cd "${MY_BUILDDIR}" |
148 |
- emake all |
149 |
+ # see Note [tooldir hack for ldscripts] |
150 |
+ emake tooldir="${EPREFIX}${TOOLPATH}" all |
151 |
|
152 |
# only build info pages if the user wants them |
153 |
if use doc ; then |
154 |
@@ -272,6 +274,7 @@ src_install() { |
155 |
local x d |
156 |
|
157 |
cd "${MY_BUILDDIR}" |
158 |
+ # see Note [tooldir hack for ldscripts] |
159 |
emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install |
160 |
rm -rf "${ED}"/${LIBPATH}/bin |
161 |
use static-libs || find "${ED}" -name '*.la' -delete |
162 |
@@ -380,3 +383,30 @@ pkg_postrm() { |
163 |
binutils-config ${CTARGET}-${BVER} |
164 |
fi |
165 |
} |
166 |
+ |
167 |
+# Note [slotting support] |
168 |
+# ----------------------- |
169 |
+# Gentoo's layout for binutils files is non-standard as Gentoo |
170 |
+# supports slotted installation for binutils. But many tools |
171 |
+# still expect binutils to reside in known locations. |
172 |
+# binutils-config package restores symlinks into known locations, |
173 |
+# like: |
174 |
+# /usr/bin/${CTARGET}-<tool> |
175 |
+# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips |
176 |
+# /usr/include/ |
177 |
+# |
178 |
+# Note [tooldir hack for ldscripts] |
179 |
+# --------------------------------- |
180 |
+# Build system does not ./configure to tweak evey location we need |
181 |
+# for slotting binutils. This note is about SCRIPTDIR define. |
182 |
+# |
183 |
+# SCRIPDIR defines 'ldscripts/' directory location. SCRIPDIR value |
184 |
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' |
185 |
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. |
186 |
+# Thus we can't just move files around after compilation finished. |
187 |
+# |
188 |
+# Our goal is the following: |
189 |
+# - at build-time set scriptdir to point to symlinked location: |
190 |
+# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) |
191 |
+# - at install-time set scriptdir to point to slotted location: |
192 |
+# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${BVER} |