commit:     02777ce8ede7aba3bc1839069d616d25dc6a1bba
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 12:28:25 2016 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat May 21 12:28:25 2016 +0000
URL:        https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=02777ce8

sys-devel/gcc-config: track.

 sys-devel/gcc-config/Manifest                      |   5 +
 ...8-dont_source_functions_sh_from_etc_initd.patch |  47 +++
 .../files/gcc-config-prefix-1.8-r221.patch         | 344 +++++++++++++++++++++
 sys-devel/gcc-config/gcc-config-1.8-r1.ebuild      |  55 ++++
 sys-devel/gcc-config/metadata.xml                  |   5 +
 5 files changed, 456 insertions(+)

diff --git a/sys-devel/gcc-config/Manifest b/sys-devel/gcc-config/Manifest
new file mode 100644
index 0000000..3bdeecc
--- /dev/null
+++ b/sys-devel/gcc-config/Manifest
@@ -0,0 +1,5 @@
+AUX gcc-config-1.8-copy-gcc-libs.patch 6211 SHA256 
410f83cefffdc790566923efad24a16e53bc9079e0ae42f30b6ddbb9864af094 SHA512 
ff84a9bb35568af2c9c95d7c793baa68af34de33927c3890e30090b5eaa6db08c6b8f62ef0d96e538863c49eadac707ea8a7bad63074931a0911b501f96e3764
 WHIRLPOOL 
4f8107dbff21b9b3ade765885ad34dbdccc76486b765c99125daf069034547a8a24bff995c4358a3a5ea7220bd2b370de62acbd8ae4f7b5e34cdfecc1998723e
+AUX gcc-config-prefix-1.8-r221.patch 12847 SHA256 
b9c7df3b58bc7bdc0d4b154e92583d9fd3c07c6ecd9778eda7f06630a7077620 SHA512 
741d7edce78a57d8bec10b6612cc543b85aaf449c3144f1e4140354d73c71466635a0d182c829731154e6d6f8241e526c0269faf6eb0d61a650884744f0dc546
 WHIRLPOOL 
a930bba9345705d3115c6ff952e899e98acea323044152e6db7d4cf73a8e62914489b556d1fc7501dce805edd78530ff61a24a356a8fddf0bbcc78d1087dc11d
+DIST gcc-config-1.8.tar.xz 15020 SHA256 
2453e2a07521b12267ca62b9b860eb2d2bc606cad0f29bf42a1c9543673f5a1b SHA512 
3b84af2d961a0527834759e047330dbab7bac0ff3d6aae103f14fca2d44bd612bd4a1005649e8b4198036231ed8a8319fb13326b4d2c40474826cf53f7bc0826
 WHIRLPOOL 
4899bc1da43a158cc486022f68661e5318db7e4e83afdb5d892fc7ce5098a4bdb059dbab3c50e632901e577cd8760b2386da3ee24f5e944db12d3e246d9c26b6
+EBUILD gcc-config-1.8-r1.ebuild 1725 SHA256 
94a29af95061080c0bd02003c4511dd094ff21f761f29677cc6526995dad841a SHA512 
e671d08aa440f1235e20fd26f5fa55cd1edacf154fea9524637cce240b12be5b02d52e9561ed7d262df4a64af42a2c587bb0fb0136afed857a66eafd6fcb5cab
 WHIRLPOOL 
a37da6cc81e933748b107954e60e8aa0c375755e2f3cdaf256986580d82a1278110e3dd3c09a4fcc212219878ad30e5677f01ea1a072116f9b7273525db94da9
+MISC metadata.xml 162 SHA256 
65a915d44de1f01d4b7f72d313b4192c38374a9835d24988c00c1e73dca5805a SHA512 
2a857e10b277827773a6c7967e070d7bfff23d75f44fa4d4fa8a7339df3225e6dba512a865d91c9c55bdb013dafdce85dface1b845acfbb5473e232666cdda45
 WHIRLPOOL 
f7586c1570803b3e646f0be89ba6c767e82ec6889ef92d15f62a38f1410ed9d82c36892e5e83f694471959783d0d5ad667f1a39b7eb51f2080c269d5fa23d819

diff --git 
a/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch
 
b/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch
new file mode 100644
index 0000000..a4b7de2
--- /dev/null
+++ 
b/sys-devel/gcc-config/files/gcc-config-1.8-dont_source_functions_sh_from_etc_initd.patch
@@ -0,0 +1,47 @@
+--- gcc-config-1.8/gcc-config
++++ gcc-config-1.8/gcc-config
+@@ -15,8 +15,9 @@
+ trap ":" INT QUIT TSTP
+ 
+ argv0=${0##*/}
+-source /etc/init.d/functions.sh || {
+-      echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
++functions_script="/lib/gentoo/functions.sh"
++source ${functions_script} || {
++      echo "${argv0}: Could not source ${functions_script}!" 1>&2
+       exit 1
+ }
+ esyslog() { :; }
+
+From d45de09450ffb63b138bbb7f78cae43e1101e2ec Mon Sep 17 00:00:00 2001
+From: Ryan Hill <rh...@gentoo.org>
+Date: Tue, 12 May 2015 22:09:28 -0600
+Subject: [PATCH] Ignore whitespace when diffing test results.
+
+The amount of whitespace output by ebegin/eend from gentoo-functions
+is dynamic (seems to be dependent on terminal width).  Since we can't
+predict this we have to ignore all whitespace differences.
+
+URL: https://bugs.gentoo.org/547586
+Reported-by: tka <t...@kamph.org>
+Signed-off-by: Ryan Hill <rh...@gentoo.org>
+---
+ tests/run_tests | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/run_tests b/tests/run_tests
+index 2ff7d77..397d667 100755
+--- a/tests/run_tests
++++ b/tests/run_tests
+@@ -44,7 +44,7 @@ cmp_log() {
+       args+=( -e "s|: line [0-9]*: |: |g" )
+       sed "${args[@]}" "${exp}" > "${exp}.tmp"
+       sed "${args[@]}" "${log}" > "${log}.tmp"
+-      diff -u "${exp}.tmp" "${log}.tmp" > "${log}.diff"
++      diff -uw "${exp}.tmp" "${log}.tmp" > "${log}.diff"
+       ret=$?
+       rm "${exp}.tmp"
+       return ${ret}
+-- 
+2.4.4
+

diff --git a/sys-devel/gcc-config/files/gcc-config-prefix-1.8-r221.patch 
b/sys-devel/gcc-config/files/gcc-config-prefix-1.8-r221.patch
new file mode 100644
index 0000000..cef1338
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-prefix-1.8-r221.patch
@@ -0,0 +1,344 @@
+diff --git a/a/Makefile b/b/Makefile
+--- a/a/Makefile
++++ b/b/Makefile
+@@ -5,7 +5,8 @@ PN = gcc-config
+ PV = git
+ P = $(PN)-$(PV)
+ 
+-PREFIX = /usr
++EPREFIX =
++PREFIX = $(EPREFIX)/usr
+ BINDIR = $(PREFIX)/bin
+ SUBLIBDIR = lib
+ LIBDIR = $(PREFIX)/$(SUBLIBDIR)
+@@ -16,6 +17,11 @@ INSTALL_EXE = install -m 755
+ 
+ all: wrapper
+ 
++wrapper.c: wrapper.c.in
++      sed \
++              -e 's:@GENTOO_PORTAGE_EPREFIX@:$(EPREFIX):g' \
++              wrapper.c.in > wrapper.c
++
+ clean:
+       rm -f wrapper *.o core
+ 
+@@ -23,6 +29,7 @@ install: all
+       $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
+       $(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
+       sed \
++              -e 's:@GENTOO_PORTAGE_EPREFIX@:$(EPREFIX):g' \
+               -e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
+               -e 's:@PV@:$(PV):g' \
+               gcc-config > $(DESTDIR)$(BINDIR)/gcc-config
+diff --git a/a/gcc-config b/b/gcc-config
+index 18d0b48..935b4c8 100755
+--- a/a/gcc-config
++++ b/b/gcc-config
+@@ -9,14 +9,17 @@
+ : ${ROOT:=/}
+ [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+ [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
++BPREFIX="@GENTOO_PORTAGE_EPREFIX@"
++: ${EPREFIX:=${BPREFIX}}
++EROOT="${ROOT%/}${EPREFIX}/"
+ 
+ cd /
+ 
+ trap ":" INT QUIT TSTP
+ 
+ argv0=${0##*/}
+-source /etc/init.d/functions.sh || {
+-      echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
++source "${BPREFIX}"/etc/init.d/functions.sh || {
++      echo "${argv0}: Could not source ${BPREFIX}/etc/init.d/functions.sh!" 
1>&2
+       exit 1
+ }
+ esyslog() { :; }
+@@ -84,16 +87,16 @@ try_real_hard_to_find_CHOST() {
+       #
+ 
+       local varname=${1:-CHOST}
+-      local conf=${ROOT}/etc/portage/make.conf
+-      if [[ ! -e ${conf} && -e ${ROOT}/etc/make.conf ]] ; then
+-              conf=${ROOT}/etc/make.conf
++      local conf=${EROOT}/etc/portage/make.conf
++      if [[ ! -e ${conf} && -e ${EROOT}/etc/make.conf ]] ; then
++              conf=${EROOT}/etc/make.conf
+       fi
+       local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
+       if [[ -z ${ret} ]] ; then
+               # newer portage supports spaces between the var and =
+               # CHOST     =  "this-is-retarded"
+               ret=$(eval $(
+-                      sed -n \
++                      ${SED} -n \
+                               -e 's:[[:space:]]::g' \
+                               -e "/^${varname}=/p" \
+                               "${conf}"
+@@ -109,8 +112,8 @@ try_real_hard_to_find_CHOST() {
+       #
+       # Then we try /etc/env.d/gcc/config-${CTARGET}
+       #
+-      if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
+-              ret=$(split_gcc_ver $(show_var CURRENT 
"${ROOT}"/etc/env.d/gcc/config-${CTARGET}))
++      if [[ -s ${EROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
++              ret=$(split_gcc_ver $(show_var CURRENT 
"${EROOT}"/etc/env.d/gcc/config-${CTARGET}))
+               echo ${ret% *}
+       fi
+ }
+@@ -124,7 +127,7 @@ get_chost() {
+ 
+       # make sure portage isnt broken
+       if python -V &>/dev/null ; then
+-              CHOST=$(portageq envvar CHOST 2>/dev/null)
++              CHOST=$(env -i EPREFIX="${BPREFIX}" 
"$(PATH="${BPREFIX}/usr/bin:${PATH}" type -P portageq)" envvar CHOST 
2>/dev/null)
+       else
+               ewarn "Python seems to be broken, attempting to locate CHOST 
ourselves ..."
+               CHOST=$(try_real_hard_to_find_CHOST)
+@@ -133,7 +136,7 @@ get_chost() {
+       if [[ -z ${CHOST} ]] ; then
+               eerror "${argv0}: Could not get portage CHOST!"
+               eerror "${argv0}: You should verify that CHOST is set in one of 
these places:"
+-              eerror "${argv0}:  - ${ROOT}/etc/portage/make.conf"
++              eerror "${argv0}:  - ${EROOT}/etc/portage/make.conf"
+               eerror "${argv0}:  - active environment"
+               exit 1
+       fi
+@@ -196,7 +199,7 @@ update_wrappers() {
+       # Find the bin wrapper
+       local wrapper
+       for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
+-              wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
++              wrapper="${EROOT}usr/${wrapper}/misc/gcc-config"
+               [[ -e ${wrapper} ]] && break
+       done
+ 
+@@ -222,7 +225,7 @@ update_wrappers() {
+       # new one does not.
+       for x in "${old_wrappers[@]}" ; do
+               has "${x}" "${new_wrappers[@]}" && continue
+-              rm -f "${ROOT}usr/bin/${x}" "${ROOT}usr/bin/${CTARGET}-${x}"
++              rm -f "${EROOT}usr/bin/${x}" "${EROOT}usr/bin/${CTARGET}-${x}"
+       done
+ 
+       # For all toolchains, we want to create the fully qualified
+@@ -259,20 +262,19 @@ update_wrappers() {
+ 
+               # Now do the actual wrapper copy with paths to the reference 
binary
+               if [[ -x ${ref} ]] ; then
+-                      atomic_cp "${wrapper}" "${ROOT}usr/bin" "${x}" "${ref}"
++                      atomic_cp "${wrapper}" "${EROOT}usr/bin" "${x}" "${ref}"
+               else
+                       ewarn "double insanity with ${x} and ${ref}"
+                       # Make sure we have no stale wrappers
+-                      rm -f "${ROOT}usr/bin/${x}"
++                      rm -f "${EROOT}usr/bin/${x}"
+               fi
+       done
+       # legacy cruft, make sure we dont leave it laying around #143205
+-      rm -f "${ROOT}usr/bin/${CTARGET}-cc" 
"${ROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
++      rm -f "${EROOT}usr/bin/${CTARGET}-cc" 
"${EROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
+ 
+       # install the canonical cpp wrapper
+-      [[ ${CTARGET} == *-solaris* ]] && return 0
+       if ! is_cross_compiler ; then
+-              atomic_cp "${wrapper}" "${ROOT}lib" "cpp" "${ROOT}usr/bin/cpp"
++              atomic_cp "${wrapper}" "${EROOT}lib" "cpp" "${EROOT}usr/bin/cpp"
+       fi
+ }
+ 
+@@ -301,33 +303,45 @@ handle_split_usr() {
+       eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
+       LDPATH=${LDPATH%%:*}
+ 
+-      # If /usr isn't a sep mount, then don't bother with linking stuff.
+-      if ln "${ROOT}/${LDPATH}/libgcc.a" "${ROOT}"/lib/.gcc.config.$$ 
2>/dev/null ; then
+-              rm -f "${ROOT}"/lib/.gcc.config.$$
+-              if [[ -n $(find "${ROOT}"/lib*/lib{gcc_s,unwind}.so* 
2>/dev/null) ]] ; then
++      # If /usr isn't a sep mount or EPREFIX is set, then don't bother with 
linking stuff.
++      if [[ -n ${EPREFIX} ]] || ln "${ROOT}/${LDPATH}/libgcc.a" 
"${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
++              rm -f "${EROOT}"/lib/.gcc.config.$$
++              if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib} 
2>/dev/null) ]] ; then
+                       # If we previously had stuff in /, make sure ldconfig 
gets re-run.
+-                      rm -f "${ROOT}"/lib*/lib{gcc_s,unwind}.so*
++                      rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib}
+                       return 1
+               fi
+               return 0
+       fi
+ 
+-      # Only bother with this stuff for the native ABI.  We assume the user
+-      # doesn't have critical binaries for non-native ABIs which is fair.
+-      local gcclib
+-      local libdir="${ROOT}${GENTOO_LIBDIR}"
+-      mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
+-      for gcclib in gcc_s unwind ; do
+-              # This assumes that we always have the .so symlink,
+-              # but for now, that should be safe ...
+-              for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
+-                      [[ -e ${gcclib} ]] || continue
+-                      cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
+-                      # no need to sanity `rm` this as the `mv` should take 
care
+-                      # of it.  we also need this step to be completely atomic
+-                      # for systems that have even `mv` linked against 
libgcc_s.so.
+-                      # http://bugs.gentoo.org/150257
+-                      mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
++      gcc="${ROOT}${LATEST_GCC_PATH}/gcc"
++
++      local multilib
++      for multilib in $("${gcc}" -print-multi-lib); do
++              local multiarg=${multilib#*;}
++              multiarg=${multiarg/@/-}
++              local multilibdir=${multilib%;*}
++              local libdir="${EROOT}lib/"$("${gcc}" ${multiarg} 
-print-multi-os-directory)
++
++              mkdir -p "${libdir}"/.gcc.config.new || continue # !?!?!
++
++              # Only bother with this stuff for the native ABI.  We assume 
the user
++              # doesn't have critical binaries for non-native ABIs which is 
fair.
++              local gcclib
++              local libdir="${ROOT}${GENTOO_LIBDIR}"
++              mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
++              for gcclib in gcc_s unwind ; do
++                      # This assumes that we always have the .so symlink,
++                      # but for now, that should be safe ...
++                      for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
++                              [[ -e ${gcclib} ]] || continue
++                              cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
++                              # no need to sanity `rm` this as the `mv` 
should take care
++                              # of it.  we also need this step to be 
completely atomic
++                              # for systems that have even `mv` linked 
against libgcc_s.so.
++                              # http://bugs.gentoo.org/150257
++                              mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
++                      done
+               done
+       done
+       rmdir "${libdir}"/.gcc.config.new
+@@ -341,7 +355,7 @@ switch_profile() {
+ 
+       # Make sure we have write access to the dirs.  Do not require `root`
+       # so that we work with prefix/cross/etc... setups that run as user.
+-      [[ ! -w ${ROOT} ]] && die "need write access to ${ROOT}"
++      [[ ! -w ${EROOT} ]] && die "need write access to ${EROOT}"
+ 
+       if is_cross_compiler ; then
+               ebegin "Switching cross-compiler to ${CC_COMP}"
+@@ -408,7 +422,7 @@ switch_profile() {
+               # Pass all by default
+               awk 
'!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH|MULTIOSDIRS)=/
 {print $0}' \
+                       "${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
+-              if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
++              if [[ -z ${EPREFIX} && -d ${ROOT}/etc/ld.so.conf.d ]] ; then
+                       echo "${MY_LDPATH}" > 
"${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
+               else
+                       echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
+@@ -427,7 +441,7 @@ switch_profile() {
+               local x libdir pkgconfdir
+               local mver=${CC_COMP_VERSION:0:3}
+               for libdir in ${MULTIOSDIRS//:/ } ; do
+-                      pkgconfdir="${ROOT}/usr/lib/${libdir}/pkgconfig"
++                      pkgconfdir="${EROOT}/usr/lib/${libdir}/pkgconfig"
+                       for x in "" "-${mver}" ; do
+                               x="${pkgconfdir}/libgcj${x}.pc"
+                               if [[ -e 
${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+@@ -458,7 +472,7 @@ switch_profile() {
+                       ewarn "env-update failed to work properly; making sure 
ld.so.conf paths"
+                       ewarn "are setup properly.  Please rerun gcc-config 
with the -f option."
+                       echo ""
+-                      if [[ ! -d /etc/ld.so.conf.d ]] ; then
++                      if [[ -z ${EPREFIX} && ! -d /etc/ld.so.conf.d ]] ; then
+                               show_var LDPATH 
"${ROOT}"/etc/env.d/05gcc-${CTARGET} \
+                                       | sed -e 's|:|\n|g' >> /etc/ld.so.conf
+                       fi
+@@ -475,7 +489,9 @@ switch_profile() {
+               ewarn "If you intend to use the gcc from the new profile in an 
already"
+               ewarn "running shell, please remember to do:"
+               echo
+-              ewarn "  . /etc/profile"
++              ewarn " (bash) # . ${EPREFIX}/etc/profile"
++              ewarn "or"
++              ewarn " (tcsh) # source ${EPREFIX}/etc/csh.login"
+               echo
+       fi
+ 
+@@ -653,7 +669,7 @@ DOIT=""
+ FORCE="no"
+ 
+ CC_COMP=
+-ENV_D="${ROOT}etc/env.d"
++ENV_D="${EROOT}etc/env.d"
+ GCC_ENV_D="${ENV_D}/gcc"
+ 
+ for x in "$@" ; do
+@@ -784,7 +800,11 @@ if [[ -z ${CC_COMP} ]] ; then
+ fi
+ 
+ if [[ ${DOIT} != "get_current_profile" ]] ; then
+-      GCC_LIB=$(get_lib_path | awk -F/ '{ print  "/"$2"/"$3"/"$4"/" }')
++      GCC_LIB=$(
++              get_lib_path | \
++                      sed -e "s|${EPREFIX}/*|/|g" | \
++                      awk -F/ '{ print "/"$2"/"$3"/"$4"/" }'
++      )
+ 
+       # For people who insist on using funky version strings ("4.6.x"
+       # rather than "4.6.2"), allow them to manually specify it.
+@@ -797,11 +817,11 @@ if [[ ${DOIT} != "get_current_profile" ]] ; then
+               CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
+       fi
+ 
+-      if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; 
then
++      if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; 
then
+               CC_COMP_VERSION=${CC_COMP_VERSION%-*}
+       fi
+ 
+-      if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] 
|| \
++      if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] 
|| \
+          [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
+       then
+               eerror "${argv0}: Profile does not exist or invalid setting for 
${GCC_ENV_D}/${CC_COMP}" 1>&2
+diff --git a/a/wrapper.c.in b/b/wrapper.c.in
+index 65e5317..afa03bc 100644
+--- a/a/wrapper.c.in
++++ b/b/wrapper.c.in
+@@ -21,8 +21,8 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ 
+-#define GCC_CONFIG "/usr/bin/gcc-config"
+-#define ENVD_BASE  "/etc/env.d/05gcc"
++#define GCC_CONFIG "@GENTOO_PORTAGE_EPREFIX@/usr/bin/gcc-config"
++#define ENVD_BASE  "@GENTOO_PORTAGE_EPREFIX@/etc/env.d/05gcc"
+ 
+ #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+ 
+@@ -146,7 +146,7 @@ static int find_target_in_envd(struct wrapper_data *data, 
int cross_compile)
+               /* for the sake of speed, we'll keep a symlink around for
+                * the native compiler.  #190260
+                */
+-              snprintf(envd_file, sizeof(envd_file)-1, 
"/etc/env.d/gcc/.NATIVE");
++              snprintf(envd_file, sizeof(envd_file)-1, 
"@GENTOO_PORTAGE_EPREFIX@/etc/env.d/gcc/.NATIVE");
+       } else {
+               char *ctarget, *end = strrchr(data->name, '-');
+               if (end == NULL)
+@@ -213,7 +213,7 @@ static void find_wrapper_target(struct wrapper_data *data)
+       /* Only our wrapper is in PATH, so get the CC path using
+        * gcc-config and execute the real binary in there ...
+        */
+-      FILE *inpipe = popen("ROOT= " GCC_CONFIG " --get-bin-path", "r");
++      FILE *inpipe = popen("ROOT= EPREFIX=\"@GENTOO_PORTAGE_EPREFIX@\" " 
GCC_CONFIG " --get-bin-path", "r");
+       if (inpipe == NULL)
+               wrapper_errp("could not open pipe");
+ 
+@@ -289,8 +289,8 @@ int main(int argc, char *argv[])
+                       data.name = wrapper_aliases[i].target;
+ 
+       /* What is the full name of our wrapper? */
+-      data.fullname = xmalloc(strlen(data.name) + sizeof("/usr/bin/") + 1);
+-      sprintf(data.fullname, "/usr/bin/%s", data.name);
++      data.fullname = xmalloc(strlen(data.name) + 
sizeof("@GENTOO_PORTAGE_EPREFIX@/usr/bin/") + 1);
++      sprintf(data.fullname, "@GENTOO_PORTAGE_EPREFIX@/usr/bin/%s", 
data.name);
+ 
+       find_wrapper_target(&data);
+ 

diff --git a/sys-devel/gcc-config/gcc-config-1.8-r1.ebuild 
b/sys-devel/gcc-config/gcc-config-1.8-r1.ebuild
new file mode 100644
index 0000000..7416e6a
--- /dev/null
+++ b/sys-devel/gcc-config/gcc-config-1.8-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils unpacker toolchain-funcs multilib
+
+DESCRIPTION="utility to manage compilers"
+HOMEPAGE="https://gitweb.gentoo.org/proj/gcc-config.git/";
+SRC_URI="mirror://gentoo/${P}.tar.xz
+       https://dev.gentoo.org/~vapier/dist/${P}.tar.xz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND=">=sys-apps/gentoo-functions-0.10"
+
+src_prepare() {
+       epatch 
"${FILESDIR}/${PN}-1.8-dont_source_functions_sh_from_etc_initd.patch" # 504118
+}
+
+src_compile() {
+       emake CC="$(tc-getCC)"
+}
+
+src_install() {
+       emake \
+               DESTDIR="${D}" \
+               PV="${PV}" \
+               SUBLIBDIR="$(get_libdir)" \
+               install
+}
+
+pkg_postinst() {
+       # Scrub eselect-compiler remains
+       rm -f "${ROOT}"/etc/env.d/05compiler &
+
+       # Make sure old versions dont exist #79062
+       rm -f "${ROOT}"/usr/sbin/gcc-config &
+
+       # We not longer use the /usr/include/g++-v3 hacks, as
+       # it is not needed ...
+       rm -f "${ROOT}"/usr/include/g++{,-v3} &
+
+       # Do we have a valid multi ver setup ?
+       local x
+       for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 
}') ; do
+               gcc-config ${x}
+       done
+
+       wait
+}

diff --git a/sys-devel/gcc-config/metadata.xml 
b/sys-devel/gcc-config/metadata.xml
new file mode 100644
index 0000000..fb4199e
--- /dev/null
+++ b/sys-devel/gcc-config/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<herd>toolchain</herd>
+</pkgmetadata>

Reply via email to