What do people think of something like this? Obviously the equivalent patch to prefix would need to include a test for PREFIX_DISABLE_GEN_USR_LDSCRIPT:

Author: Gregory M. Turner <gmturner...@ameritech.net>
Date:   Fri Apr 12 11:13:21 2013 -0700

    eclass/toolchain-funcs: Add target-has-split-usr API

    Move the platform-filtering code from gen_usr_ldscript into its own
    API so that ebuilds can reliably test whether gen_usr_ldscript does
    something or not in the currently applicable environment.  See
    in-source comments for more details.

    Signed-off-by: Gregory M. Turner <gmturner...@ameritech.net>

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 9b94512..7600aaf 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -604,6 +604,36 @@ gcc-specs-nostrict() {
     return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]])
 }

+# @FUNCTION: target-has-split-usr
+# @DESCRIPTION:
+# This function returns 0 (true) if, for the currently
+# targeted platform, portage is presuming that a "split-usr"
+# configuration must be maintained.  When target-has-split-usr
+# returns a nonzero (false) value, gen_usr_ldscript is a noop. This
+# may be handy in cases where an ebuild needs to decide, i.e., whether
+# it makes sense to move certain files from /usr/bin to /bin
+# in an ebuild.  In the future, the assumption that "critical"
+# stuff ends up in "/bin" and "/$(libdir)" whereas "noncritical"
+# stuff ends up in "/usr/bin" and "/usr/$(libdir)" may be removed
+# from portage entirely, or relegated to a legacy-support role.
+# As of April 2013, discussion was ongoing in the Gentoo developer
+# community as to what exactly to change and how (see bug #417451).
+# By predicating ebuild code on target-has-split-usr, which exists solely
+# to maintain a split-usr layout, ebuilds can future-proof themselves
+# against changes to the precise criteria that determine whether or not
+# split-usr is in effect for a given target and configuration.
+target-has-split-usr() {
+    tc-is-static-only && return 1
+
+    case ${CTARGET:-${CHOST}} in
+    *-darwin*) return 0;;
+    *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
+        use prefix && return 1
+        return 0
+        ;;
+    *) return 1 ;;
+    esac
+}

 # @FUNCTION: gen_usr_ldscript
 # @USAGE: [-a] <list of libs to create linker scripts for>
@@ -620,19 +650,10 @@ gcc-specs-nostrict() {
 # the library (libfoo.so), as ldconfig should usually update it
 # correctly to point to the latest version of the library present.
 gen_usr_ldscript() {
+    target-has-split-usr || return 0
local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname)
     [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/

-    tc-is-static-only && return
-
-    # Eventually we'd like to get rid of this func completely #417451
-    case ${CTARGET:-${CHOST}} in
-    *-darwin*) ;;
-    *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
-        use prefix && return 0 ;;
-    *) return 0 ;;
-    esac
-
     # Just make sure it exists
     dodir /usr/${libdir}


--
gmt

Reply via email to