diff options
author | Jeremy Huddleston <eradicator@gentoo.org> | 2005-02-19 10:04:01 +0000 |
---|---|---|
committer | Jeremy Huddleston <eradicator@gentoo.org> | 2005-02-19 10:04:01 +0000 |
commit | e5a0a498c9247038579b937a674019359a6c81f3 (patch) | |
tree | eb240e31ddf07e8f31884d9dee0b04c60098dd86 /sys-devel/gcc-config | |
parent | Use kde-function.eclass. This closes bug #80978. (diff) | |
download | historical-e5a0a498c9247038579b937a674019359a6c81f3.tar.gz historical-e5a0a498c9247038579b937a674019359a6c81f3.tar.bz2 historical-e5a0a498c9247038579b937a674019359a6c81f3.zip |
1.3.10-r1 stable on amd64. Removing 1.3.9. Adding 1.4.0 which adds support for creating ctarget aliases based on the GCC_CTARGET_ALIASES variable in the /etc/env.d/gcc/ config file. This is setup automatically on multilib profiles with recent gcc emerges.
Package-Manager: portage-2.0.51.16
Diffstat (limited to 'sys-devel/gcc-config')
-rw-r--r-- | sys-devel/gcc-config/ChangeLog | 14 | ||||
-rw-r--r-- | sys-devel/gcc-config/Manifest | 19 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/digest-gcc-config-1.4.0 (renamed from sys-devel/gcc-config/files/digest-gcc-config-1.3.9) | 0 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/fake-ctarget.sh | 4 | ||||
-rwxr-xr-x | sys-devel/gcc-config/files/gcc-config-1.4.0 (renamed from sys-devel/gcc-config/files/gcc-config-1.3.9) | 120 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/wrapper-1.4.6.c (renamed from sys-devel/gcc-config/files/wrapper-1.4.4.c) | 144 | ||||
-rw-r--r-- | sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild | 4 | ||||
-rw-r--r-- | sys-devel/gcc-config/gcc-config-1.4.0.ebuild (renamed from sys-devel/gcc-config/gcc-config-1.3.9.ebuild) | 16 |
8 files changed, 215 insertions, 106 deletions
diff --git a/sys-devel/gcc-config/ChangeLog b/sys-devel/gcc-config/ChangeLog index 6bd262b2d373..e0a6976c0dd5 100644 --- a/sys-devel/gcc-config/ChangeLog +++ b/sys-devel/gcc-config/ChangeLog @@ -1,6 +1,18 @@ # ChangeLog for sys-devel/gcc-config # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.80 2005/02/01 18:18:01 eradicator Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.81 2005/02/19 10:04:01 eradicator Exp $ + +*gcc-config-1.4.0 (19 Feb 2005) + + 19 Feb 2005; Jeremy Huddleston <eradicator@gentoo.org> + +files/fake-ctarget.sh, -files/gcc-config-1.3.9, +files/gcc-config-1.4.0, + -files/wrapper-1.4.4.c, +files/wrapper-1.4.6.c, + gcc-config-1.3.10-r1.ebuild, -gcc-config-1.3.9.ebuild, + +gcc-config-1.4.0.ebuild: + 1.3.10-r1 stable on amd64. Removing 1.3.9. Adding 1.4.0 which adds support + for creating ctarget aliases based on the GCC_CTARGET_ALIASES variable in + the /etc/env.d/gcc/ config file. This is setup automatically on multilib + profiles with recent gcc emerges. 01 Feb 2005; Jeremy Huddleston <eradicator@gentoo.org> gcc-config-1.3.10-r1.ebuild: diff --git a/sys-devel/gcc-config/Manifest b/sys-devel/gcc-config/Manifest index 597ffeb8e5b3..cdee07523efb 100644 --- a/sys-devel/gcc-config/Manifest +++ b/sys-devel/gcc-config/Manifest @@ -2,23 +2,24 @@ Hash: SHA1 MD5 012868b502a874cc4f1abfa862bafb8a gcc-config-1.3.8-r4.ebuild 1429 -MD5 14131db9b618f3ccc2efbd915e0fbaf8 gcc-config-1.3.9.ebuild 1437 MD5 567094e03359ffc1c95af7356395228d metadata.xml 162 -MD5 304c7d030a5756550fde72f37f42cc19 ChangeLog 16085 -MD5 c81eeaddc9efbc1af2bc6706fecf4d1b gcc-config-1.3.10-r1.ebuild 1448 +MD5 dfc5ae419559377dff82dc06b1cdb677 ChangeLog 16651 +MD5 59fe9b0a4eab7247d332cf0ca73874c4 gcc-config-1.3.10-r1.ebuild 1451 +MD5 8f3acf59440d9f597b6dd8386af66ebb gcc-config-1.4.0.ebuild 1945 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.8-r4 0 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.9 0 MD5 396974306d3ccab6db5354d94ffd21fd files/gcc-config-1.3.8 12498 MD5 e7c7a83406a374ee4262c97d6e5673b2 files/wrapper-1.4.3.c 7545 -MD5 7723c767ef3e4935c2299fb253412d7e files/wrapper-1.4.4.c 10132 MD5 ee3f55895cd7d8bc97f6903961a5491b files/wrapper-1.4.5.c 10671 -MD5 0181c8024c1c636b700dbf7a11f07fd6 files/gcc-config-1.3.9 12641 MD5 3d37d08bd6d1d828ea19572c0c381032 files/gcc-config-1.3.10 13233 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.10-r1 0 +MD5 2b1da89f57a6e4a1ecc57fc79a51bb7f files/gcc-config-1.4.0 14617 +MD5 b896b5ba2fa0766e410adf13ecc8048e files/wrapper-1.4.6.c 10526 +MD5 d3cceaad0e9b9d7f544d792ba493909a files/fake-ctarget.sh 82 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.4.0 0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) -iD8DBQFCB8B6ArHZZzCEUG0RAi9xAJ4iaHio8ZMVXTOxE5fhJSk3XCgCKACcDWDu -J5M6MGaXyVfox5s3HU4kvPc= -=c3IS +iD8DBQFCFw8bArHZZzCEUG0RAv2MAJ9Vn4zuw34TwGYyevhxzGBg3ShKZQCdFWVw +97I9JT+U9DL2pchr3yb56d0= +=xDo3 -----END PGP SIGNATURE----- diff --git a/sys-devel/gcc-config/files/digest-gcc-config-1.3.9 b/sys-devel/gcc-config/files/digest-gcc-config-1.4.0 index e69de29bb2d1..e69de29bb2d1 100644 --- a/sys-devel/gcc-config/files/digest-gcc-config-1.3.9 +++ b/sys-devel/gcc-config/files/digest-gcc-config-1.4.0 diff --git a/sys-devel/gcc-config/files/fake-ctarget.sh b/sys-devel/gcc-config/files/fake-ctarget.sh new file mode 100644 index 000000000000..624156951540 --- /dev/null +++ b/sys-devel/gcc-config/files/fake-ctarget.sh @@ -0,0 +1,4 @@ +#!/bin/bash +export ABI="custom" +export CFLAGS_custom="@@CFLAGS@@" +@@EXEC@@ "${@}" diff --git a/sys-devel/gcc-config/files/gcc-config-1.3.9 b/sys-devel/gcc-config/files/gcc-config-1.4.0 index fb5d8063fb41..68028c452583 100755 --- a/sys-devel/gcc-config/files/gcc-config-1.3.9 +++ b/sys-devel/gcc-config/files/gcc-config-1.4.0 @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.9,v 1.4 2005/01/19 23:26:13 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.4.0,v 1.1 2005/02/19 10:04:01 eradicator Exp $ # Author: Martin Schlemmer <azarah@gentoo.org> trap ":" INT QUIT TSTP @@ -148,39 +148,42 @@ switch_profile() { OLD_CC_COMP=$(get_current_profile) CTARGET="${CTARGET:-${REAL_CHOST}}" + ENV_FILE="${ENV_D}/05gcc-${CTARGET}" + CONFIG_FILE="${GCC_ENV_D}/config-${CTARGET}" + # What kind of env.d entry are we going to generate ? if is_cross_compiler ; then # Only keep PATH/ROOTPATH ${AWK} '/^(PATH|ROOTPATH)=/ {print $0}' \ - "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc-${CTARGET}" + "${GCC_ENV_D}/${CC_COMP}" > "${ENV_FILE}" - echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}" + echo "CURRENT=${CC_COMP}" > "${CONFIG_FILE}" else # Pass all by default ${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS)=/ {print $0}' \ - "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc" - echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc" + "${GCC_ENV_D}/${CC_COMP}" > "${ENV_FILE}" + echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_FILE}" if [[ -n ${GCC_SPECS} ]] && [[ -e ${ROOT}/${GCC_SPECS} ]] ; then - echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc" + echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_FILE}" else # People need to rebuild their gcc or setting GCC_SPECS to # "" will cause issues again :( if [[ ${ROOT} != "/" ]] ; then - echo "GCC_SPECS=\"\"" >> "${ENV_D}/05gcc" + echo "GCC_SPECS=\"\"" >> "${ENV_FILE}" else - if ! GCC_SPECS="" /usr/bin/gcc -v &>/dev/null ; then + if ! GCC_SPECS="" /usr/bin/${CTARGET}-gcc -v &>/dev/null ; then echo ewarn "Your gcc has a bug with GCC_SPECS." ewarn "Please re-emerge gcc." ewarn "http://bugs.gentoo.org/show_bug.cgi?id=68395" echo else - echo "GCC_SPECS=\"\"" >> "${ENV_D}/05gcc" + echo "GCC_SPECS=\"\"" >> "${ENV_FILE}" fi fi fi - echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config" + echo "CURRENT=${CC_COMP}" > "${CONFIG_FILE}" fi # Save PATH @@ -190,9 +193,10 @@ switch_profile() { umask 022 # Update the wrappers for this profile - local native="gcc cpp cc c++ g++ f77 g77 gcj" + local cross="gcc c++ g++ f77 g77 gcj gcjh gfortran" + local native="${cross} cpp gccbug gcj-jar gcov gij grepjar jcf-dump jv-convert jv-scan rmic rmiregistry" is_cross_compiler && native="" - for x in ${native} ${CTARGET}-{gcc,c++,g++,f77,g77,gcj} ; do + for x in ${native}; do # Make sure we have no stale wrappers ${RM} -f "${ROOT}/usr/bin/${x}" [[ ${x:${#x}-3} = "gcc" || ${x:${#x}-3} = "g++" ]] \ @@ -203,10 +207,11 @@ switch_profile() { # wrapper (the binary we're 'wrapping') so that we can # sync mtimes together. This makes things like ccache # happy. See Bug #70548 for more info. + local ref=${ROOT}/${GCC_BIN_PATH}/${x} [[ ${x} = "cc" ]] && ref=${ROOT}/${GCC_BIN_PATH}/gcc if [[ -x ${ref} ]] ; then - ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" \ + ${CP} -f "${LIBEXECDIR}/wrapper" \ "${ROOT}/usr/bin/${x}" touch -r "${ref}" "${ROOT}/usr/bin/${x}" @@ -214,25 +219,76 @@ switch_profile() { # This should probably get folded back into the wrapper ... if [[ ${x:${#x}-3} = "gcc" ]] || [[ ${x:${#x}-3} = "g++" ]] ; then for bits in ${GCCBITS} ; do - cp -f "${ROOT}/usr/lib/gcc-config/wrapper" \ + cp -f "${LIBEXECDIR}/wrapper" \ "${ROOT}/usr/bin/${x}${bits}" done fi fi done + + for x in ${cross}; do + ref=${ROOT}/${GCC_BIN_PATH}/${CTARGET}-${x} + + if [[ -f ${ref} ]]; then + # Don't use gccbits here... delete them if they exist. + [[ -f ${ROOT}/usr/bin/${CTARGET}-${x}32 ]] && \ + rm -f ${ROOT}/usr/bin/${CTARGET}-${x}32 + [[ -f ${ROOT}/usr/bin/${CTARGET}-${x}64 ]] && \ + rm -f ${ROOT}/usr/bin/${CTARGET}-${x}64 + + ${CP} -f ${LIBEXECDIR}/wrapper \ + ${ROOT}/usr/bin/${CTARGET}-${x} + ${CHMOD} 755 ${ROOT}/usr/bin/${CTARGET}-${x} + touch -r ${ref} ${ROOT}/usr/bin/${CTARGET}-${x} + + local cctarget + for cctarget in ${GCC_CTARGET_ALIASES}; do + local var="CFLAGS_"${cctarget//-/_} + if [[ ! -f ${GCC_ENV_D}/config-${cctarget} ]]; then + sed -e "s:@@EXEC@@:${CTARGET}-${x}:g" \ + -e "s:@@CFLAGS@@:${!var}:g" \ + ${LIBEXECDIR}/fake-ctarget.sh > ${ROOT}/usr/bin/${cctarget}-${x} + ${CHMOD} 755 ${ROOT}/usr/bin/${cctarget}-${x} + touch -r ${ref} ${ROOT}/usr/bin/${cctarget}-${x} + fi + done + + if ! is_cross_compiler && [[ -n "${CFLAGS_default}" ]]; then + sed -e "s:@@EXEC@@:${CTARGET}-${x}:g" \ + -e "s:@@CFLAGS@@:${CFLAGS_default}:g" \ + ${LIBEXECDIR}/fake-ctarget.sh > ${ROOT}/usr/bin/${x} + ${CHMOD} 755 ${ROOT}/usr/bin/${x} + touch -r ${ref} ${ROOT}/usr/bin/${x} + fi + fi + done + # Only install cpp if switching to a native one if ! is_cross_compiler ; then ${RM} -f "${ROOT}/lib/cpp" - ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" "${ROOT}/lib/cpp" + ${CP} -f "${LIBEXECDIR}/wrapper" "${ROOT}/lib/cpp" fi # We need to make sure that libgcc_s.so makes it into /lib. # On many systems (x86/amd64/etc...), this will probably never matter, # but on other systems (arm/mips/etc...), this is quite critical. + # http://bugs.gentoo.org/show_bug.cgi?id=60190 - if ! is_cross_compiler && [[ -e ${ROOT}/${LDPATH}/libgcc_s.so ]] ; then - rm -f "${ROOT}"/lib/libgcc_so.so* - cp -a "${ROOT}/${LDPATH}"/libgcc_s.so* "${ROOT}"/lib/ + if ! is_cross_compiler; then + for multilib in $(${ROOT}/${GCC_BIN_PATH}/${CTARGET}-gcc -print-multi-lib); do + multiarg=${multilib#*;} + multiarg=${multiarg/@/-} + multilibdir=${multilib%;*} + libdir="lib/$(${ROOT}/${GCC_BIN_PATH}/${CTARGET}-gcc ${multiarg} -print-multi-os-directory)" + if [[ -e ${ROOT}/${LDPATH}/${multildir}/libgcc_s.so ]]; then + rm -f ${ROOT}/${libdir}/libgcc_so.so* + cp -a ${ROOT}/${LDPATH}/${multilibdir}/libgcc_s.so* ${ROOT}/${libdir}/ + fi + done + unset multilib + unset multilibdir + unset multiarg + unset libdir fi if [[ ${ROOT} = "/" ]] && [[ ${OLD_CC_COMP} != ${CC_COMP} ]] ; then @@ -254,12 +310,9 @@ switch_profile() { } get_current_profile() { - local conf="${GCC_ENV_D}/config" - if [[ -n ${CTARGET} ]] ; then - conf="${conf}-${CTARGET}" - elif [[ -f ${GCC_ENV_D}/config-${CC_COMP} ]] ; then - conf="${conf}-${CC_COMP}" - fi + get_real_chost + CTARGET="${CTARGET:-${REAL_CHOST}}" + local conf="${GCC_ENV_D}/config-${CTARGET}" if [[ ! -f ${conf} ]] ; then eerror "$0: No gcc profile is active!" @@ -279,9 +332,11 @@ get_current_profile() { } list_profiles() { + get_real_chost + local i=1 - if [[ ! -f ${GCC_ENV_D}/config ]] ; then + if [[ ! -f ${GCC_ENV_D}/config-${REAL_CHOST} ]] ; then eerror "$0: No gcc profile is active; please select one!" else get_current_profile >/dev/null @@ -364,6 +419,7 @@ CHECK_CHOST="no" CC_COMP= [[ -z ${ROOT} ]] && ROOT="/" [[ ${ROOT:-1} != "/" ]] && ROOT="${ROOT}/" +LIBEXECDIR="${ROOT}usr/lib/misc/gcc-config" ENV_D="${ROOT}etc/env.d" GCC_ENV_D="${ENV_D}/gcc" @@ -474,13 +530,18 @@ if [[ -z ${CC_COMP} ]] ; then fi if [[ ${DOIT} != "get_current_profile" ]] ; then - CC_COMP_NO_SPECS=$(echo ${CC_COMP} | awk -F- '{ print $1"-"$2"-"$3"-"$4"-"$5 }') - GCC_LIB=$(source "${GCC_ENV_D}/${CC_COMP}" cmd_setup echo ${LDPATH} | ${AWK} -F/ '{ print "/"$2"/"$3"/"$4"/" }') - if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_NO_SPECS%-*}/${CC_COMP_NO_SPECS##*-} ]] || \ + CC_COMP_TARGET=$(echo ${CC_COMP} | awk -F- '{ print $1"-"$2"-"$3"-"$4 }') + CC_COMP_VERSION=${CC_COMP/${CC_COMP_TARGET}-/} + + if [[ ! -d ${ROOT}/${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} ]] || \ [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]] then eerror "$0: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2 @@ -492,7 +553,8 @@ if [[ ${CHECK_CHOST} = "yes" ]] ; then # Chosen CHOST are not the same as the real CHOST according to # make.conf, and --use-portage-chost option was given, so do nothing get_real_chost - [[ ${CC_COMP%-*} != ${REAL_CHOST} ]] && exit 0 + CC_COMP_TARGET=$(echo ${CC_COMP} | awk -F- '{ print $1"-"$2"-"$3"-"$4 }') + [[ ${CC_COMP_TARGET} != ${REAL_CHOST} ]] && exit 0 fi eval ${DOIT} diff --git a/sys-devel/gcc-config/files/wrapper-1.4.4.c b/sys-devel/gcc-config/files/wrapper-1.4.6.c index e94f1f3475ae..68083237c9e8 100644 --- a/sys-devel/gcc-config/files/wrapper-1.4.4.c +++ b/sys-devel/gcc-config/files/wrapper-1.4.6.c @@ -1,7 +1,7 @@ /* * Copyright 1999-2004 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.4.c,v 1.1 2004/12/28 05:32:10 eradicator Exp $ + * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.6.c,v 1.1 2005/02/19 10:04:01 eradicator Exp $ * Author: Martin Schlemmer <azarah@gentoo.org> */ @@ -23,9 +23,6 @@ #define GCC_CONFIG "/usr/bin/gcc-config" #define ENVD_BASE "/etc/env.d/05gcc" -#define MAXNEWFLAGS 32 -#define MAXFLAGLEN 127 - struct wrapper_data { char name[MAXPATHLEN + 1]; char fullname[MAXPATHLEN + 1]; @@ -33,8 +30,6 @@ struct wrapper_data { char tmp[MAXPATHLEN + 1]; char *path; - char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1]; - unsigned newflagsCount; }; static const char *wrapper_strerror(int err, struct wrapper_data *data) @@ -254,6 +249,82 @@ static void modify_path(struct wrapper_data *data) putenv(newpath); } +#define MAXNEWFLAGS 32 +#define MAXFLAGLEN 127 + +static char **getNewArgv(char **argv, const char *newflagsStr) { + char **newargv; + char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1]; + unsigned newflagsCount = 0; + unsigned argc; + unsigned i; + char **p; + + unsigned s, f; /* start/finish of each flag. f points to + * the char AFTER the end (ie the space/\0 + */ + + /* Tokenize the flag list */ + for(s=0; s < strlen(newflagsStr); s=f+1) { + /* Put s at the start of the next flag */ + while(newflagsStr[s] == ' ' || + newflagsStr[s] == '\t') + s++; + if(s == strlen(newflagsStr)) + break; + + f = s + 1; + while(newflagsStr[f] != ' ' && + newflagsStr[f] != '\t' && + newflagsStr[f] != '\0') + f++; + + /* Detect overrun */ + if(MAXFLAGLEN < f - s || MAXNEWFLAGS == newflagsCount) + return NULL; + + strncpy(newflags[newflagsCount], newflagsStr + s, f - s); + newflags[newflagsCount][f - s]='\0'; + newflagsCount++; + } + + /* Calculate original argc and see if it contains -m{abi,32,64} */ + for(argc=0, p=argv; *p; p++, argc++) { + if(newflagsCount && (strncmp(*p, "-m32", 4) == 0 || + strncmp(*p, "-m64", 4) == 0 || + strncmp(*p, "-mabi", 5) == 0)) { + /* Our command line sets the ABI, warn the user about this and ignore + * newArgs by setting newflagsCount to 0. + */ + newflagsCount = 0; + } + } + + /* Allocate our array Make room for the original, new ones, and the + NULL terminator */ + newargv = (char **)malloc(sizeof(char *) * (argc + newflagsCount + 1)); + if(!newargv) + return NULL; + + /* Build argv */ + newargv[0] = argv[0]; + + /* The newFlags come first since we want the environment to override them. */ + for(i=1; i - 1 < newflagsCount; i++) { + newargv[i] = newflags[i - 1]; + } + + /* We just use the existing argv[i] as the start. */ + for(; i - newflagsCount < argc; i++) { + newargv[i] = argv[i - newflagsCount]; + } + + /* And now cap it off... */ + newargv[i] = NULL; + + return newargv; +} + #define lastOfStr(str, n) ((str) + strlen(str) - (n)) int main(int argc, char *argv[]) @@ -305,16 +376,13 @@ int main(int argc, char *argv[]) * otherwise we need to add ${CFLAGS_${ABI}} */ if(!strcmp(lastOfStr(data->bin, 2), "32") ) { - strcpy(data->newflags[data->newflagsCount], "-m32"); data->bin[strlen(data->bin) - 2] = '\0'; - data->newflagsCount++; + newargv = getNewArgv(argv, "-m32"); } else if (!strcmp(lastOfStr(data->bin, 2), "64") ) { data->bin[strlen(data->bin) - 2] = '\0'; - strcpy(data->newflags[data->newflagsCount], "-m64"); - data->newflagsCount++; + newargv = getNewArgv(argv, "-m64"); } else if(getenv("ABI")) { - char *envar = (char *)malloc(sizeof(char) * - (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 )); + char *envar = (char *)malloc(sizeof(char) * (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 )); if(!envar) wrapper_exit("%s wrapper: out of memory\n", argv[0]); @@ -324,60 +392,14 @@ int main(int argc, char *argv[]) sprintf(envar, "CFLAGS_%s", getenv("ABI")); if(getenv(envar)) { - const char *newflagsStr = getenv(envar); - unsigned s, f; /* start/finish of each flag. f points to - * the char AFTER the end (ie the space/\0 - */ - - /* Tokenize the flag list */ - for(s=0; s < strlen(newflagsStr); s=f+1) { - /* Put s at the start of the next flag */ - while(newflagsStr[s] == ' ' || - newflagsStr[s] == '\t') - s++; - if(s == strlen(newflagsStr)) - break; - - f = s + 1; - while(newflagsStr[f] != ' ' && - newflagsStr[f] != '\t' && - newflagsStr[f] != '\0') - f++; - - /* Detect overrun */ - if(MAXFLAGLEN < f - s || MAXNEWFLAGS == data->newflagsCount) - wrapper_exit("%s wrapper: Exiting due to inadequate buffer space. Preventing buffer overrun.\n", argv[0]); - - strncpy(data->newflags[data->newflagsCount], newflagsStr + s, f - s); - data->newflagsCount++; - } + newargv = getNewArgv(argv, getenv(envar)); + if(!newargv) + wrapper_exit("%s wrapper: out of memory\n", argv[0]); } free(envar); } - if(data->newflagsCount) { - unsigned i; - - /* Make room for the original, new ones, and the NULL terminator */ - newargv = (char **)malloc(sizeof(char *) * (argc + data->newflagsCount + 1)); - if(!newargv) - wrapper_exit("Unable to allocate enough memory for new argv[]."); - - /* We just use the existing argv[i] as the start. */ - for(i=0; i < argc; i++) { - newargv[i] = argv[i]; - } - - /* Now we want to append our newflags list. */ - for(; i < argc + data->newflagsCount; i++) { - newargv[i] = data->newflags[i - argc]; - } - - /* And now cap it off... */ - newargv[i] = NULL; - } - /* Ok, do it ... */ if (execv(data->bin, newargv) < 0) wrapper_exit("Could not run/locate \"%s\"\n", data->name); diff --git a/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild index 00a1b7656753..aa8040ede38c 100644 --- a/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild +++ b/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild,v 1.5 2005/02/18 21:45:21 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.10-r1.ebuild,v 1.6 2005/02/19 10:04:01 eradicator Exp $ inherit toolchain-funcs @@ -13,7 +13,7 @@ SRC_URI="" LICENSE="GPL-2" SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" IUSE="" DEPEND="virtual/libc diff --git a/sys-devel/gcc-config/gcc-config-1.3.9.ebuild b/sys-devel/gcc-config/gcc-config-1.4.0.ebuild index c441186f83b1..dc646327cdbe 100644 --- a/sys-devel/gcc-config/gcc-config-1.3.9.ebuild +++ b/sys-devel/gcc-config/gcc-config-1.4.0.ebuild @@ -1,11 +1,11 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.9.ebuild,v 1.5 2005/01/24 02:35:16 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.4.0.ebuild,v 1.1 2005/02/19 10:04:01 eradicator Exp $ inherit toolchain-funcs # Version of .c wrapper to use -W_VER="1.4.4" +W_VER="1.4.6" DESCRIPTION="Utility to change the gcc compiler being used" HOMEPAGE="http://www.gentoo.org/" @@ -13,7 +13,9 @@ SRC_URI="" LICENSE="GPL-2" SLOT="0" -KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +KEYWORDS="-*" +#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +#KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 s390 sh sparc x86" IUSE="" DEPEND="virtual/libc @@ -30,11 +32,17 @@ src_install() { newbin ${FILESDIR}/${PN}-${PV} ${PN} || die "install gcc-config" dosed "s:PORTAGE-VERSION:${PVR}:" /usr/bin/${PN} - exeinto /usr/lib/gcc-config + exeinto /usr/lib/misc/gcc-config doexe wrapper || die "install wrapper" + doexe ${FILESDIR}/fake-ctarget.sh || die "install wrapper" } pkg_postinst() { + [[ -f ${ROOT}/etc/env.d/05gcc ]] && mv ${ROOT}/etc/env.d/05gcc ${ROOT}/etc/env.d/05gcc-${CHOST} + [[ -f ${ROOT}/etc/env.d/05gcc- ]] && rm ${ROOT}/etc/env.d/05gcc- + [[ -f ${ROOT}/etc/env.d/gcc/config ]] && mv ${ROOT}/etc/env.d/gcc/config ${ROOT}/etc/env.d/gcc/config-${CHOST} + [[ -f ${ROOT}/etc/env.d/gcc/config- ]] && rm ${ROOT}/etc/env.d/gcc/config- + # Do we have a valid multi ver setup ? if gcc-config --get-current-profile &>/dev/null ; then # We not longer use the /usr/include/g++-v3 hacks, as |