diff options
Diffstat (limited to 'sys-devel/distcc/files')
7 files changed, 297 insertions, 221 deletions
diff --git a/sys-devel/distcc/files/distcc-3.3.2-freedesktop.patch b/sys-devel/distcc/files/distcc-3.3.2-freedesktop.patch deleted file mode 100644 index 7b735ebec7f9..000000000000 --- a/sys-devel/distcc/files/distcc-3.3.2-freedesktop.patch +++ /dev/null @@ -1,112 +0,0 @@ -From d852c808d6f470031f40edec9ebe980afc69b9b9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> -Date: Sat, 8 Dec 2018 12:50:07 +0100 -Subject: [PATCH] Fix desktop spec compliance of distccmon-gnome install - ---- - Makefile.in | 18 ++++++++++-------- - gnome/distccmon-gnome.desktop | 7 +++---- - ...mon-gnome-icon.png => distccmon-gnome.png} | Bin - src/mon-gnome.c | 2 +- - 4 files changed, 14 insertions(+), 13 deletions(-) - rename gnome/{distccmon-gnome-icon.png => distccmon-gnome.png} (100%) - -diff --git a/Makefile.in b/Makefile.in -index 6e1e467..1106559 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -52,13 +52,14 @@ mandir = @mandir@ - includedir = @includedir@ - oldincludedir = /usr/include - docdir = @docdir@ --pkgdatadir = $(datadir)/@PACKAGE_NAME@ -+icondir = $(datarootdir)/pixmaps -+desktopdir = $(datarootdir)/applications - - include_server_builddir = $(builddir)/_include_server - - # These must be done from here, not from autoconf, because they can - # contain variable expansions written in Make syntax. Ew. --DIR_DEFS = -DLIBDIR="\"${libdir}\"" -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\"" -+DIR_DEFS = -DLIBDIR="\"${libdir}\"" -DSYSCONFDIR="\"${sysconfdir}\"" -DICONDIR="\"${icondir}\"" - - # arguments to pkgconfig - GNOME_PACKAGES = @GNOME_PACKAGES@ -@@ -387,7 +388,7 @@ man_HTML = man/distcc_1.html man/distccd_1.html man/distccmon_text_1.html \ - man/lsdistcc_1.html man/pump_1.html man/include_server_1.html - MEN = $(man1_MEN) - --gnome_data = gnome/distccmon-gnome-icon.png \ -+gnome_data = gnome/distccmon-gnome.png \ - gnome/distccmon-gnome.desktop - - popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \ -@@ -1033,7 +1034,8 @@ showpaths: - @echo " programs $(DESTDIR)$(bindir)" - @echo " sbin programs $(DESTDIR)$(sbindir)" - @echo " system configuration $(DESTDIR)$(sysconfdir)" -- @echo " shared data files $(DESTDIR)$(pkgdatadir)" -+ @echo " icon file $(DESTDIR)$(icondir)" -+ @echo " application file $(DESTDIR)$(desktopdir)" - - - # install-sh can't handle multiple arguments, but we don't need any -@@ -1129,10 +1131,10 @@ install-example: $(example_DOCS) - done - - install-gnome-data: $(gnome_data) -- $(mkinstalldirs) "$(DESTDIR)$(pkgdatadir)" -- for p in $(gnome_data); do \ -- $(INSTALL_DATA) "$$p" "$(DESTDIR)$(pkgdatadir)" || exit 1; \ -- done -+ $(mkinstalldirs) "$(DESTDIR)$(icondir)" -+ $(mkinstalldirs) "$(DESTDIR)$(desktopdir)" -+ $(INSTALL_DATA) gnome/distccmon-gnome.png "$(DESTDIR)$(icondir)" -+ $(INSTALL_DATA) gnome/distccmon-gnome.desktop "$(DESTDIR)$(desktopdir)" - - install-conf: $(conf_files) $(default_files) - $(mkinstalldirs) "$(DESTDIR)$(sysconfdir)/distcc" -diff --git a/gnome/distccmon-gnome.desktop b/gnome/distccmon-gnome.desktop -index bd1fa26..7205f5e 100644 ---- a/gnome/distccmon-gnome.desktop -+++ b/gnome/distccmon-gnome.desktop -@@ -1,6 +1,5 @@ - [Desktop Entry] --Version=0.9.4 --Encoding=UTF-8 -+Version=1.0 - Exec=distccmon-gnome - Name=distcc monitor - Name[sv]=distcc övervakare -@@ -8,9 +7,9 @@ GenericName=Distributed Compile Monitor - GenericName[sv]=Distribuerad kompilerings-övervakare - Comment=Graphical view of distributed compile tasks - Comment[sv]=Grafisk vy av distribuerade kompileringsuppgifter --Icon=distccmon-gnome-icon.png -+Icon=distccmon-gnome - TryExec=distccmon-gnome - Terminal=false - Type=Application --Categories=GNOME;Application;Development; -+Categories=GNOME;GTK;Development; - StartupNotify=true -diff --git a/gnome/distccmon-gnome-icon.png b/gnome/distccmon-gnome.png -similarity index 100% -rename from gnome/distccmon-gnome-icon.png -rename to gnome/distccmon-gnome.png -diff --git a/src/mon-gnome.c b/src/mon-gnome.c -index 24681d0..bfc286d 100644 ---- a/src/mon-gnome.c -+++ b/src/mon-gnome.c -@@ -599,7 +599,7 @@ static GtkWidget * dcc_gnome_make_mainwin (void) - - #if GTK_CHECK_VERSION(2,2,0) - gtk_window_set_icon_from_file (GTK_WINDOW (mainwin), -- PKGDATADIR "/distccmon-gnome-icon.png", -+ ICONDIR "/distccmon-gnome.png", - NULL); - #endif - --- -2.20.0.rc2 - diff --git a/sys-devel/distcc/files/distcc-3.3.3-gcc-10-fix.patch b/sys-devel/distcc/files/distcc-3.3.3-gcc-10-fix.patch deleted file mode 100644 index 2c0bce6c82b6..000000000000 --- a/sys-devel/distcc/files/distcc-3.3.3-gcc-10-fix.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 377969cc762569f4a5ec409a1e7ad6a7be3e51b3 Mon Sep 17 00:00:00 2001 -From: Romain Geissler <romain.geissler@amadeus.com> -Date: Mon, 27 Jan 2020 09:28:43 +0000 -Subject: [PATCH] Fix build with gcc 10 which defaults to -fno-common (cf - https://gcc.gnu.org/gcc-10/porting_to.html) - -This fixes the following link error I see when I use the latest gcc 10 -git branch: -/opt/1A/toolchain/x86_64-v20.0.7/lib/gcc/x86_64-1a-linux-gnu/10.0.1/../../../../x86_64-1a-linux-gnu/bin/ld: src/serve.o:(.bss+0x0): multiple definition of `stats_text'; src/prefork.o:(.bss+0x0): first defined here -/opt/1A/toolchain/x86_64-v20.0.7/lib/gcc/x86_64-1a-linux-gnu/10.0.1/../../../../x86_64-1a-linux-gnu/bin/ld: src/stats.o:(.data+0x20): multiple definition of `stats_text'; src/prefork.o:(.bss+0x0): first defined here -collect2: error: ld returned 1 exit status ---- - src/stats.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/stats.h b/src/stats.h -index 9bde285..74d4690 100644 ---- a/src/stats.h -+++ b/src/stats.h -@@ -33,7 +33,7 @@ enum stats_e { STATS_TCP_ACCEPT, STATS_REJ_BAD_REQ, STATS_REJ_OVERLOAD, - STATS_COMPILE_OK, STATS_COMPILE_ERROR, STATS_COMPILE_TIMEOUT, - STATS_CLI_DISCONN, STATS_OTHER, STATS_ENUM_MAX }; - --const char *stats_text[20]; -+extern const char *stats_text[20]; - - int dcc_stats_init(void); - void dcc_stats_init_kid(void); diff --git a/sys-devel/distcc/files/distcc-3.3.3-no-rewrite-chost.patch b/sys-devel/distcc/files/distcc-3.3.3-no-rewrite-chost.patch deleted file mode 100644 index dafaa90759b4..000000000000 --- a/sys-devel/distcc/files/distcc-3.3.3-no-rewrite-chost.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c2471d4cf3e2ef2556c150d52860b4e8f04e4994 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com> -Date: Mon, 1 Mar 2021 22:13:36 +0200 -Subject: [PATCH] distcc: fix i686 cross compile - -[mgorny: disable toolchain prefix rewriting code that workarounds some - Debian invention and breaks everything else] - ---- - src/compile.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/compile.c b/src/compile.c -index 25df355..e5d655b 100644 ---- a/src/compile.c -+++ b/src/compile.c -@@ -572,7 +572,7 @@ static int dcc_gcc_rewrite_fqn(char **argv) - if (!newcmd) - return -ENOMEM; - -- if ((t = strstr(target_with_vendor, "-pc-"))) { -+ if (0 && (t = strstr(target_with_vendor, "-pc-"))) { - memcpy(newcmd, target_with_vendor, t - target_with_vendor); - strcat(newcmd, t + strlen("-pc")); - } else --- -2.26.2 - diff --git a/sys-devel/distcc/files/distcc-3.3.3-py38.patch b/sys-devel/distcc/files/distcc-3.3.3-py38.patch deleted file mode 100644 index 1ba5fee7d87e..000000000000 --- a/sys-devel/distcc/files/distcc-3.3.3-py38.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c52a023b8a17e4346c66a8fddee69b40b327eae7 Mon Sep 17 00:00:00 2001 -From: MartB <mart.b@outlook.de> -Date: Thu, 28 Nov 2019 21:00:59 +0100 -Subject: [PATCH] Replace time.clock() with time.perf_counter() - -.clock() got removed in python 3.8 and was marked as deprecated since 3.3 -(https://github.com/python/cpython/pull/13270) ---- - include_server/parse_file.py | 4 ++-- - include_server/statistics.py | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include_server/parse_file.py b/include_server/parse_file.py -index d1dcc74..f5d78b7 100755 ---- a/include_server/parse_file.py -+++ b/include_server/parse_file.py -@@ -272,7 +272,7 @@ def Parse(self, filepath, symbol_table): - - assert isinstance(filepath, str) - self.filepath = filepath -- parse_file_start_time = time.clock() -+ parse_file_start_time = time.perf_counter() - statistics.parse_file_counter += 1 - - includepath_map_index = self.includepath_map.Index -@@ -338,6 +338,6 @@ def Parse(self, filepath, symbol_table): - expr_includes, next_includes) - - -- statistics.parse_file_total_time += time.clock() - parse_file_start_time -+ statistics.parse_file_total_time += time.perf_counter() - parse_file_start_time - - return (quote_includes, angle_includes, expr_includes, next_includes) -diff --git a/include_server/statistics.py b/include_server/statistics.py -index 9677af3..7bc9cb8 100755 ---- a/include_server/statistics.py -+++ b/include_server/statistics.py -@@ -62,13 +62,13 @@ def StartTiming(): - global start_time, translation_unit_counter - """Mark the start of a request to find an include closure.""" - translation_unit_counter += 1 -- start_time = time.clock() -+ start_time = time.perf_counter() - - - def EndTiming(): - """Mark the end of an include closure calculation.""" - global translation_unit_time, min_time, max_time, total_time -- translation_unit_time = time.clock() - start_time -+ translation_unit_time = time.perf_counter() - start_time - min_time = min(translation_unit_time, min_time) - max_time = max(translation_unit_time, max_time) - total_time += translation_unit_time diff --git a/sys-devel/distcc/files/distcc-3.4-fix-dcc_gcc_rewrite_fqn-corruption.patch b/sys-devel/distcc/files/distcc-3.4-fix-dcc_gcc_rewrite_fqn-corruption.patch new file mode 100644 index 000000000000..14c08db329d1 --- /dev/null +++ b/sys-devel/distcc/files/distcc-3.4-fix-dcc_gcc_rewrite_fqn-corruption.patch @@ -0,0 +1,65 @@ +https://bugs.gentoo.org/904720 +https://github.com/distcc/distcc/commit/879b71d6e95673e58d33f6c3c341a893ee307161 + +From 879b71d6e95673e58d33f6c3c341a893ee307161 Mon Sep 17 00:00:00 2001 +From: Alexey Sheplyakov <asheplyakov@yandex.ru> +Date: Sat, 10 Jul 2021 22:18:14 +0400 +Subject: [PATCH] dcc_gcc_rewrite_fqn: avoid heap corruption + +On ALT Linux I've run into the following bug: + +distcc gcc -Wall -std=gnu89 -I. -O2 -o hello.o -c hello.c +free(): invalid next size (fast) +Aborted (core dumped) + +Apparently dcc_gcc_rewrite writes beyond the allocated memory: + +valgrind --leak-check=full -v ./distcc gcc -Wall -std=gnu89 -I. -O2 -o hello.o -c hello.c + +==11382== ERROR SUMMARY: 53 errors from 5 contexts (suppressed: 0 from 0) +==11382== +==11382== 1 errors in context 1 of 5: +==11382== Invalid write of size 1 +==11382== at 0x4C349D8: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==11382== by 0x10D165: dcc_gcc_rewrite_fqn (compile.c:611) +==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725) +==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014) +==11382== by 0x10E380: main (distcc.c:352) +==11382== Address 0x544e828 is 1 bytes after a block of size 23 alloc'd +==11382== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==11382== by 0x10D087: dcc_gcc_rewrite_fqn (compile.c:588) +==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725) +==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014) +==11382== by 0x10E380: main (distcc.c:352) +==11382== +==11382== +==11382== 1 errors in context 2 of 5: +==11382== Invalid write of size 1 +==11382== at 0x4C349C8: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==11382== by 0x10D165: dcc_gcc_rewrite_fqn (compile.c:611) +==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725) +==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014) +==11382== by 0x10E380: main (distcc.c:352) +==11382== Address 0x544e827 is 0 bytes after a block of size 23 alloc'd +==11382== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==11382== by 0x10D087: dcc_gcc_rewrite_fqn (compile.c:588) +==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725) +==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014) +==11382== by 0x10E380: main (distcc.c:352) + +and ALT Linux' hardened glibc does not quite like that. +Correctly compute the `newcmd_len` to avoid the problem. + +ALTBUG: #40425 +--- a/src/compile.c ++++ b/src/compile.c +@@ -584,7 +584,7 @@ static int dcc_gcc_rewrite_fqn(char **argv) + return -ENOENT; + + +- newcmd_len = strlen(target_with_vendor) + 1 + strlen(argv[0] + 1); ++ newcmd_len = strlen(target_with_vendor) + 1 + strlen(argv[0]) + 1; + newcmd = malloc(newcmd_len); + if (!newcmd) + return -ENOMEM; + diff --git a/sys-devel/distcc/files/distcc-3.4-pump-tests.patch b/sys-devel/distcc/files/distcc-3.4-pump-tests.patch new file mode 100644 index 000000000000..db392b7f3632 --- /dev/null +++ b/sys-devel/distcc/files/distcc-3.4-pump-tests.patch @@ -0,0 +1,153 @@ +https://github.com/distcc/distcc/pull/460 + +From 45d9c4a1ef66451ed45a6afdec7098ed02082390 Mon Sep 17 00:00:00 2001 +From: Rosen Matev <rosen.matev@cern.ch> +Date: Fri, 29 Apr 2022 15:42:28 +0200 +Subject: [PATCH] Fix tests in pump mode + +`make check` is also running tests for the pump mode +(`pump-maintainer-check` target) but they were all falling back to +the usual preprocessor mode as the include server was not started. + +This is solved by prepending `pump` to the distcc invocations and +also some trivially failing tests are fixed or disabled when they +make no sense in pump mode. +--- + Makefile.in | 2 +- + pump.in | 13 +++++++++++-- + test/testdistcc.py | 28 ++++++++++++++++++++++++---- + 3 files changed, 36 insertions(+), 7 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index f240ca6f..79e28380 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -583,7 +583,7 @@ distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj) + # the distcc version, the source location, the CPP flags (for location of the + # includes), and the build location. + include-server: +- if test -z "$(PYTHON)"; then \ ++ @if test -z "$(PYTHON)"; then \ + echo "Not building $@: No suitable python found"; \ + else \ + mkdir -p "$(include_server_builddir)" && \ +diff --git a/pump.in b/pump.in +index 8e46f458..08a32c0e 100755 +--- a/pump.in ++++ b/pump.in +@@ -218,7 +218,9 @@ PrintIncludeServerStatusMessage() { + } + + Announce() { +- echo "__________Using distcc-pump from $DISTCC_LOCATION" ++ if [ "$verbose" = 1 ]; then ++ echo "__________Using distcc-pump from $DISTCC_LOCATION" ++ fi + } + + # Starts up the include server. Sets $socket, $socket_dir, and +@@ -359,7 +361,9 @@ ShutDown() { + # Always -- at exit -- shut down include_server and remove $socket_dir + if [ -n "$include_server_pid" ] && \ + ps -p "$include_server_pid" > /dev/null; then +- echo '__________Shutting down distcc-pump include server' ++ if [ "$verbose" = 1 ]; then ++ echo '__________Shutting down distcc-pump include server' ++ fi + kill $include_server_pid + # Wait until it's really dead. We need to do this because the + # include server may produce output after receiving SIGTERM. +@@ -508,6 +512,11 @@ Main() { + + Initialize + ++ # Do not write on stdout if we're testing pump mode ++ if [ "0$DISTCC_TESTING_INCLUDE_SERVER" -ne "0" ]; then ++ verbose=0 ++ fi ++ + case "$*" in + --startup) + # Don't put ordinary progress messages on stdout, +diff --git a/test/testdistcc.py b/test/testdistcc.py +index dfdf2f13..6377d0b6 100755 +--- a/test/testdistcc.py ++++ b/test/testdistcc.py +@@ -258,7 +258,11 @@ def valgrind(self): + return _valgrind_command; + + def distcc(self): +- return self.valgrind() + "distcc " ++ if "cpp" not in _server_options: ++ return self.valgrind() + "distcc " ++ else: ++ return "DISTCC_TESTING_INCLUDE_SERVER=1 " + self.valgrind() + "pump distcc " ++ + + def distccd(self): + return self.valgrind() + "distccd " +@@ -422,6 +426,11 @@ class BogusOption_Case(SimpleDistCC_Case): + Now that we support implicit compilers, this is passed to gcc, + which returns a non-zero status.""" + def runtest(self): ++ # Disable the test in pump mode since the pump wrapper fails ++ # before we can run distcc. ++ if "cpp" in _server_options: ++ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS') ++ + error_rc, _, _ = self.runcmd_unchecked(self._cc + " --bogus-option") + assert error_rc != 0 + self.runcmd(self.distcc() + self._cc + " --bogus-option", error_rc) +@@ -432,7 +441,7 @@ def runtest(self): + class CompilerOptionsPassed_Case(SimpleDistCC_Case): + """Test that options following the compiler name are passed to the compiler.""" + def runtest(self): +- out, err = self.runcmd("DISTCC_HOSTS=localhost " ++ out, err = self.runcmd("DISTCC_HOSTS=localhost%s " % _server_options + + self.distcc() + + self._cc + " --help") + if re.search('distcc', out): +@@ -1422,7 +1431,8 @@ def source(self): + + def setupEnv(self): + Compilation_Case.setupEnv(self) +- os.environ['DISTCC_HOSTS'] = '127.0.0.1:%d,lzo' % self.server_port ++ os.environ['DISTCC_HOSTS'] = ( ++ '127.0.0.1:%d,lzo' % self.server_port + _server_options) + + class DashONoSpace_Case(CompileHello_Case): + def compileCmd(self): +@@ -1525,6 +1535,11 @@ def source(self): + """ + + def runtest(self): ++ # Disable the test in pump mode since the pump wrapper fails ++ # before we can run distcc. ++ if "cpp" in _server_options: ++ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS') ++ + # -P means not to emit linemarkers + self.runcmd(self.distcc() + + self._cc + " -E testtmp.c -o testtmp.out") +@@ -1828,7 +1843,7 @@ class NoServer_Case(CompileHello_Case): + """Invalid server name""" + def setup(self): + self.stripEnvironment() +- os.environ['DISTCC_HOSTS'] = 'no.such.host.here' ++ os.environ['DISTCC_HOSTS'] = 'no.such.host.here' + _server_options + self.distcc_log = 'distcc.log' + os.environ['DISTCC_LOG'] = self.distcc_log + self.createSource() +@@ -1874,6 +1889,11 @@ class NoHosts_Case(CompileHello_Case): + We expect compilation to succeed, but with a warning that it was + run locally.""" + def runtest(self): ++ # Disable the test in pump mode since the pump wrapper fails ++ # before we can run distcc. ++ if "cpp" in _server_options: ++ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS') ++ + # WithDaemon_Case sets this to point to the local host, but we + # don't want that. Note that you cannot delete environment + # keys in Python1.5, so we need to just set them to the empty + diff --git a/sys-devel/distcc/files/distcc-3.4-rewrite-chost.patch b/sys-devel/distcc/files/distcc-3.4-rewrite-chost.patch new file mode 100644 index 000000000000..05db9691bbbe --- /dev/null +++ b/sys-devel/distcc/files/distcc-3.4-rewrite-chost.patch @@ -0,0 +1,79 @@ +https://bugs.gentoo.org/773652 +https://github.com/distcc/distcc/issues/440 +https://github.com/distcc/distcc/commit/850db9eec0d5dd7f47ade8ffca91b679081f6d85 + +From 850db9eec0d5dd7f47ade8ffca91b679081f6d85 Mon Sep 17 00:00:00 2001 +From: Alexey Sheplyakov <asheplyakov@altlinux.org> +Date: Sun, 11 Jul 2021 18:57:00 +0400 +Subject: [PATCH] Improved cross-rewriting on non-x86 systems + +Unfortunately autoconf and GCC don't agree on the system name: + +- On arm (aarch64): `GNU_HOST` is `aarch64-unknown-linux-gnu`, + and GCC triple is `aarch64-linux-gnu` instead. +- On rpm-based x86_64 distros: `GNU_HOST` is `x86_64-pc-linux-gnu`, + and GCC triple is `x86_64-redhat-linux` + +Therefore ask the compiler (when running distcc configure script) +how to correctly identify it. + +Closes: #440 +ALTBUG: 40425 +--- a/configure.ac ++++ b/configure.ac +@@ -547,6 +547,22 @@ AC_SUBST(CPPFLAGS) + AC_SUBST(POPT_INCLUDES) + AC_SUBST(BUILD_POPT) + AC_SUBST(GNOME_BIN) ++ ++ ++# Sometimes canonical triples as used by configure differ from GCC ones ++# x86: configure: x86_64-pc-linux-gnu, GCC: x86_64-linux-gnu ++# ALT Linux: configure: ${arch}-alt-linux-gnu, GCC: ${arch}-alt-linux ++# Therefore ask the compiler for its triple ++if test "x${GCC}" = xyes ; then ++ native_compiler_triple=`$CC -dumpmachine` ++fi ++if test "x$native_compiler_triple" = "x"; then ++ native_compiler_triple="$host" ++fi ++AC_MSG_NOTICE([Native compiler triple: $native_compiler_triple]) ++ ++AC_DEFINE_UNQUOTED(NATIVE_COMPILER_TRIPLE, ["$native_compiler_triple"], [Native compiler triple]) ++ + AC_DEFINE_UNQUOTED(GNU_HOST, ["$host"], [Your gnu-style host triple]) + # The '.stamp-conf' files force creation of the containing directories in the + # build tree. +--- a/src/compile.c ++++ b/src/compile.c +@@ -549,7 +549,7 @@ static void dcc_rewrite_generic_compiler(char **argv) + static void dcc_add_clang_target(char **argv) + { + /* defined by autoheader */ +- const char *target = GNU_HOST; ++ const char *target = NATIVE_COMPILER_TRIPLE; + + if (strcmp(argv[0], "clang") == 0 || strncmp(argv[0], "clang-", strlen("clang-")) == 0 || + strcmp(argv[0], "clang++") == 0 || strncmp(argv[0], "clang++-", strlen("clang++-")) == 0) +@@ -577,7 +577,7 @@ static void dcc_add_clang_target(char **argv) + static int dcc_gcc_rewrite_fqn(char **argv) + { + /* defined by autoheader */ +- const char *target_with_vendor = GNU_HOST; ++ const char *target_with_vendor = NATIVE_COMPILER_TRIPLE; + char *newcmd, *t, *path; + int pathlen = 0; + int newcmd_len = 0; +@@ -595,11 +595,7 @@ static int dcc_gcc_rewrite_fqn(char **argv) + return -ENOMEM; + memset(newcmd, 0, newcmd_len); + +- if ((t = strstr(target_with_vendor, "-pc-"))) { +- memcpy(newcmd, target_with_vendor, t - target_with_vendor); +- strcat(newcmd, t + strlen("-pc")); +- } else +- strcpy(newcmd, target_with_vendor); ++ strcpy(newcmd, target_with_vendor); + + + strcat(newcmd, "-"); |