diff options
author | Jeremy Huddleston <eradicator@gentoo.org> | 2004-12-28 05:32:10 +0000 |
---|---|---|
committer | Jeremy Huddleston <eradicator@gentoo.org> | 2004-12-28 05:32:10 +0000 |
commit | 0829f7b91cb4e639d0579dd5f21f5fb9fe74a160 (patch) | |
tree | a67db87c3176eea329ef8aa7e15b86b02a46f3d2 /sys-devel | |
parent | Moved from app-sci/gimps to sci-mathematics/gimps (diff) | |
download | historical-0829f7b91cb4e639d0579dd5f21f5fb9fe74a160.tar.gz historical-0829f7b91cb4e639d0579dd5f21f5fb9fe74a160.tar.bz2 historical-0829f7b91cb4e639d0579dd5f21f5fb9fe74a160.zip |
Rolling in support for CFLAGS_${ABI}. Rolling g{cc,++}{32,64} support into the wrapper.
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/gcc-config/ChangeLog | 10 | ||||
-rw-r--r-- | sys-devel/gcc-config/Manifest | 24 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r2 (renamed from sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r1) | 0 | ||||
-rwxr-xr-x | sys-devel/gcc-config/files/gcc-config-1.3.8 | 7 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/wrapper-1.4.4.c (renamed from sys-devel/gcc-config/files/wrapper-1.4.3.c) | 89 | ||||
-rw-r--r-- | sys-devel/gcc-config/gcc-config-1.3.8-r2.ebuild (renamed from sys-devel/gcc-config/gcc-config-1.3.8-r1.ebuild) | 4 |
6 files changed, 113 insertions, 21 deletions
diff --git a/sys-devel/gcc-config/ChangeLog b/sys-devel/gcc-config/ChangeLog index e1bf6ccbb17b..653d1001f0b2 100644 --- a/sys-devel/gcc-config/ChangeLog +++ b/sys-devel/gcc-config/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-devel/gcc-config # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.71 2004/12/24 05:46:23 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.72 2004/12/28 05:32:10 eradicator Exp $ + +*gcc-config-1.3.8-r2 (27 Dec 2004) + + 27 Dec 2004; Jeremy Huddleston <eradicator@gentoo.org> + files/gcc-config-1.3.8, -files/wrapper-1.4.3.c, +files/wrapper-1.4.4.c, + -gcc-config-1.3.8-r1.ebuild, +gcc-config-1.3.8-r2.ebuild: + Rolling in support for CFLAGS_${ABI}. Rolling g{cc,++}{32,64} support into + the wrapper. *gcc-config-1.3.8-r1 (24 Dec 2004) diff --git a/sys-devel/gcc-config/Manifest b/sys-devel/gcc-config/Manifest index 0b0987b1a0fb..d7bc00950dfc 100644 --- a/sys-devel/gcc-config/Manifest +++ b/sys-devel/gcc-config/Manifest @@ -1,23 +1,23 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -MD5 ba976e0d3f974115680d3bc3ca22a3a6 gcc-config-1.3.8-r1.ebuild 1359 -MD5 edfe90e24dbfe7a49d28f0c37ba4ea8b ChangeLog 14276 +MD5 236509b94e2d78bf9d6cba5820706867 ChangeLog 14600 MD5 0a250a07d02f1343f64fe7f7bbdbd820 gcc-config-1.3.6-r4.ebuild 2636 -MD5 567094e03359ffc1c95af7356395228d metadata.xml 162 MD5 626c17691d48b229f5c619618bf365c0 gcc-config-1.3.7-r6.ebuild 1395 -MD5 3284763a25d3f43f7c29fc765be2defd files/gcc-config-1.3.8 12381 +MD5 567094e03359ffc1c95af7356395228d metadata.xml 162 +MD5 cab2e8d259183adfe9f2d3d04273b8ca gcc-config-1.3.8-r2.ebuild 1363 +MD5 7723c767ef3e4935c2299fb253412d7e files/wrapper-1.4.4.c 10132 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.6-r4 0 -MD5 11d24a6f5defba5a8a8bbc65f26e2215 files/wrapper-1.4.2.c 7439 -MD5 5f5ba2d67203ed8386ae76352f15000d files/gcc-config-1.3.6 10285 -MD5 dc0ff3c291392d8abac22d82a8593ab6 files/wrapper-1.4.3.c 7545 MD5 0c96b0464e9cec87312b5fa06d8c138b files/gcc-config-1.3.7 11800 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.8-r1 0 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.7-r6 0 +MD5 00229104aa2309d104a1d9dddea67849 files/gcc-config-1.3.8 12330 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.8-r2 0 +MD5 11d24a6f5defba5a8a8bbc65f26e2215 files/wrapper-1.4.2.c 7439 +MD5 5f5ba2d67203ed8386ae76352f15000d files/gcc-config-1.3.6 10285 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.9.10 (GNU/Linux) +Version: GnuPG v1.2.6 (GNU/Linux) -iD8DBQFBy61HroRuSHgZdywRAmBSAKCPWI+u8Zy95XM6vhrekfxxTbUqGACfWdw8 -lByDvb0Kl3UnVhcDvwUsLkU= -=Ab6Z +iD8DBQFB0PA4ArHZZzCEUG0RArMtAJ91pyAhxyZdfqonGozrJ1DyOM/vpwCfUiaH +1ZbnufUbA81L2LyHpKyQrMs= +=7tSd -----END PGP SIGNATURE----- diff --git a/sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r1 b/sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r2 index e69de29bb2d1..e69de29bb2d1 100644 --- a/sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r1 +++ b/sys-devel/gcc-config/files/digest-gcc-config-1.3.8-r2 diff --git a/sys-devel/gcc-config/files/gcc-config-1.3.8 b/sys-devel/gcc-config/files/gcc-config-1.3.8 index ee8c1176252f..382fc6717f5c 100755 --- a/sys-devel/gcc-config/files/gcc-config-1.3.8 +++ b/sys-devel/gcc-config/files/gcc-config-1.3.8 @@ -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.8,v 1.2 2004/12/24 05:46:24 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.8,v 1.3 2004/12/28 05:32:10 eradicator Exp $ # Author: Martin Schlemmer <azarah@gentoo.org> trap ":" INT QUIT TSTP @@ -212,9 +212,8 @@ 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 - echo "#!/bin/sh"$'\n'"exec ${x} -m${bits} \"\$@\"" \ - > "${ROOT}/usr/bin/${x}${bits}" - chmod 755 "${ROOT}/usr/bin/${x}${bits}" + cp -f "${ROOT}/usr/lib/gcc-config/wrapper" \ + "${ROOT}/usr/bin/${x}${bits}" done fi fi diff --git a/sys-devel/gcc-config/files/wrapper-1.4.3.c b/sys-devel/gcc-config/files/wrapper-1.4.4.c index 80e1a81d2623..e94f1f3475ae 100644 --- a/sys-devel/gcc-config/files/wrapper-1.4.3.c +++ b/sys-devel/gcc-config/files/wrapper-1.4.4.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.3.c,v 1.2 2004/12/23 18:04:06 vapier Exp $ + * $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 $ * Author: Martin Schlemmer <azarah@gentoo.org> */ @@ -23,6 +23,9 @@ #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]; @@ -30,6 +33,8 @@ 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) @@ -249,12 +254,15 @@ static void modify_path(struct wrapper_data *data) putenv(newpath); } +#define lastOfStr(str, n) ((str) + strlen(str) - (n)) + int main(int argc, char *argv[]) { struct wrapper_data *data; size_t size; char *path; int result = 0; + char **newargv = argv; data = alloca(sizeof(*data)); if (data == NULL) @@ -293,8 +301,85 @@ int main(int argc, char *argv[]) * http://bugs.gentoo.org/show_bug.cgi?id=8132 */ argv[0] = data->bin; + /* If this is g{cc,++}{32,64}, we need to add -m{32,64} + * 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++; + } else if (!strcmp(lastOfStr(data->bin, 2), "64") ) { + data->bin[strlen(data->bin) - 2] = '\0'; + strcpy(data->newflags[data->newflagsCount], "-m64"); + data->newflagsCount++; + } else if(getenv("ABI")) { + char *envar = (char *)malloc(sizeof(char) * + (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 )); + if(!envar) + wrapper_exit("%s wrapper: out of memory\n", argv[0]); + + /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are + * the same no matter which compiler we are using. + */ + 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++; + } + } + + 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, argv) < 0) + if (execv(data->bin, newargv) < 0) wrapper_exit("Could not run/locate \"%s\"\n", data->name); return 0; diff --git a/sys-devel/gcc-config/gcc-config-1.3.8-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.3.8-r2.ebuild index f9f558c4ffcf..b20970f330c4 100644 --- a/sys-devel/gcc-config/gcc-config-1.3.8-r1.ebuild +++ b/sys-devel/gcc-config/gcc-config-1.3.8-r2.ebuild @@ -1,11 +1,11 @@ # 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/gcc-config-1.3.8-r1.ebuild,v 1.1 2004/12/24 05:46:23 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.8-r2.ebuild,v 1.1 2004/12/28 05:32:10 eradicator Exp $ inherit toolchain-funcs # Version of .c wrapper to use -W_VER="1.4.3" +W_VER="1.4.4" DESCRIPTION="Utility to change the gcc compiler being used" HOMEPAGE="http://www.gentoo.org/" |