Portability patch #73617 by Sunil.
authorMike Frysinger <vapier@gentoo.org>
Wed, 8 Dec 2004 23:47:13 +0000 (23:47 +0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 8 Dec 2004 23:47:13 +0000 (23:47 +0000)
sys-devel/gcc-config/ChangeLog
sys-devel/gcc-config/files/digest-gcc-config-1.3.7-r6 [moved from sys-devel/gcc-config/files/digest-gcc-config-1.3.7-r5 with 100% similarity]
sys-devel/gcc-config/files/gcc-config-1.3.7
sys-devel/gcc-config/files/wrapper-1.4.2.c
sys-devel/gcc-config/gcc-config-1.3.7-r6.ebuild [moved from sys-devel/gcc-config/gcc-config-1.3.7-r5.ebuild with 93% similarity]

index df560ee6c3aee7210fa6c46682be10cf56f25101..c50cd3ff4231d93926bb935990ff4426b87c4665 100644 (file)
@@ -1,6 +1,13 @@
 # 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.68 2004/12/05 08:10:16 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.69 2004/12/08 23:47:13 vapier Exp $
+
+*gcc-config-1.3.7-r6 (08 Dec 2004)
+
+  08 Dec 2004; Mike Frysinger <vapier@gentoo.org> files/gcc-config-1.3.7,
+  files/wrapper-1.4.2.c, -gcc-config-1.3.7-r5.ebuild,
+  +gcc-config-1.3.7-r6.ebuild:
+  Portability patch #73617 by Sunil.
 
 *gcc-config-1.3.7-r5 (05 Dec 2004)
 
index 343fce0cc79a65feb05fa116a81d3bb6351473c3..d881b3ca2c14e7c0f927897da4ed047f21ca4515 100755 (executable)
@@ -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.7,v 1.9 2004/12/05 21:07:43 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.7,v 1.10 2004/12/08 23:47:13 vapier Exp $
 # Author:  Martin Schlemmer <azarah@gentoo.org>
 
 trap ":" INT QUIT TSTP
@@ -224,14 +224,11 @@ switch_profile() {
                        fi
                fi
        done
-       # Only install cpp if the toolchain supports C++
+       # Only install cpp if switching to a native one
        if ! is_cross_compiler
        then
                ${RM} -f "${ROOT}/lib/cpp"
-               if [ -x "${ROOT}/usr/bin/${REAL_CHOST}-g++" ]
-               then
-                       ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" "${ROOT}/lib/cpp"
-               fi
+               ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" "${ROOT}/lib/cpp"
        fi
 
        if [ "${ROOT}" = "/" ] && [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
index 8269f3ab4d098044189dc0f5fa5a82508e31aa3c..b3bc15074ba175d247077274972d03af6fd671f5 100644 (file)
@@ -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.2.c,v 1.3 2004/08/19 15:16:25 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.2.c,v 1.4 2004/12/08 23:47:13 vapier Exp $
  * Author: Martin Schlemmer <azarah@gentoo.org>
  */
 
@@ -39,7 +39,9 @@ struct wrapper_data {
 
 static const char *wrapper_strerror(int err, struct wrapper_data *data)
 {
-       strerror_r(err, data->tmp, sizeof(data->tmp));
+       /* this app doesn't use threads and strerror 
+        * is more portable than strerror_r */
+       strncpy(data->tmp, strerror(err), sizeof(data->tmp));
        return data->tmp;
 }
 
@@ -155,7 +157,7 @@ static int find_target_in_envd(struct wrapper_data *data)
                                /* A bash variable may be unquoted, quoted with " or
                                 * quoted with ', so extract the value without those ..
                                 */
-                               token = strsep(&strp, "\n\"\'");
+                               token = strtok(&strp, "\n\"\'");
 
                                while (NULL != token) {
                                        
@@ -165,7 +167,7 @@ static int find_target_in_envd(struct wrapper_data *data)
                                                return 1;
                                        }
 
-                                       token = strsep(&strp, "\n\"\'");
+                                       token = strtok(&strp, "\n\"\'");
                                }
                        }
                        
@@ -247,19 +249,15 @@ static void modify_path(struct wrapper_data *data)
                        return;
        }
 
-       len = strlen(dname) + strlen(data->path) + 2;
+       len = strlen(dname) + strlen(data->path) + 2 + strlen("PATH") + 1;
 
        newpath = (char *)malloc(len);
        if (NULL == newpath)
                wrapper_exit("out of memory\n");
        memset(newpath, 0, len);
 
-       snprintf(newpath, len, "%s:%s", dname, data->path);
-       setenv("PATH", newpath, 1);
-
-       if (newpath)
-               free(newpath);
-       newpath = NULL;
+       snprintf(newpath, len, "PATH=%s:%s", dname, data->path);
+       putenv(newpath);
 }
 
 int main(int argc, char **argv) 
similarity index 93%
rename from sys-devel/gcc-config/gcc-config-1.3.7-r5.ebuild
rename to sys-devel/gcc-config/gcc-config-1.3.7-r6.ebuild
index 80c442502d7bd06ee4c19902d6ff26c6627902c6..5116058d29296f62fd08daad499e77d91a5fe96a 100644 (file)
@@ -1,14 +1,12 @@
 # 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.7-r5.ebuild,v 1.1 2004/12/05 08:10:16 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.7-r6.ebuild,v 1.1 2004/12/08 23:47:13 vapier Exp $
 
 inherit toolchain-funcs
 
 # Version of .c wrapper to use
 W_VER="1.4.2"
 
-DISABLE_GEN_GCC_WRAPPERS="yes"
-
 DESCRIPTION="Utility to change the gcc compiler being used"
 HOMEPAGE="http://www.gentoo.org/"
 SRC_URI=""