Merge #121772: gcc*: do not modify code in prePatch

+49 -50
+9 -9
pkgs/development/compilers/gcc/10/default.nix
··· 103 104 hardeningDisable = [ "format" "pie" ]; 105 106 # This should kill all the stdinc frameworks that gcc and friends like to 107 # insert into default search paths. 108 - prePatch = lib.optionalString hostPlatform.isDarwin '' 109 substituteInPlace gcc/config/darwin-c.c \ 110 --replace 'if (stdinc)' 'if (0)' 111 ··· 114 115 substituteInPlace libgfortran/configure \ 116 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 117 - ''; 118 - 119 - postPatch = '' 120 - configureScripts=$(find . -name configure) 121 - for configureScript in $configureScripts; do 122 - patchShebangs $configureScript 123 - done 124 - '' + ( 125 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 126 # On NixOS, use the right path to the dynamic linker instead of 127 # `/lib/ld*.so'.
··· 103 104 hardeningDisable = [ "format" "pie" ]; 105 106 + postPatch = '' 107 + configureScripts=$(find . -name configure) 108 + for configureScript in $configureScripts; do 109 + patchShebangs $configureScript 110 + done 111 + '' 112 # This should kill all the stdinc frameworks that gcc and friends like to 113 # insert into default search paths. 114 + + lib.optionalString hostPlatform.isDarwin '' 115 substituteInPlace gcc/config/darwin-c.c \ 116 --replace 'if (stdinc)' 'if (0)' 117 ··· 120 121 substituteInPlace libgfortran/configure \ 122 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 123 + '' 124 + + ( 125 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 126 # On NixOS, use the right path to the dynamic linker instead of 127 # `/lib/ld*.so'.
+9 -9
pkgs/development/compilers/gcc/11/default.nix
··· 103 104 hardeningDisable = [ "format" "pie" ]; 105 106 # This should kill all the stdinc frameworks that gcc and friends like to 107 # insert into default search paths. 108 - prePatch = lib.optionalString hostPlatform.isDarwin '' 109 substituteInPlace gcc/config/darwin-c.c \ 110 --replace 'if (stdinc)' 'if (0)' 111 ··· 114 115 substituteInPlace libgfortran/configure \ 116 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 117 - ''; 118 - 119 - postPatch = '' 120 - configureScripts=$(find . -name configure) 121 - for configureScript in $configureScripts; do 122 - patchShebangs $configureScript 123 - done 124 - '' + ( 125 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 126 # On NixOS, use the right path to the dynamic linker instead of 127 # `/lib/ld*.so'.
··· 103 104 hardeningDisable = [ "format" "pie" ]; 105 106 + postPatch = '' 107 + configureScripts=$(find . -name configure) 108 + for configureScript in $configureScripts; do 109 + patchShebangs $configureScript 110 + done 111 + '' 112 # This should kill all the stdinc frameworks that gcc and friends like to 113 # insert into default search paths. 114 + + lib.optionalString hostPlatform.isDarwin '' 115 substituteInPlace gcc/config/darwin-c.c \ 116 --replace 'if (stdinc)' 'if (0)' 117 ··· 120 121 substituteInPlace libgfortran/configure \ 122 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 123 + '' 124 + + ( 125 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 126 # On NixOS, use the right path to the dynamic linker instead of 127 # `/lib/ld*.so'.
+4 -5
pkgs/development/compilers/gcc/6/default.nix
··· 154 155 hardeningDisable = [ "format" "pie" ]; 156 157 - prePatch = 158 # This should kill all the stdinc frameworks that gcc and friends like to 159 # insert into default search paths. 160 lib.optionalString hostPlatform.isDarwin '' ··· 166 167 substituteInPlace libgfortran/configure \ 168 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 169 - ''; 170 - 171 - postPatch = 172 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 173 # On NixOS, use the right path to the dynamic linker instead of 174 # `/lib/ld*.so'. ··· 191 sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' 192 '' 193 ) 194 - else null; 195 196 inherit noSysDirs staticCompiler langJava crossStageStatic 197 libcCross crossMingw;
··· 154 155 hardeningDisable = [ "format" "pie" ]; 156 157 + postPatch = 158 # This should kill all the stdinc frameworks that gcc and friends like to 159 # insert into default search paths. 160 lib.optionalString hostPlatform.isDarwin '' ··· 166 167 substituteInPlace libgfortran/configure \ 168 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 169 + '' 170 + + ( 171 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 172 # On NixOS, use the right path to the dynamic linker instead of 173 # `/lib/ld*.so'. ··· 190 sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' 191 '' 192 ) 193 + else ""); 194 195 inherit noSysDirs staticCompiler langJava crossStageStatic 196 libcCross crossMingw;
+9 -9
pkgs/development/compilers/gcc/7/default.nix
··· 114 115 hardeningDisable = [ "format" "pie" ]; 116 117 # This should kill all the stdinc frameworks that gcc and friends like to 118 # insert into default search paths. 119 - prePatch = lib.optionalString hostPlatform.isDarwin '' 120 substituteInPlace gcc/config/darwin-c.c \ 121 --replace 'if (stdinc)' 'if (0)' 122 ··· 125 126 substituteInPlace libgfortran/configure \ 127 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 128 - ''; 129 - 130 - postPatch = '' 131 - configureScripts=$(find . -name configure) 132 - for configureScript in $configureScripts; do 133 - patchShebangs $configureScript 134 - done 135 - '' + ( 136 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 137 # On NixOS, use the right path to the dynamic linker instead of 138 # `/lib/ld*.so'.
··· 114 115 hardeningDisable = [ "format" "pie" ]; 116 117 + postPatch = '' 118 + configureScripts=$(find . -name configure) 119 + for configureScript in $configureScripts; do 120 + patchShebangs $configureScript 121 + done 122 + '' 123 # This should kill all the stdinc frameworks that gcc and friends like to 124 # insert into default search paths. 125 + + lib.optionalString hostPlatform.isDarwin '' 126 substituteInPlace gcc/config/darwin-c.c \ 127 --replace 'if (stdinc)' 'if (0)' 128 ··· 131 132 substituteInPlace libgfortran/configure \ 133 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 134 + '' 135 + + ( 136 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 137 # On NixOS, use the right path to the dynamic linker instead of 138 # `/lib/ld*.so'.
+9 -9
pkgs/development/compilers/gcc/8/default.nix
··· 101 102 hardeningDisable = [ "format" "pie" ]; 103 104 # This should kill all the stdinc frameworks that gcc and friends like to 105 # insert into default search paths. 106 - prePatch = lib.optionalString hostPlatform.isDarwin '' 107 substituteInPlace gcc/config/darwin-c.c \ 108 --replace 'if (stdinc)' 'if (0)' 109 ··· 112 113 substituteInPlace libgfortran/configure \ 114 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 115 - ''; 116 - 117 - postPatch = '' 118 - configureScripts=$(find . -name configure) 119 - for configureScript in $configureScripts; do 120 - patchShebangs $configureScript 121 - done 122 - '' + ( 123 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 124 # On NixOS, use the right path to the dynamic linker instead of 125 # `/lib/ld*.so'.
··· 101 102 hardeningDisable = [ "format" "pie" ]; 103 104 + postPatch = '' 105 + configureScripts=$(find . -name configure) 106 + for configureScript in $configureScripts; do 107 + patchShebangs $configureScript 108 + done 109 + '' 110 # This should kill all the stdinc frameworks that gcc and friends like to 111 # insert into default search paths. 112 + + lib.optionalString hostPlatform.isDarwin '' 113 substituteInPlace gcc/config/darwin-c.c \ 114 --replace 'if (stdinc)' 'if (0)' 115 ··· 118 119 substituteInPlace libgfortran/configure \ 120 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 121 + '' 122 + + ( 123 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 124 # On NixOS, use the right path to the dynamic linker instead of 125 # `/lib/ld*.so'.
+9 -9
pkgs/development/compilers/gcc/9/default.nix
··· 117 118 hardeningDisable = [ "format" "pie" ]; 119 120 # This should kill all the stdinc frameworks that gcc and friends like to 121 # insert into default search paths. 122 - prePatch = lib.optionalString hostPlatform.isDarwin '' 123 substituteInPlace gcc/config/darwin-c.c \ 124 --replace 'if (stdinc)' 'if (0)' 125 ··· 128 129 substituteInPlace libgfortran/configure \ 130 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 131 - ''; 132 - 133 - postPatch = '' 134 - configureScripts=$(find . -name configure) 135 - for configureScript in $configureScripts; do 136 - patchShebangs $configureScript 137 - done 138 - '' + ( 139 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 140 # On NixOS, use the right path to the dynamic linker instead of 141 # `/lib/ld*.so'.
··· 117 118 hardeningDisable = [ "format" "pie" ]; 119 120 + postPatch = '' 121 + configureScripts=$(find . -name configure) 122 + for configureScript in $configureScripts; do 123 + patchShebangs $configureScript 124 + done 125 + '' 126 # This should kill all the stdinc frameworks that gcc and friends like to 127 # insert into default search paths. 128 + + lib.optionalString hostPlatform.isDarwin '' 129 substituteInPlace gcc/config/darwin-c.c \ 130 --replace 'if (stdinc)' 'if (0)' 131 ··· 134 135 substituteInPlace libgfortran/configure \ 136 --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 137 + '' 138 + + ( 139 if targetPlatform != hostPlatform || stdenv.cc.libc != null then 140 # On NixOS, use the right path to the dynamic linker instead of 141 # `/lib/ld*.so'.