From 56d94c3a719296abace2ace7ad80aa45a95bd86a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Thu, 11 Jul 2019 20:59:50 -0500 Subject: [PATCH] legacy/gcc: Fix cpp cross-tool prefix * Noticed that our gcc2 randomly produces a "cpp" instead of a i586-pc-haiku-cpp * A quick google search turned up a vintage patch for palmos which also fixes this issue: https://github.com/jichu4n/prc-tools-remix/blob/master/prc-tools-2.3/gcc-2.95.3.palmos.diff * Confirmed it fixes the issue, and built a x86_gcc2 image without any issues Change-Id: I33959248f10b69d64a4a9e430a9c254a162bcb53 Reviewed-on: https://review.haiku-os.org/c/1583 Reviewed-by: Alex von Gluck IV Reviewed-by: waddlesplash --- legacy/gcc/gcc/Makefile.in | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/legacy/gcc/gcc/Makefile.in b/legacy/gcc/gcc/Makefile.in index 5f2aef4..5621fe2 100644 --- a/legacy/gcc/gcc/Makefile.in +++ b/legacy/gcc/gcc/Makefile.in @@ -204,7 +204,7 @@ if [ "$(host_canonical)" = "$(target)" ] ; then \ echo ar; \ else \ - t='$(program_transform_name)'; echo ar | sed -e $$t ; \ + t='$(program_transform_cross_name)'; echo ar | sed -e $$t ; \ fi; \ fi` AR_FLAGS_FOR_TARGET = rc @@ -215,7 +215,7 @@ if [ "$(host_canonical)" = "$(target)" ] ; then \ echo ranlib; \ else \ - t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \ + t='$(program_transform_cross_name)'; echo ranlib | sed -e $$t ; \ fi; \ fi` RANLIB_TEST_FOR_TARGET = \ @@ -491,6 +491,7 @@ # Actual name to use when installing a cross-compiler. GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t` +CPP_CROSS_NAME = `t='$(program_transform_cross_name)'; echo cpp | sed -e $$t` PROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo protoize | sed -e $$t` UNPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo unprotoize | sed -e $$t` @@ -2461,17 +2462,28 @@ # Handle cpp installation. install-cpp: cpp$(exeext) - -rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext) - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext) - if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - else true; fi + -if [ -f gcc-cross$(exeext) ] ; then \ + rm -f $(bindir)/$(CPP_CROSS_NAME)$(exeext); \ + $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(bindir)/$(CPP_CROSS_NAME)$(exeext); \ + if [ x$(cpp_install_dir) != x ]; then \ + rm -f $(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ + $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ + else true; fi; \ + else \ + rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext); \ + if [ x$(cpp_install_dir) != x ]; then \ + rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ + else true; fi; \ + fi uninstall-cpp: - -rm -f $(bindir)/cpp + -rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext) + -rm -f $(bindir)/$(CPP_CROSS_NAME)$(exeext) -if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(prefix)/$(cpp_install_dir)/cpp; \ + rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ + rm -f $(prefix)/$(cpp_install_dir)/$(CPP_CROSS_NAME)$(exeext); \ else true; fi # Install float.h for cross compiler. -- gitore 0.2.2