1 |
What do people think of something like this? Obviously the equivalent |
2 |
patch to prefix would need to include a test for |
3 |
PREFIX_DISABLE_GEN_USR_LDSCRIPT: |
4 |
|
5 |
Author: Gregory M. Turner <gmturner007@×××××××××.net> |
6 |
Date: Fri Apr 12 11:13:21 2013 -0700 |
7 |
|
8 |
eclass/toolchain-funcs: Add target-has-split-usr API |
9 |
|
10 |
Move the platform-filtering code from gen_usr_ldscript into its own |
11 |
API so that ebuilds can reliably test whether gen_usr_ldscript does |
12 |
something or not in the currently applicable environment. See |
13 |
in-source comments for more details. |
14 |
|
15 |
Signed-off-by: Gregory M. Turner <gmturner007@×××××××××.net> |
16 |
|
17 |
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass |
18 |
index 9b94512..7600aaf 100644 |
19 |
--- a/eclass/toolchain-funcs.eclass |
20 |
+++ b/eclass/toolchain-funcs.eclass |
21 |
@@ -604,6 +604,36 @@ gcc-specs-nostrict() { |
22 |
return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]) |
23 |
} |
24 |
|
25 |
+# @FUNCTION: target-has-split-usr |
26 |
+# @DESCRIPTION: |
27 |
+# This function returns 0 (true) if, for the currently |
28 |
+# targeted platform, portage is presuming that a "split-usr" |
29 |
+# configuration must be maintained. When target-has-split-usr |
30 |
+# returns a nonzero (false) value, gen_usr_ldscript is a noop. This |
31 |
+# may be handy in cases where an ebuild needs to decide, i.e., whether |
32 |
+# it makes sense to move certain files from /usr/bin to /bin |
33 |
+# in an ebuild. In the future, the assumption that "critical" |
34 |
+# stuff ends up in "/bin" and "/$(libdir)" whereas "noncritical" |
35 |
+# stuff ends up in "/usr/bin" and "/usr/$(libdir)" may be removed |
36 |
+# from portage entirely, or relegated to a legacy-support role. |
37 |
+# As of April 2013, discussion was ongoing in the Gentoo developer |
38 |
+# community as to what exactly to change and how (see bug #417451). |
39 |
+# By predicating ebuild code on target-has-split-usr, which exists solely |
40 |
+# to maintain a split-usr layout, ebuilds can future-proof themselves |
41 |
+# against changes to the precise criteria that determine whether or not |
42 |
+# split-usr is in effect for a given target and configuration. |
43 |
+target-has-split-usr() { |
44 |
+ tc-is-static-only && return 1 |
45 |
+ |
46 |
+ case ${CTARGET:-${CHOST}} in |
47 |
+ *-darwin*) return 0;; |
48 |
+ *linux*|*-freebsd*|*-openbsd*|*-netbsd*) |
49 |
+ use prefix && return 1 |
50 |
+ return 0 |
51 |
+ ;; |
52 |
+ *) return 1 ;; |
53 |
+ esac |
54 |
+} |
55 |
|
56 |
# @FUNCTION: gen_usr_ldscript |
57 |
# @USAGE: [-a] <list of libs to create linker scripts for> |
58 |
@@ -620,19 +650,10 @@ gcc-specs-nostrict() { |
59 |
# the library (libfoo.so), as ldconfig should usually update it |
60 |
# correctly to point to the latest version of the library present. |
61 |
gen_usr_ldscript() { |
62 |
+ target-has-split-usr || return 0 |
63 |
local lib libdir=$(get_libdir) output_format="" auto=false |
64 |
suffix=$(get_libname) |
65 |
[[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/ |
66 |
|
67 |
- tc-is-static-only && return |
68 |
- |
69 |
- # Eventually we'd like to get rid of this func completely #417451 |
70 |
- case ${CTARGET:-${CHOST}} in |
71 |
- *-darwin*) ;; |
72 |
- *linux*|*-freebsd*|*-openbsd*|*-netbsd*) |
73 |
- use prefix && return 0 ;; |
74 |
- *) return 0 ;; |
75 |
- esac |
76 |
- |
77 |
# Just make sure it exists |
78 |
dodir /usr/${libdir} |
79 |
|
80 |
|
81 |
-- |
82 |
gmt |