]> gitweb.michael.orlitzky.com - bash.d.git/commitdiff
compilation: process make.defaults in parent profiles, too.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 21 Jan 2018 00:22:15 +0000 (19:22 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 21 Jan 2018 00:22:15 +0000 (19:22 -0500)
compilation

index 1dc51dee4bfddf6ea1ee3caf3009808a00130095..6320e7069b0338802e0928b295f40a992f3307b8 100644 (file)
@@ -1,9 +1,24 @@
 #!/bin/sh
 
-# Grab CFLAGS, etc. from the profile...
-if [ -f /etc/portage/make.profile/make.defaults ]; then
-    . /etc/portage/make.profile/make.defaults
-fi
+# Grab CFLAGS, etc. from our profile after first processing its parent
+# profiles recursively
+load_profile_defaults() {
+    local profile="${1}"
+    if [ -f "${profile}/parent" ]; then
+       for parent in $(cat "${profile}/parent"); do
+           local _parent_path="${profile}/${parent}"
+           load_profile_defaults "${_parent_path}"
+       done
+    fi
+
+    if [ -f "${profile}/make.defaults" ]; then
+       . "${profile}/make.defaults"
+       echo "loaded ${profile}/make.defaults"
+    fi
+}
+
+load_profile_defaults /etc/portage/make.profile
+
 
 # and from make.conf, allowing the values in make.conf to override the
 # ones in the profile.
@@ -15,10 +30,8 @@ fi
 # Not a portage variable, but it's real handy.
 REPOS="${DISTDIR}/../repositories"
 
-# These are really the only two that make sense to export to
+# These are really the only variables that make sense to export to
 # subsequent commands.
 export CFLAGS
 export CXXFLAGS
-
-# LDFLAGS comes from.. somewhere else.
-export LDFLAGS="-Wl,-O1 -Wl,--as-needed"
+export LDFLAGS