diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-08-26 03:21:02 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-08-26 03:21:02 +0000 |
commit | 839465c4c63be6b6e09bda8d3e11d60980db947c (patch) | |
tree | cbf580ddf56570b5732dfd9ea967f0f90769c343 /sys-devel | |
parent | old (diff) | |
download | gentoo-2-839465c4c63be6b6e09bda8d3e11d60980db947c.tar.gz gentoo-2-839465c4c63be6b6e09bda8d3e11d60980db947c.tar.bz2 gentoo-2-839465c4c63be6b6e09bda8d3e11d60980db947c.zip |
Add a quick symlink for the native compiler gcc env.d so that by default, path look ups are fast even when working under a reduced PATH #190260 by Robert Buchholz.
(Portage version: 2.1.3.7)
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/gcc-config/ChangeLog | 10 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/digest-gcc-config-1.4.0-r1 | 0 | ||||
-rwxr-xr-x | sys-devel/gcc-config/files/gcc-config-1.4.0 | 5 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/wrapper-1.5.0.c | 34 | ||||
-rw-r--r-- | sys-devel/gcc-config/gcc-config-1.4.0-r1.ebuild | 55 |
5 files changed, 90 insertions, 14 deletions
diff --git a/sys-devel/gcc-config/ChangeLog b/sys-devel/gcc-config/ChangeLog index cddadc2acfdd..cb48006bc786 100644 --- a/sys-devel/gcc-config/ChangeLog +++ b/sys-devel/gcc-config/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-devel/gcc-config # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.164 2007/06/24 18:16:32 peper Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.165 2007/08/26 03:21:02 vapier Exp $ + +*gcc-config-1.4.0-r1 (26 Aug 2007) + + 26 Aug 2007; Mike Frysinger <vapier@gentoo.org> files/gcc-config-1.4.0, + files/wrapper-1.5.0.c, +gcc-config-1.4.0-r1.ebuild: + Add a quick symlink for the native compiler gcc env.d so that by default, + path look ups are fast even when working under a reduced PATH #190260 by + Robert Buchholz. 24 Jun 2007; Piotr Jaroszyński <peper@gentoo.org> gcc-config-1.4.0.ebuild: diff --git a/sys-devel/gcc-config/files/digest-gcc-config-1.4.0-r1 b/sys-devel/gcc-config/files/digest-gcc-config-1.4.0-r1 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-devel/gcc-config/files/digest-gcc-config-1.4.0-r1 diff --git a/sys-devel/gcc-config/files/gcc-config-1.4.0 b/sys-devel/gcc-config/files/gcc-config-1.4.0 index 0558d5d64684..e8ac054b0394 100755 --- a/sys-devel/gcc-config/files/gcc-config-1.4.0 +++ b/sys-devel/gcc-config/files/gcc-config-1.4.0 @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2007 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.4.0,v 1.19 2007/08/06 01:08:09 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.4.0,v 1.20 2007/08/26 03:21:02 vapier Exp $ trap ":" INT QUIT TSTP @@ -259,6 +259,9 @@ switch_profile() { echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}" + # Help out the gcc wrapper + ln -sf ${CC_COMP} "${GCC_ENV_D}/NATIVE" + # Punt old files rm -f "${ENV_D}/05gcc" rm -f "${GCC_ENV_D}/config" diff --git a/sys-devel/gcc-config/files/wrapper-1.5.0.c b/sys-devel/gcc-config/files/wrapper-1.5.0.c index 4778ebe0d05e..a23149d0b363 100644 --- a/sys-devel/gcc-config/files/wrapper-1.5.0.c +++ b/sys-devel/gcc-config/files/wrapper-1.5.0.c @@ -1,7 +1,7 @@ /* - * Copyright 1999-2005 Gentoo Foundation + * Copyright 1999-2007 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.5.0.c,v 1.2 2007/07/27 07:47:07 vapier Exp $ + * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.5.0.c,v 1.3 2007/08/26 03:21:02 vapier Exp $ * Author: Martin Schlemmer <azarah@gentoo.org> * az's lackey: Mike Frysinger <vapier@gentoo.org> */ @@ -130,13 +130,20 @@ static int find_target_in_envd(struct wrapper_data *data, int cross_compile) char *strp = str; char envd_file[MAXPATHLEN + 1]; - char *ctarget, *end = strrchr(data->name, '-'); - if (end == NULL) - return 0; - ctarget = strdup(data->name); - ctarget[end - data->name] = '\0'; - snprintf(envd_file, MAXPATHLEN, "%s-%s", ENVD_BASE, ctarget); - free(ctarget); + if (!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"); + } else { + char *ctarget, *end = strrchr(data->name, '-'); + if (end == NULL) + return 0; + ctarget = strdup(data->name); + ctarget[end - data->name] = '\0'; + snprintf(envd_file, MAXPATHLEN, "%s-%s", ENVD_BASE, ctarget); + free(ctarget); + } envfile = fopen(envd_file, "r"); if (envfile == NULL) @@ -178,7 +185,7 @@ static int find_target_in_envd(struct wrapper_data *data, int cross_compile) strp = str; } -bail: + bail: fclose(envfile); return (cross_compile ? 0 : find_target_in_envd(data, 1)); } @@ -271,7 +278,10 @@ static char **build_new_argv(char **argv, const char *newflags_str) retargv = argv; /* make sure user hasn't specified any ABI flags already ... - * if they have, lets just get out of here */ + * if they have, lets just get out of here ... this of course + * is by no means complete, it's merely a hack that works most + * of the time ... + */ for (argc = 0; argv[argc]; ++argc) for (i = 0; abi_flags[i]; ++i) if (!strncmp(argv[argc], abi_flags[i], strlen(abi_flags[i]))) @@ -361,5 +371,5 @@ int main(int argc, char *argv[]) if (execv(data.bin, newargv) < 0) wrapper_exit("Could not run/locate \"%s\"\n", data.name); - return 0; + return 123; } diff --git a/sys-devel/gcc-config/gcc-config-1.4.0-r1.ebuild b/sys-devel/gcc-config/gcc-config-1.4.0-r1.ebuild new file mode 100644 index 000000000000..1f13609d5892 --- /dev/null +++ b/sys-devel/gcc-config/gcc-config-1.4.0-r1.ebuild @@ -0,0 +1,55 @@ +# Copyright 1999-2007 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.4.0-r1.ebuild,v 1.1 2007/08/26 03:21:02 vapier Exp $ + +inherit flag-o-matic toolchain-funcs multilib + +# Version of .c wrapper to use +W_VER="1.5.0" + +DESCRIPTION="Utility to change the gcc compiler being used" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="" + +RDEPEND="!app-admin/eselect-compiler" + +S=${WORKDIR} + +src_unpack() { + cp "${FILESDIR}"/wrapper-${W_VER}.c "${S}"/wrapper.c || die +} + +src_compile() { + strip-flags + emake CC="$(tc-getCC)" wrapper || die "compile wrapper" +} + +src_install() { + newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die "install gcc-config" + sed -i \ + -e "s:PORTAGE-VERSION:${PVR}:g" \ + -e "s:GENTOO_LIBDIR:$(get_libdir):g" \ + "${D}"/usr/bin/${PN} + + exeinto /usr/$(get_libdir)/misc + newexe wrapper gcc-config || die "install wrapper" +} + +pkg_postinst() { + # 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 + # it is not needed ... + [[ -L ${ROOT}/usr/include/g++ ]] && rm -f "${ROOT}"/usr/include/g++ + [[ -L ${ROOT}/usr/include/g++-v3 ]] && rm -f "${ROOT}"/usr/include/g++-v3 + gcc-config $(/usr/bin/gcc-config --get-current-profile) + fi + + # Make sure old versions dont exist #79062 + rm -f "${ROOT}"/usr/sbin/gcc-config +} |