X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=compilation;h=ecc3dac9b13c53e6efd2e363d84d728ad9b299bc;hb=cbb103bb80111cf7388d4f1a7b103b51e76f1bc0;hp=1dc51dee4bfddf6ea1ee3caf3009808a00130095;hpb=f798b14aba7f6c0b9a30c7d169fe6b997613ed1c;p=bash.d.git diff --git a/compilation b/compilation index 1dc51de..ecc3dac 100644 --- a/compilation +++ b/compilation @@ -1,24 +1,36 @@ #!/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 + if [ -r "${profile}/make.defaults" ]; then + . "${profile}/make.defaults" + fi + 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. if [ -f /etc/portage/make.conf ]; then - . /etc/portage/make.conf + if [ -r /etc/portage/make.conf ]; then + . /etc/portage/make.conf + fi 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