Ticket #2982: build_system_new_gcc-4.3.2.2.patch
File build_system_new_gcc-4.3.2.2.patch, 6.7 KB (added by , 15 years ago) |
---|
-
build/scripts/build_cross_tools_gcc4
4 4 5 5 # get and check the parameters 6 6 if [ $# -lt 3 ]; then 7 echo Usage: $0 '<machine> <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]'>&27 echo "\033[1m\E[37;33mUsage: \033[0m$0 '<machine> <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]'" >&2 8 8 exit 1 9 9 fi 10 10 … … 29 29 fi 30 30 31 31 if [ ! -d $haikuSourceDir ]; then 32 echo " No such directory: \"$haikuSourceDir\"" >&232 echo "\033[1m\E[37;31mERROR: \033[0mNo such directory: \"$haikuSourceDir\"" >&2 33 33 exit 1 34 34 fi 35 35 36 36 if [ ! -d $buildToolsDir ]; then 37 echo " No such directory: \"$buildToolsDir\"" >&237 echo "\033[1m\E[37;31mERROR: \033[0mNo such directory: \"$buildToolsDir\"" >&2 38 38 exit 1 39 39 fi 40 40 … … 57 57 cd $haikuOutputDir 58 58 haikuOutputDir=$(pwd) 59 59 60 binutilsSourceDir=$buildToolsDir/binutils 61 gccSourceDir=$buildToolsDir/gcc 60 #binutilsSourceDir=$buildToolsDir/binutils 61 binutilsSourceDir=$buildToolsDir/binutils-2.18 62 gmpSourceDir=$buildToolsDir/gmp-4.2.4 63 mpfrSourceDir=$buildToolsDir/mpfr-2.3.2 64 #gccSourceDir=$buildToolsDir/gcc 65 gccSourceDir=$buildToolsDir/gcc-4.3.2 62 66 63 67 64 68 # get gcc version 65 69 gccVersion=$(cat $gccSourceDir/gcc/BASE-VER) 66 70 67 71 if [ -z "$gccVersion" ]; then 68 echo " Failed to find out gcc version." >&272 echo "\033[1m\E[37;31mERROR: \033[0mFailed to find out gcc version." >&2 69 73 exit 1 70 74 fi 71 75 … … 73 77 # create the object and installation directories for the cross compilation tools 74 78 installDir=$haikuOutputDir/cross-tools 75 79 objDir=$haikuOutputDir/cross-tools-build 80 gmpObjDir=$objDir/gmp 81 mpfrObjDir=$objDir/mpfr 76 82 binutilsObjDir=$objDir/binutils 77 83 gccObjDir=$objDir/gcc 78 84 tmpIncludeDir=$objDir/sysincludes … … 80 86 81 87 rm -rf $installDir $objDir 82 88 83 mkdir -p $installDir $objDir $ binutilsObjDir $gccObjDir $tmpIncludeDir \84 $tmp LibDir|| exit 189 mkdir -p $installDir $objDir $gmpObjDir $mpfrObjDir $binutilsObjDir $gccObjDir \ 90 $tmpIncludeDir $tmpLibDir $installDir/bin || exit 1 85 91 mkdir -p $installDir/lib/gcc/$haikuMachine/$gccVersion 86 92 93 export PATH=$PATH:$installDir/bin 87 94 95 # build gmp 96 cd $gmpObjDir 97 echo "\033[1m\E[37;32mBuilding GMP...\033[0m" 98 CFLAGS="-O2" CXXFLAGS="-O2" $gmpSourceDir/configure \ 99 --prefix=$installDir || exit 1 100 $MAKE || exit 1 101 $MAKE install || exit 1 102 103 # build mpfr 104 cd $mpfrObjDir 105 echo "\033[1m\E[37;32mBuilding MPFR...\033[0m" 106 CFLAGS="-O2" CXXFLAGS="-O2" $mpfrSourceDir/configure \ 107 --prefix=$installDir --with-gmp=$installDir || exit 1 108 $MAKE || exit 1 109 $MAKE install || exit 1 110 88 111 # build binutils 89 112 cd $binutilsObjDir 113 echo "\033[1m\E[37;32mBuilding binutils for target $haikuMachine\033[0m" 90 114 CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \ 91 115 --prefix=$installDir --target=$haikuMachine --disable-nls \ 116 --with-mpfr=$installDir --with-gmp=$installDir \ 92 117 --disable-shared || exit 1 93 118 $MAKE || exit 1 94 119 $MAKE install || exit 1 95 120 96 export PATH=$PATH:$installDir/bin97 98 99 121 # build gcc 100 122 101 123 # prepare the include files … … 118 140 119 141 # configure gcc 120 142 cd $gccObjDir 143 echo "\033[1m\E[37;32mBuilding gcc for target $haikuMachine\033[0m" 121 144 CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \ 122 145 --target=$haikuMachine --disable-nls --disable-shared \ 123 146 --enable-languages=c,c++ --with-headers=$tmpIncludeDir \ 124 --with-libs=$tmpLibDir || exit 1 147 --with-libs=$tmpLibDir --with-gmp=$installDir \ 148 --with-mpfr=$installDir --with-dwarf2 || exit 1 125 149 126 #make gcc150 make gcc 127 151 $MAKE || { 128 echo " ERROR:Building gcc failed." >&2152 echo "\033[1m\E[37;31mERROR: \033[0mBuilding gcc failed." >&2 129 153 exit 1 130 154 } 131 155 132 #install gcc156 install gcc 133 157 $MAKE install || { 134 echo " ERROR:Installing the cross compiler failed." >&2158 echo "\033[1m\E[37;31mERROR: \033[0mInstalling the cross compiler failed." >&2 135 159 exit 1 136 160 } 137 161 … … 142 166 sysIncludeDir=$installDir/$haikuMachine/sys-include 143 167 rm -rf $sysIncludeDir/be $sysIncludeDir/posix 144 168 169 echo "\033[1m\E[37;32mApplying gcc 4.3.2 fixes...\033[0m" 170 # gcc-4.3 fix: 171 # restore {sys}limits.h from gcc new include-fixed dir 172 # into old include 173 174 tmpGccIncludeDir=$installDir/lib/gcc/$haikuMachine/$gccVersion 175 cp $tmpGccIncludeDir/include-fixed/*.h $tmpGccIncludeDir/include 176 177 # gcc-4.3 fix: 178 # this version has a bug with #include_next, simply it includes c++ headers before c headers 179 # so this makes error when including c++ c* headers (cstddef for example), it tryies 180 # to #include_next <stddef}.h> which can't be found due to includes order issue 181 # TODO: remove this ugly hack, when it will be fixed 182 183 fix_include() 184 { 185 headerToFix=$1 186 headerToFixTmp="${headerToFix}.tmp" 187 mv $headerToFix $headerToFixTmp 188 sed s/include_next/include/g < $headerToFixTmp > $headerToFix 189 rm $headerToFixTmp 190 } 191 192 tmpGccIncludeDir=$installDir/$haikuMachine/include/c++/$gccVersion 193 fix_include "$tmpGccIncludeDir/cassert" 194 fix_include "$tmpGccIncludeDir/cctype" 195 fix_include "$tmpGccIncludeDir/cerrno" 196 fix_include "$tmpGccIncludeDir/cfloat" 197 fix_include "$tmpGccIncludeDir/climits" 198 fix_include "$tmpGccIncludeDir/clocale" 199 fix_include "$tmpGccIncludeDir/cmath" 200 fix_include "$tmpGccIncludeDir/csetjmp" 201 fix_include "$tmpGccIncludeDir/csignal" 202 fix_include "$tmpGccIncludeDir/cstdbool" 203 fix_include "$tmpGccIncludeDir/cstdio" 204 fix_include "$tmpGccIncludeDir/cstdlib" 205 fix_include "$tmpGccIncludeDir/cstring" 206 fix_include "$tmpGccIncludeDir/ctime" 207 fix_include "$tmpGccIncludeDir/cwchar" 208 fix_include "$tmpGccIncludeDir/cwctype" 209 145 210 # remove the objects dir 146 211 rm -rf $objDir 147 212 148 149 echo "binutils and gcc for cross compilation have been built successfully!" 213 echo "\033[1m\E[37;32mGMP, MPFR, Binutils and GCC for cross compilation have been built successfully!\033[0m" -
configure
132 132 haikuSharedLibStdCxx=`$HAIKU_CC -print-file-name=libstdc++.so` 133 133 haikuStaticLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.a` 134 134 haikuSharedLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.so` 135 local headers=$gccdir/../../../../include/c++/$haikuGCCVersion 135 # local headers=$gccdir/../../../../include/c++/$haikuGCCVersion 136 local headers=$outputDir/cross-tools/$haikuGCCMachine/include/c++/$haikuGCCVersion 136 137 haikuCxxHeadersDir=$headers 137 138 for d in $haikuGCCMachine backward ext; do 138 139 # Note: We need the line break, otherwise the line might become … … 267 268 buildCrossTools=$3 268 269 buildCrossToolsScript="${buildCrossToolsScript}_gcc4" 269 270 case "$2" in 271 arm) haikuGCCMachine=arm-unknow-haiku;; 270 272 x86) haikuGCCMachine=i586-pc-haiku;; 271 273 ppc) haikuGCCMachine=powerpc-apple-haiku;; 272 274 m68k) haikuGCCMachine=m68k-unknown-haiku;;