152a38012Sejakowatz#!/bin/sh 252a38012Sejakowatz# 3338b8dc3SIngo Weinhold# configure [ <options> ] 4614026d7Sshatty 5*39d444a3SArvind S Raj# set flag to exit script when exit command is executed 6*39d444a3SArvind S Rajset -e 7*39d444a3SArvind S Raj 8022fa244SIngo Weinhold# usage 9022fa244SIngo Weinhold# 10022fa244SIngo Weinhold# Prints usage. 11022fa244SIngo Weinhold# 12022fa244SIngo Weinholdusage() 13022fa244SIngo Weinhold{ 14022fa244SIngo Weinhold cat << EOF 15022fa244SIngo Weinhold 16022fa244SIngo WeinholdUsage: $0 <options> 17022fa244SIngo Weinholdoptions: 18e173a1ecSIngo Weinhold --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo> 19e173a1ecSIngo Weinhold Prepare for a bootstrap build. No pre-built 20e173a1ecSIngo Weinhold packages will be used, instead they will be built 21e173a1ecSIngo Weinhold from the sources (in several phases). 22e173a1ecSIngo Weinhold <haikuporter> is the path to the haikuporter tool 23e173a1ecSIngo Weinhold suitable for the host platform. 24e173a1ecSIngo Weinhold <HaikuPorts cross repo> is the path to a checked 25e173a1ecSIngo Weinhold out HaikuPorts cross-compilation repository. 26e173a1ecSIngo Weinhold <HaikuPorts repo> is the path to a checked out 27e173a1ecSIngo Weinhold HaikuPorts repository. 28c0e8cc1aSIngo Weinhold --build-cross-tools <arch> [ <build tools dir> ] 29338b8dc3SIngo Weinhold Assume cross compilation. <build tools dir> 30338b8dc3SIngo Weinhold defines the location of the build tools sources. 31338b8dc3SIngo Weinhold They will be compiled and placed in the output 32a5b60fa8SOliver Tappe directory under "cross-tools". The HAIKU_* tools 33a5b60fa8SOliver Tappe variables will be set accordingly. 3420ab75e6SIngo Weinhold <arch> specifies the target architecture, either 351b38c341SAlexander von Gluck IV "x86_gcc2", "x86", "x86_64", "ppc", "m68k", "arm" 36c0e8cc1aSIngo Weinhold This option and --cross-tools-prefix can be 37c0e8cc1aSIngo Weinhold specified multiple times. The first cross tools 38c0e8cc1aSIngo Weinhold specify the primary tools, the subsequent ones the 39c0e8cc1aSIngo Weinhold secondary tools (for "hybrid" images). 40c0e8cc1aSIngo Weinhold For the first --build-cross-tools the 41c0e8cc1aSIngo Weinhold <build tools dir> argument must be specified and 42c0e8cc1aSIngo Weinhold for the subsequent ones it must be omitted. 43eccc7665SIngo Weinhold --cross-tools-prefix <prefix> 44eccc7665SIngo Weinhold Assume cross compilation. <prefix> should be a 45eccc7665SIngo Weinhold path to the directory where the cross 46eccc7665SIngo Weinhold compilation tools are located, plus the platform 470da9c208SIngo Weinhold prefix, e.g. "/path/to/tools/i586-pc-haiku-". 48eccc7665SIngo Weinhold This overrides the HAIKU_* tool variables. 49a66c32ddSIngo Weinhold --distro-compatibility <level> 50a66c32ddSIngo Weinhold The distribution's level of compatibility with 51a66c32ddSIngo Weinhold the official Haiku distribution. The generated 52a66c32ddSIngo Weinhold files will contain the respective trademarks 53a66c32ddSIngo Weinhold accordingly. 54a66c32ddSIngo Weinhold official -- the official Haiku distribution. 55a66c32ddSIngo Weinhold compatible -- a Haiku Compatible (tm) distro. 56a66c32ddSIngo Weinhold default -- any other distro (default value). 5760d8d8fcSIngo Weinhold --enable-multiuser Enable experimental multiuser support. 58eccc7665SIngo Weinhold --help Prints out this help. 592ebcd86dSIngo Weinhold --host-only Configure for building tools for the build host 602ebcd86dSIngo Weinhold only. Haiku cannot be built when configured like 612ebcd86dSIngo Weinhold this. 62eccc7665SIngo Weinhold --include-gpl-addons Include GPL licensed add-ons. 6367838392SAxel Dörfler --include-patented-code Enable code that is known to implemented patented 6467838392SAxel Dörfler ideas and techniques. If this option is not 6567838392SAxel Dörfler specified, the resulting distribution may still 6667838392SAxel Dörfler implement patented ideas and techniques. This 6767838392SAxel Dörfler option only disables code that is currently known 6867838392SAxel Dörfler to be problematic. 6976fa0be3SIngo Weinhold --include-sources Includes the source code of projects that require 7076fa0be3SIngo Weinhold either an offer of source code or a copy of the 7176fa0be3SIngo Weinhold patched sources. This is preferable when 7276fa0be3SIngo Weinhold distributing on physical mediums. 731974210fSFrançois Revol --include-3rdparty Include 3rdparty/ in the build system. 7460d8d8fcSIngo Weinhold -j<n> Only relevant for --build-cross-tools and 7560d8d8fcSIngo Weinhold --build-cross-tools-gcc4. Is passed on to the 7660d8d8fcSIngo Weinhold make building the build tools. 7786d7e283SOliver Tappe --remote-user <username> Use given username when logging into 7886d7e283SOliver Tappe git.haiku-os.org (via ssh). 797c4641d0SOliver Tappe --target=TARGET Select build target platform. 807c4641d0SOliver Tappe [default=${TARGET_PLATFORM}] 81a17b9c0cSshatty valid targets=r5,bone,dano,haiku 82483b28e4SIngo Weinhold --target-arch <arch> Haiku only: Specify the target architecture to 83483b28e4SIngo Weinhold build for. Must be one of the architectures of the 84483b28e4SIngo Weinhold host system. The installed build tools for that 85483b28e4SIngo Weinhold architecture will be used. 86483b28e4SIngo Weinhold This option can be specified multiple times. The 87483b28e4SIngo Weinhold first occurrence specifies the primary 88483b28e4SIngo Weinhold architecture of the Haiku to build, subsequent 89483b28e4SIngo Weinhold ones the secondary architectures. 90e70c4c64SPulkoMandy --target-board <board> ARM only: Specify the board to build for. Must be 91e70c4c64SPulkoMandy one of beagle,pi,verdex. 927c4641d0SOliver Tappe --update re-runs last configure invocation [must be given 937c4641d0SOliver Tappe as first option!] 94c2b76f7fSJonathan Schleifer --use-clang Build with host Clang instead of GCC cross 95c2b76f7fSJonathan Schleifer compiler 96eccc7665SIngo Weinhold --use-gcc-pipe Build with GCC option -pipe. Speeds up the build 975a34a443SFrançois Revol process, but uses more memory. 98ed38d2efSJerome Duval --use-gcc-graphite Build with GCC Graphite engine for loop 99ed38d2efSJerome Duval optimizations. Only for gcc 4. 1000385b065SIngo Weinhold --use-32bit Use -m32 flag on 64bit host gcc compiler. 101bc96e8f3SIngo Weinhold --use-xattr Use Linux xattr respectively *BSD extattr support 102bc96e8f3SIngo Weinhold for BeOS attribute emulation. Warning: Make sure 103bc96e8f3SIngo Weinhold your file system supports sufficient attribute 104bc96e8f3SIngo Weinhold sizes (4 KB per file for all attributes won't 105bc96e8f3SIngo Weinhold suffice). 106bc96e8f3SIngo Weinhold --use-xattr-ref Use the generic BeOS attribute emulation, but use 107bc96e8f3SIngo Weinhold Linux xattr respectively *BSD extattr support to 108bc96e8f3SIngo Weinhold make it more robust (i.e. attribute mix-ups become 109bc96e8f3SIngo Weinhold less likely). 110338b8dc3SIngo Weinhold 111338b8dc3SIngo Weinholdenvironment variables: 112c0e8cc1aSIngo Weinhold HAIKU_AR_x86_gcc2 The static library archiver for x86_gcc2. 113c0e8cc1aSIngo Weinhold Defaults to "ar". 114c0e8cc1aSIngo Weinhold HAIKU_CC_x86_gcc2 The x86_gcc2 compiler. Defaults to "gcc". 115c0e8cc1aSIngo Weinhold HAIKU_LD_x86_gcc2 The x86_gcc2 linker. Defaults to "ld". 116c0e8cc1aSIngo Weinhold HAIKU_OBJCOPY_x86_gcc2 The x86_gcc2 objcopy to be used. Defaults to 117c0e8cc1aSIngo Weinhold "objcopy". 118c0e8cc1aSIngo Weinhold HAIKU_RANLIB_x86_gcc2 The static library indexer for x86_gcc2. Defaults 119c0e8cc1aSIngo Weinhold to "ranlib". 120c0e8cc1aSIngo Weinhold HAIKU_STRIP_x86_gcc2 The x86_gcc2 strip command. Defaults to "strip". 121a04a520bSJonathan Schleifer HAIKU_NASM The nasm assembler (x86 and x86_64 only). 122c0e8cc1aSIngo Weinhold HAIKU_CPPFLAGS_<arch> The preprocessor flags for target architecture 123c0e8cc1aSIngo Weinhold <arch>. Defaults to "". 124c0e8cc1aSIngo Weinhold HAIKU_CCFLAGS_<arch> The C flags for target architecture <arch>. 125c0e8cc1aSIngo Weinhold Defaults to "". 126c0e8cc1aSIngo Weinhold HAIKU_CXXFLAGS_<arch> The C++ flags for target architecture <arch>. 127c0e8cc1aSIngo Weinhold Defaults to "". 128c0e8cc1aSIngo Weinhold HAIKU_LDFLAGS_<arch> The linker flags for target architecture <arch>. 129c0e8cc1aSIngo Weinhold Defaults to "". 130c0e8cc1aSIngo Weinhold HAIKU_ARFLAGS_<arch> The flags passed to HAIKU_AR for target 131c0e8cc1aSIngo Weinhold architecture <arch> for archiving. Defaults to 132c0e8cc1aSIngo Weinhold "cru". 133c0e8cc1aSIngo Weinhold HAIKU_UNARFLAGS_<arch> The flags passed to HAIKU_AR for target 134c0e8cc1aSIngo Weinhold architecture <arch> for unarchiving. Defaults to 135c0e8cc1aSIngo Weinhold "x". 13664f6da31SIngo Weinhold 137c0e8cc1aSIngo WeinholdNon-default output directories: 13864f6da31SIngo Weinhold By default all objects, build configuration, and other related files are 13964f6da31SIngo Weinhold stored in /path/to/haiku_source/generated. To store objects in a non-default 14064f6da31SIngo Weinhold location, run "../../relative/path/to/haiku_source/configure <options>" from 14164f6da31SIngo Weinhold within your non-default location. "jam [ options ] targets" can then be run 14264f6da31SIngo Weinhold directly inside your non-default location. Another option is to invoke "jam 14364f6da31SIngo Weinhold [ options ] targets" from within haiku_source. This can be accomplished by 14464f6da31SIngo Weinhold either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking 14564f6da31SIngo Weinhold jam or by creating a symlink of haiku_source/generated pointing to your 14664f6da31SIngo Weinhold non-default location and running jam. 14764f6da31SIngo Weinhold 14864f6da31SIngo Weinhold 149022fa244SIngo WeinholdEOF 150022fa244SIngo Weinhold} 151022fa244SIngo Weinhold 152022fa244SIngo Weinhold# assertparam 153022fa244SIngo Weinhold# 154022fa244SIngo Weinhold# Checks whether at least one parameter is left. 155022fa244SIngo Weinhold# 156022fa244SIngo Weinholdassertparam() 157022fa244SIngo Weinhold{ 15820ab75e6SIngo Weinhold if [ $2 -lt 2 ]; then 159022fa244SIngo Weinhold echo $0: \`$1\': Parameter expected. 160022fa244SIngo Weinhold exit 1 161022fa244SIngo Weinhold fi 162022fa244SIngo Weinhold} 163022fa244SIngo Weinhold 16420ab75e6SIngo Weinhold# assertparams 16520ab75e6SIngo Weinhold# 16620ab75e6SIngo Weinhold# Checks whether at least a certain number of parameters is left. 16720ab75e6SIngo Weinhold# 16820ab75e6SIngo Weinholdassertparams() 16920ab75e6SIngo Weinhold{ 17020ab75e6SIngo Weinhold if [ $3 -le $2 ]; then 17120ab75e6SIngo Weinhold echo $0: \`$1\': Not enough parameters. 17220ab75e6SIngo Weinhold exit 1 17320ab75e6SIngo Weinhold fi 17420ab75e6SIngo Weinhold} 17520ab75e6SIngo Weinhold 176e173a1ecSIngo Weinhold# absolute_path 177e173a1ecSIngo Weinhold# 178e173a1ecSIngo Weinhold# returns the absolute path of a given path. 179e173a1ecSIngo Weinhold# 180e173a1ecSIngo Weinholdabsolute_path() 181e173a1ecSIngo Weinhold{ 1826a4f3954SFrançois Revol if [ "x$1" != "x${1#/}" ]; then 183e173a1ecSIngo Weinhold echo "$1" 184e173a1ecSIngo Weinhold else 185e173a1ecSIngo Weinhold echo "`pwd`/$1" 186e173a1ecSIngo Weinhold fi 187e173a1ecSIngo Weinhold} 188e173a1ecSIngo Weinhold 189*39d444a3SArvind S Raj# check_dir_exists 190*39d444a3SArvind S Raj# 191*39d444a3SArvind S Raj# check if a directory exists or not 192*39d444a3SArvind S Raj# 193*39d444a3SArvind S Rajcheck_dir_exists() 194*39d444a3SArvind S Raj{ 195*39d444a3SArvind S Raj if [ -d "$1" ]; then 196*39d444a3SArvind S Raj return 0 197*39d444a3SArvind S Raj else 198*39d444a3SArvind S Raj return 1 199*39d444a3SArvind S Raj fi 200*39d444a3SArvind S Raj} 201*39d444a3SArvind S Raj 2029a001156SOliver Tappe# real_path 2039a001156SOliver Tappe# 2049a001156SOliver Tappe# returns the realpath of a symbolic link. 2059a001156SOliver Tappe# 2069a001156SOliver Tappereal_path() 2079a001156SOliver Tappe{ 2089a001156SOliver Tappe perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1" 2099a001156SOliver Tappe} 2109a001156SOliver Tappe 21109c5682dSIngo Weinhold# standard_gcc_settings 21209c5682dSIngo Weinhold# 21309c5682dSIngo Weinhold# Sets the variables for a GCC platform. 21409c5682dSIngo Weinhold# 21509c5682dSIngo Weinholdstandard_gcc_settings() 21609c5682dSIngo Weinhold{ 217c0e8cc1aSIngo Weinhold local gcc=$1 218c0e8cc1aSIngo Weinhold 219138f5fb4SIngo Weinhold if which greadlink > /dev/null 2>&1; then 220b29b48b1SMatt Madia readlink="greadlink -e" 221138f5fb4SIngo Weinhold elif which realpath > /dev/null 2>&1; then 222b29b48b1SMatt Madia readlink=realpath 2239a001156SOliver Tappe elif readlink -e / > /dev/null 2>&1; then 224b29b48b1SMatt Madia readlink="readlink -e" 2259a001156SOliver Tappe else 2269a001156SOliver Tappe readlink=real_path 227b4b6d83cSMatt Madia fi 228138f5fb4SIngo Weinhold 22909c5682dSIngo Weinhold # PLATFORM_LINKLIBS 230c0e8cc1aSIngo Weinhold local gcclib=`$gcc -print-libgcc-file-name` 231c0e8cc1aSIngo Weinhold local gccdir=`dirname ${gcclib}` 2325b0f7b1bSOliver Tappe 233c0e8cc1aSIngo Weinhold local gccRawVersion=`$gcc -dumpversion` 234c0e8cc1aSIngo Weinhold local gccMachine=`$gcc -dumpmachine` 235338b8dc3SIngo Weinhold 236c0e8cc1aSIngo Weinhold local libgcc=${gccdir}/libgcc.a 2378b5934c9SIngo Weinhold 238fc8967f1SIngo Weinhold # determine architecture from machine triple 239c0e8cc1aSIngo Weinhold case $gccMachine in 240c0e8cc1aSIngo Weinhold arm-*) targetCpu=arm;; 241c0e8cc1aSIngo Weinhold i?86-*) targetCpu=x86;; 242c0e8cc1aSIngo Weinhold m68k-*) targetCpu=m68k;; 243c0e8cc1aSIngo Weinhold powerpc-*) targetCpu=ppc;; 244c0e8cc1aSIngo Weinhold x86_64-*) targetCpu=x86_64;; 245fc8967f1SIngo Weinhold *) 246c0e8cc1aSIngo Weinhold echo "Unsupported gcc target machine: $gccMachine" >&2 247fc8967f1SIngo Weinhold exit 1 248fc8967f1SIngo Weinhold ;; 249fc8967f1SIngo Weinhold esac 250fc8967f1SIngo Weinhold 251c0e8cc1aSIngo Weinhold local targetArch=$targetCpu 252c0e8cc1aSIngo Weinhold local staticLibStdCxx 253c0e8cc1aSIngo Weinhold local sharedLibStdCxx 254c0e8cc1aSIngo Weinhold local staticLibSupCxx 255c0e8cc1aSIngo Weinhold local sharedLibSupCxx 256c0e8cc1aSIngo Weinhold local kernelLibgcc 257c0e8cc1aSIngo Weinhold local cxxHeaders 258fc8967f1SIngo Weinhold 259c0e8cc1aSIngo Weinhold case $gccRawVersion in 2608b5934c9SIngo Weinhold 4.*) 2615b0f7b1bSOliver Tappe # for gcc 4 we use the libstdc++ and libsupc++ that come with the 2625b0f7b1bSOliver Tappe # compiler 263c0e8cc1aSIngo Weinhold staticLibStdCxx=`$gcc -print-file-name=libstdc++.a` 264c0e8cc1aSIngo Weinhold sharedLibStdCxx=`$gcc -print-file-name=libstdc++.so` 265c0e8cc1aSIngo Weinhold staticLibSupCxx=`$gcc -print-file-name=libsupc++.a` 266c0e8cc1aSIngo Weinhold sharedLibSupCxx=`$gcc -print-file-name=libsupc++.so` 26714210488SMichael Lotz 268aaeadfcbSAlex Smith # If the architecture has separate runtime libraries for the 269aaeadfcbSAlex Smith # kernel, use them. 270c0e8cc1aSIngo Weinhold kernelLibgcc=`$gcc -print-file-name=libgcc-kernel.a` 271c0e8cc1aSIngo Weinhold if [ $kernelLibgcc = libgcc-kernel.a ]; then 272c0e8cc1aSIngo Weinhold kernelLibgcc=$libgcc 273aaeadfcbSAlex Smith fi 274c0e8cc1aSIngo Weinhold kernelLibSupCxx=`$gcc -print-file-name=libsupc++-kernel.a` 275c0e8cc1aSIngo Weinhold if [ $kernelLibSupCxx = libsupc++-kernel.a ]; then 276c0e8cc1aSIngo Weinhold kernelLibSupCxx=$staticLibSupCxx 277aaeadfcbSAlex Smith fi 278aaeadfcbSAlex Smith 279c0e8cc1aSIngo Weinhold local headersBase=$gccdir/../../../.. 280c0e8cc1aSIngo Weinhold local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion 281c0e8cc1aSIngo Weinhold if [ ! -d $headers ]; then 282c0e8cc1aSIngo Weinhold headers=$headersBase/include/c++/$gccRawVersion 28314210488SMichael Lotz fi 28414210488SMichael Lotz 285c0e8cc1aSIngo Weinhold cxxHeaders=$headers 286c0e8cc1aSIngo Weinhold for d in $gccMachine backward ext; do 28729ef597dSIngo Weinhold # Note: We need the line break, otherwise the line might become 28829ef597dSIngo Weinhold # too long for jam (512 bytes max). 289c0e8cc1aSIngo Weinhold cxxHeaders="$cxxHeaders $headers/$d" 2908b5934c9SIngo Weinhold done 291274b450aSMarcus Overhagen 2923f9f9f9aSIngo Weinhold # Unset the HAIKU_{SHARED,STATIC}_LIB{STD,SUP}CXX variables, if the 2933f9f9f9aSIngo Weinhold # compiler didn't give us actual file names. Otherwise resolve 2943f9f9f9aSIngo Weinhold # symlinks to avoid problems when copying the libraries to the 2953f9f9f9aSIngo Weinhold # image. 2968b5934c9SIngo Weinhold 297c0e8cc1aSIngo Weinhold if [ $staticLibStdCxx = libstdc++.a ]; then 298c0e8cc1aSIngo Weinhold staticLibStdCxx= 2993f9f9f9aSIngo Weinhold else 300c0e8cc1aSIngo Weinhold staticLibStdCxx=`$readlink $staticLibStdCxx` 3018b5934c9SIngo Weinhold fi 3023f9f9f9aSIngo Weinhold 303c0e8cc1aSIngo Weinhold if [ $sharedLibStdCxx = libstdc++.so ]; then 304c0e8cc1aSIngo Weinhold sharedLibStdCxx= 3053f9f9f9aSIngo Weinhold else 306c0e8cc1aSIngo Weinhold sharedLibStdCxx=`$readlink $sharedLibStdCxx` 307ffe8b20cSIngo Weinhold fi 3083f9f9f9aSIngo Weinhold 309c0e8cc1aSIngo Weinhold if [ $staticLibSupCxx = libsupc++.a ]; then 310c0e8cc1aSIngo Weinhold staticLibSupCxx= 3113f9f9f9aSIngo Weinhold else 312c0e8cc1aSIngo Weinhold staticLibSupCxx=`$readlink $staticLibSupCxx` 313c89fc875SIngo Weinhold fi 3143f9f9f9aSIngo Weinhold 315c0e8cc1aSIngo Weinhold if [ $sharedLibSupCxx = libsupc++.so ]; then 316c0e8cc1aSIngo Weinhold sharedLibSupCxx= 3173f9f9f9aSIngo Weinhold else 318c0e8cc1aSIngo Weinhold sharedLibSupCxx=`$readlink $sharedLibSupCxx` 319ffe8b20cSIngo Weinhold fi 3208b5934c9SIngo Weinhold ;; 3216cc8eecfSOliver Tappe 2.9*) 3225b0f7b1bSOliver Tappe # check for correct (most up-to-date) legacy compiler and complain 3235b0f7b1bSOliver Tappe # if an older one is installed 324c0e8cc1aSIngo Weinhold if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then 3255b0f7b1bSOliver Tappe echo "GCC version $haikuRequiredLegacyGCCVersion is required!"; 3265b0f7b1bSOliver Tappe echo "Please download it from www.haiku-os.org..."; 3275b0f7b1bSOliver Tappe exit 1; 3285b0f7b1bSOliver Tappe fi 329aaeadfcbSAlex Smith 330c0e8cc1aSIngo Weinhold kernelLibgcc=$libgcc 331c0e8cc1aSIngo Weinhold kernelLibSupCxx= 332c0e8cc1aSIngo Weinhold targetArch=x86_gcc2 3335b0f7b1bSOliver Tappe ;; 3348b5934c9SIngo Weinhold esac 33565ad1ba3SAlex Smith 336c0e8cc1aSIngo Weinhold local bootLibgcc 337c0e8cc1aSIngo Weinhold local bootLibSupCxx 33866a7f29fSJérôme Duval local bootCxxHeaders 339c0e8cc1aSIngo Weinhold case $gccMachine in 3404591ebc9SAlex Smith x86_64-*) 34166a7f29fSJérôme Duval # Boot loader is 32-bit, need the 32-bit libs and c++ config 342c0e8cc1aSIngo Weinhold bootLibgcc=`$gcc -m32 -print-libgcc-file-name` 343c0e8cc1aSIngo Weinhold bootLibSupCxx=`$gcc -m32 -print-file-name=libsupc++.a` 34466a7f29fSJérôme Duval 34566a7f29fSJérôme Duval local headersBase=$gccdir/../../../.. 34666a7f29fSJérôme Duval local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion 34766a7f29fSJérôme Duval if [ ! -d $headers ]; then 34866a7f29fSJérôme Duval headers=$headersBase/include/c++/$gccRawVersion 34966a7f29fSJérôme Duval fi 35066a7f29fSJérôme Duval bootCxxHeaders="$headers/$gccMachine/32" 3514591ebc9SAlex Smith ;; 3524591ebc9SAlex Smith *) 353c0e8cc1aSIngo Weinhold bootLibgcc=$libgcc 354c0e8cc1aSIngo Weinhold bootLibSupCxx=$staticLibSupCxx 355338b8dc3SIngo Weinhold ;; 356338b8dc3SIngo Weinhold esac 357c0e8cc1aSIngo Weinhold 358c0e8cc1aSIngo Weinhold # determine whether graphite loop optimization should/can be used 359c0e8cc1aSIngo Weinhold local useGraphite=`get_variable HAIKU_USE_GCC_GRAPHITE_$targetCpu` 360c0e8cc1aSIngo Weinhold if [ -z "$useGraphite" ]; then 361c0e8cc1aSIngo Weinhold useGraphite=$useGccGraphiteDefault 362c0e8cc1aSIngo Weinhold fi 363c0e8cc1aSIngo Weinhold 364c0e8cc1aSIngo Weinhold if [ "$useGraphite" != 0 ]; then 365c0e8cc1aSIngo Weinhold UNUSED=`echo "int main() {}" | $gcc -xc -c -floop-block - 2>&1` 366c0e8cc1aSIngo Weinhold if [ $? != 0 ]; then 367c0e8cc1aSIngo Weinhold echo "GCC Graphite loop optimizations cannot be used on $targetArch" 368c0e8cc1aSIngo Weinhold useGraphite=0 369c0e8cc1aSIngo Weinhold fi 370c0e8cc1aSIngo Weinhold fi 371c0e8cc1aSIngo Weinhold 372c0e8cc1aSIngo Weinhold set_variable HAIKU_CPU_$targetArch $targetCpu 373c0e8cc1aSIngo Weinhold 374c0e8cc1aSIngo Weinhold get_build_tool_path CC_$targetArch "$gcc" 375c2b76f7fSJonathan Schleifer if [ $useClang = 1 ]; then 376c2b76f7fSJonathan Schleifer # The get_build_tool_path above is needed to get the path to the rest 377c2b76f7fSJonathan Schleifer # of the build tools 378c2b76f7fSJonathan Schleifer local path=`dirname $(get_variable HAIKU_CC_$targetArch)` 379c2b76f7fSJonathan Schleifer set_variable HAIKU_CC_$targetArch \ 380c2b76f7fSJonathan Schleifer "PATH=\\\"$path:\\\$PATH\\\" clang -target $gccMachine" 381c2b76f7fSJonathan Schleifer set_variable HAIKU_CC_IS_CLANG_$targetArch 1 382c2b76f7fSJonathan Schleifer else 383c2b76f7fSJonathan Schleifer set_variable HAIKU_CC_IS_CLANG_$targetArch 0 384c2b76f7fSJonathan Schleifer fi 385c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_RAW_VERSION_$targetArch $gccRawVersion 386c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine 387c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir 388c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_LIBGCC_$targetArch $libgcc 389c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_GLUE_CODE_$targetArch "crtbegin.o crtend.o" 390c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_HEADERS_DIR_$targetArch \ 391c0e8cc1aSIngo Weinhold "${gccdir}/include ${gccdir}/include-fixed" 392c0e8cc1aSIngo Weinhold set_variable HAIKU_STATIC_LIBSTDCXX_$targetArch "$staticLibStdCxx" 393c0e8cc1aSIngo Weinhold set_variable HAIKU_SHARED_LIBSTDCXX_$targetArch "$sharedLibStdCxx" 394c0e8cc1aSIngo Weinhold set_variable HAIKU_STATIC_LIBSUPCXX_$targetArch "$staticLibSupCxx" 395c0e8cc1aSIngo Weinhold set_variable HAIKU_SHARED_LIBSUPCXX_$targetArch "$sharedLibSupCxx" 396c0e8cc1aSIngo Weinhold set_variable HAIKU_KERNEL_LIBSUPCXX_$targetArch "$kernelLibSupCxx" 397c0e8cc1aSIngo Weinhold set_variable HAIKU_BOOT_LIBSUPCXX_$targetArch "$bootLibSupCxx" 398c0e8cc1aSIngo Weinhold set_variable HAIKU_KERNEL_LIBGCC_$targetArch $kernelLibgcc 399c0e8cc1aSIngo Weinhold set_variable HAIKU_CXX_HEADERS_DIR_$targetArch "$cxxHeaders" 400c0e8cc1aSIngo Weinhold set_variable HAIKU_BOOT_LIBGCC_$targetArch $bootLibgcc 40166a7f29fSJérôme Duval set_variable HAIKU_BOOT_CXX_HEADERS_DIR_$targetArch "$bootCxxHeaders" 402c0e8cc1aSIngo Weinhold set_variable HAIKU_USE_GCC_GRAPHITE_$targetArch $useGraphite 403c0e8cc1aSIngo Weinhold 404c0e8cc1aSIngo Weinhold standard_gcc_settings_targetArch=$targetArch 405c0e8cc1aSIngo Weinhold} 406c0e8cc1aSIngo Weinhold 407c0e8cc1aSIngo Weinhold# set_variable 408c0e8cc1aSIngo Weinhold# 409c0e8cc1aSIngo Weinhold# Set the value of a variable. 410c0e8cc1aSIngo Weinhold# 411c0e8cc1aSIngo Weinholdset_variable() 412c0e8cc1aSIngo Weinhold{ 413c0e8cc1aSIngo Weinhold eval "$1=\"$2\"" 414c0e8cc1aSIngo Weinhold} 415c0e8cc1aSIngo Weinhold 416c0e8cc1aSIngo Weinhold# get_variable 417c0e8cc1aSIngo Weinhold# 418c0e8cc1aSIngo Weinhold# Echo the value of a variable. 419c0e8cc1aSIngo Weinhold# 420c0e8cc1aSIngo Weinholdget_variable() 421c0e8cc1aSIngo Weinhold{ 422c0e8cc1aSIngo Weinhold eval "echo \${$1}" 42309c5682dSIngo Weinhold} 42409c5682dSIngo Weinhold 425338b8dc3SIngo Weinhold# set_default_value 426338b8dc3SIngo Weinhold# 427338b8dc3SIngo Weinhold# Set the value for a variable, if no value is set yet. 428338b8dc3SIngo Weinhold# 429338b8dc3SIngo Weinholdset_default_value() 430338b8dc3SIngo Weinhold{ 431338b8dc3SIngo Weinhold eval "$1=\${$1-$2}" 432338b8dc3SIngo Weinhold} 433338b8dc3SIngo Weinhold 434338b8dc3SIngo Weinhold# get_build_tool_path 435338b8dc3SIngo Weinhold# 436338b8dc3SIngo Weinhold# Gets a usable absolute path of a build tool. 437338b8dc3SIngo Weinhold# 438338b8dc3SIngo Weinholdget_build_tool_path() 439338b8dc3SIngo Weinhold{ 440338b8dc3SIngo Weinhold local var="HAIKU_$1" 441c0e8cc1aSIngo Weinhold local path=$2 442338b8dc3SIngo Weinhold 443338b8dc3SIngo Weinhold if [ -f "$path" ]; then 444338b8dc3SIngo Weinhold # get absolute path 445a559f87aSFrançois Revol local oldPwd="`pwd`" 446a559f87aSFrançois Revol cd "`dirname "$path"`" 447a559f87aSFrançois Revol path="`pwd`/`basename "$path"`" 448338b8dc3SIngo Weinhold cd $oldPwd 449338b8dc3SIngo Weinhold else 4507fe2e06cSMatt Madia which "$path" > /dev/null 2>&1 || { 451338b8dc3SIngo Weinhold echo "Build tool \"$path\" not found." >&2 452338b8dc3SIngo Weinhold exit 1 453338b8dc3SIngo Weinhold } 454338b8dc3SIngo Weinhold fi 455338b8dc3SIngo Weinhold 456338b8dc3SIngo Weinhold eval "$var=$path" 457338b8dc3SIngo Weinhold} 458338b8dc3SIngo Weinhold 459483b28e4SIngo Weinholdis_in_list() 460483b28e4SIngo Weinhold{ 461483b28e4SIngo Weinhold local element 462483b28e4SIngo Weinhold for element in $2; do 463483b28e4SIngo Weinhold if [ "$1" = "$element" ]; then 464483b28e4SIngo Weinhold return 0 465483b28e4SIngo Weinhold fi 466483b28e4SIngo Weinhold done 467483b28e4SIngo Weinhold return 1 468483b28e4SIngo Weinhold} 469483b28e4SIngo Weinhold 470338b8dc3SIngo Weinhold# get cwd and the source directory 471338b8dc3SIngo WeinholdcurrentDir=`pwd` 4726e7c6fe5SIngo Weinholdcd `dirname "$0"` 473338b8dc3SIngo WeinholdsourceDir=`pwd` 4746e7c6fe5SIngo Weinholdcd "$currentDir" 475338b8dc3SIngo Weinhold 47655d267a4SFrançois Revol# backup the passed arguments 47755d267a4SFrançois RevolconfigureArgs="$@" 47855d267a4SFrançois Revol 4797c4641d0SOliver Tappe# internal default parameter values 480022fa244SIngo Weinhold# 48152a38012Sejakowatzplatform=`uname` 4825abd9a46SIngo WeinholdplatformMachine=`uname -m` 483c0e8cc1aSIngo WeinholdtargetArchs= 484338b8dc3SIngo WeinholdbuildCrossTools= 48529ef597dSIngo WeinholdbuildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools" 48660d8d8fcSIngo WeinholdbuildCrossToolsJobs= 487c2b76f7fSJonathan SchleiferuseClang=0 488c0e8cc1aSIngo WeinholduseGccGraphiteDefault=0 489c0e8cc1aSIngo WeinholdunknownArchIndex=1 490483b28e4SIngo WeinholdhaikuTargetArchs= 4917c4641d0SOliver Tappe 4927c4641d0SOliver Tappe# exported (BuildSetup) default parameter values 4937c4641d0SOliver Tappe# 4947c4641d0SOliver TappeHOST_GCC_RAW_VERSION=`gcc -dumpversion` 4957c4641d0SOliver TappeHOST_GCC_MACHINE=`gcc -dumpmachine` 4967c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS=0 4977c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE=0 49876fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES=0 4997c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY=0 5007c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER=0 5017c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY=default 5027c4641d0SOliver TappeTARGET_PLATFORM=haiku 5037c4641d0SOliver TappeHAIKU_USE_GCC_PIPE=0 5047986925fSIngo WeinholdHAIKU_HOST_USE_32BIT=0 5057986925fSIngo WeinholdHAIKU_HOST_USE_XATTR=0 506bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF=0 5072ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY=0 508f04f7042SNiels Sascha ReedijkHOST_EXTENDED_REGEX_SED="sed -r" 5097c4641d0SOliver TappeHOST_GCC_LD=`gcc -print-prog-name=ld` 5107c4641d0SOliver TappeHOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy` 511c505b276SFrançois RevolSFDISK_BINARY=sfdisk 512c505b276SFrançois RevolHOST_SFDISK=$SFDISK_BINARY 5132a5d0aafSIngo WeinholdHOST_SHA256= 514e173a1ecSIngo WeinholdHOST_HAIKU_PORTER= 515e173a1ecSIngo WeinholdHAIKU_PORTS= 516e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS= 517e70c4c64SPulkoMandyHAIKU_BOOT_BOARD= 5182a5d0aafSIngo Weinhold 519c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCHS= 520c0e8cc1aSIngo Weinhold 521a04a520bSJonathan Schleiferset_default_value HAIKU_NASM nasm 522c0e8cc1aSIngo Weinhold 5233942ca0dSIngo Weinholdif sha256sum < /dev/null > /dev/null 2>&1; then 5242a5d0aafSIngo Weinhold HOST_SHA256=sha256sum 5253942ca0dSIngo Weinholdelif sha256 < /dev/null > /dev/null 2>&1; then 5262a5d0aafSIngo Weinhold HOST_SHA256="sha256 -q" 527b5a871b1SNiels Sascha Reedijkelif shasum < /dev/null > /dev/null 2>&1; then 528b5a871b1SNiels Sascha Reedijk HOST_SHA256="shasum -a 256" 5292a5d0aafSIngo Weinholdelse 5302a5d0aafSIngo Weinhold echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2 5312a5d0aafSIngo Weinhold exit 1 5322a5d0aafSIngo Weinholdfi 533338b8dc3SIngo Weinhold 534cc91b333SIngo WeinholdhaikuRequiredLegacyGCCVersion="2.95.3-haiku-2013_08_15" 535a559f87aSFrançois Revolexport haikuRequiredLegacyGCCVersion 536af4bf973SOliver Tappe # version of legacy gcc required to build haiku 537483b28e4SIngo WeinholdsupportedTargetArchs=" 538483b28e4SIngo Weinhold arm 539483b28e4SIngo Weinhold m68k 540483b28e4SIngo Weinhold ppc 541483b28e4SIngo Weinhold x86 542483b28e4SIngo Weinhold x86_64 543483b28e4SIngo Weinhold x86_gcc2 544483b28e4SIngo Weinhold " 545e70c4c64SPulkoMandysupportedTargetBoards=" 546e70c4c64SPulkoMandy beagle 547e70c4c64SPulkoMandy pi 548e70c4c64SPulkoMandy verdex 549e70c4c64SPulkoMandy " 550af4bf973SOliver Tappe 5517c4641d0SOliver Tappe# determine output directory 5527c4641d0SOliver Tappeif [ "$currentDir" = "$sourceDir" ]; then 5537c4641d0SOliver Tappe outputDir=$currentDir/generated 5547c4641d0SOliver Tappeelse 5557c4641d0SOliver Tappe outputDir=$currentDir 5567c4641d0SOliver Tappefi 5577c4641d0SOliver TappebuildOutputDir="$outputDir/build" 5587c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes" 5597c4641d0SOliver TappebuildConfigFile="$buildOutputDir/BuildConfig" 5607c4641d0SOliver Tappe 5617c4641d0SOliver Tappe# check for update request 5627c4641d0SOliver Tappeif [ "$1" = "--update" ]; then 5637c4641d0SOliver Tappe if ! [ -e "$buildConfigFile" ]; then 5647c4641d0SOliver Tappe echo $0 --update: \'$buildConfigFile\' not found - updating not possible. 5657c4641d0SOliver Tappe exit 1 5667c4641d0SOliver Tappe fi 5677c4641d0SOliver Tappe if ! type perl >/dev/null 2>&1; then 5687c4641d0SOliver Tappe echo $0 --update: \'perl\' not found - updating not possible. 5697c4641d0SOliver Tappe exit 1 5707c4641d0SOliver Tappe fi 5717c4641d0SOliver Tappe # convert BuildConfig from jam format to shell format and evaluate it 5727c4641d0SOliver Tappe shellConfigFile="${buildConfigFile}.shell" 5737c4641d0SOliver Tappe perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \ 5747c4641d0SOliver Tappe <"$buildConfigFile" >"$shellConfigFile" 5757c4641d0SOliver Tappe . "$shellConfigFile" 5767c4641d0SOliver Tappe rm "$shellConfigFile" 5777c4641d0SOliver Tappe shift 5787c4641d0SOliver Tappefi 5797c4641d0SOliver Tappe 580022fa244SIngo Weinhold# parse parameters 581022fa244SIngo Weinhold# 58220ab75e6SIngo Weinholdwhile [ $# -gt 0 ] ; do 583022fa244SIngo Weinhold case "$1" in 584e173a1ecSIngo Weinhold --bootstrap) 585e173a1ecSIngo Weinhold assertparams "$1" 3 $# 586e173a1ecSIngo Weinhold HOST_HAIKU_PORTER="`absolute_path $2`" 587e173a1ecSIngo Weinhold HAIKU_PORTS_CROSS="`absolute_path $3`" 588e173a1ecSIngo Weinhold HAIKU_PORTS="`absolute_path $4`" 589*39d444a3SArvind S Raj check_dir_exists "$HOST_HAIKU_PORTER" || ( 590*39d444a3SArvind S Raj echo "Non-existent directory $HOST_HAIKU_PORTER" >&2 591*39d444a3SArvind S Raj exit 1 592*39d444a3SArvind S Raj ) 593*39d444a3SArvind S Raj check_dir_exists "$HAIKU_PORTS" || ( 594*39d444a3SArvind S Raj echo "Non-existent directory $HAIKU_PORTS" >&2 595*39d444a3SArvind S Raj exit 1 596*39d444a3SArvind S Raj ) 597*39d444a3SArvind S Raj check_dir_exists "$HAIKU_PORTS_CROSS" || ( 598*39d444a3SArvind S Raj echo "Non-existent directory $HAIKU_PORTS_CROSS" >&2 599*39d444a3SArvind S Raj exit 1 600*39d444a3SArvind S Raj ) 601e173a1ecSIngo Weinhold shift 4 602e173a1ecSIngo Weinhold ;; 603c0e8cc1aSIngo Weinhold --build-cross-tools) 604c0e8cc1aSIngo Weinhold if [ -z "$buildCrossTools" ]; then 6059b0dd528SIngo Weinhold assertparams "$1" 2 $# 606c0e8cc1aSIngo Weinhold targetArch=$2 6079b0dd528SIngo Weinhold buildCrossTools=$3 6089b0dd528SIngo Weinhold shift 3 609c0e8cc1aSIngo Weinhold else 610c0e8cc1aSIngo Weinhold assertparam "$1" $# 611c0e8cc1aSIngo Weinhold targetArch=$2 612c0e8cc1aSIngo Weinhold shift 2 613c0e8cc1aSIngo Weinhold fi 614c0e8cc1aSIngo Weinhold case "$targetArch" in 615c0e8cc1aSIngo Weinhold x86_gcc2) targetMachine=i586-pc-haiku;; 616c0e8cc1aSIngo Weinhold x86) targetMachine=i586-pc-haiku;; 617c0e8cc1aSIngo Weinhold x86_64) targetMachine=x86_64-unknown-haiku;; 618c0e8cc1aSIngo Weinhold ppc) targetMachine=powerpc-apple-haiku;; 619c0e8cc1aSIngo Weinhold m68k) targetMachine=m68k-unknown-haiku;; 620c0e8cc1aSIngo Weinhold arm) targetMachine=arm-unknown-haiku;; 621c0e8cc1aSIngo Weinhold *) 622c0e8cc1aSIngo Weinhold echo "Unsupported target architecture: $2" >&2 623c0e8cc1aSIngo Weinhold exit 1 624c0e8cc1aSIngo Weinhold ;; 625c0e8cc1aSIngo Weinhold esac 626c0e8cc1aSIngo Weinhold set_variable buildCrossToolsMachine_$targetArch $targetMachine 627c0e8cc1aSIngo Weinhold targetArchs="$targetArchs $targetArch" 628c0e8cc1aSIngo Weinhold HAIKU_PACKAGING_ARCHS= 6299b0dd528SIngo Weinhold ;; 6309b0dd528SIngo Weinhold --cross-tools-prefix) 6319b0dd528SIngo Weinhold assertparam "$1" $# 632c0e8cc1aSIngo Weinhold targetArch=unknown${unknownArchIndex} 633c0e8cc1aSIngo Weinhold set_variable crossToolsPrefix_$targetArch "$2" 634c0e8cc1aSIngo Weinhold targetArchs="$targetArchs $targetArch" 635c0e8cc1aSIngo Weinhold HAIKU_PACKAGING_ARCHS= 636d68208faSMatt Madia unknownArchIndex=$(($unknownArchIndex + 1)) 6379b0dd528SIngo Weinhold shift 2 6389b0dd528SIngo Weinhold ;; 639a66c32ddSIngo Weinhold --distro-compatibility) 6409b0dd528SIngo Weinhold assertparam "$1" $# 6417c4641d0SOliver Tappe HAIKU_DISTRO_COMPATIBILITY=$2 6427c4641d0SOliver Tappe case "$HAIKU_DISTRO_COMPATIBILITY" in 643a66c32ddSIngo Weinhold official) ;; 644a66c32ddSIngo Weinhold compatible) ;; 645a66c32ddSIngo Weinhold default) ;; 646a66c32ddSIngo Weinhold *) echo "Invalid distro compatibility" \ 6477c4641d0SOliver Tappe "level: $HAIKU_DISTRO_COMPATIBILITY" 648a66c32ddSIngo Weinhold exit 1;; 649a66c32ddSIngo Weinhold esac 6509b0dd528SIngo Weinhold shift 2 6519b0dd528SIngo Weinhold ;; 6527c4641d0SOliver Tappe --enable-multiuser) HAIKU_ENABLE_MULTIUSER=1; shift 1;; 65360d8d8fcSIngo Weinhold --help | -h) usage; exit 0;; 6542ebcd86dSIngo Weinhold --host-only) HAIKU_HOST_BUILD_ONLY=1; shift 1;; 6557c4641d0SOliver Tappe --include-gpl-addons) HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;; 6567c4641d0SOliver Tappe --include-patented-code) HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;; 65776fa0be3SIngo Weinhold --include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;; 6587c4641d0SOliver Tappe --include-3rdparty) HAIKU_INCLUDE_3RDPARTY=1; shift 1;; 65960d8d8fcSIngo Weinhold -j*) buildCrossToolsJobs="$1"; shift 1;; 6607c4641d0SOliver Tappe --target=*) TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;; 661483b28e4SIngo Weinhold --target-arch) 662483b28e4SIngo Weinhold assertparam "$1" $# 663483b28e4SIngo Weinhold targetArch=$2 664483b28e4SIngo Weinhold shift 2 665483b28e4SIngo Weinhold if [ ! "$platform" = Haiku ]; then 666483b28e4SIngo Weinhold echo "--target-arch can only be specified on Haiku." >&2 667483b28e4SIngo Weinhold exit 1 668483b28e4SIngo Weinhold fi 669483b28e4SIngo Weinhold is_in_list "$targetArch" "$supportedTargetArchs" || ( 670483b28e4SIngo Weinhold echo "Unsupported target architecture: \"$targetArch\"" >&2 671483b28e4SIngo Weinhold exit 1 672483b28e4SIngo Weinhold ) 673483b28e4SIngo Weinhold haikuTargetArchs="$haikuTargetArchs $targetArch" 674483b28e4SIngo Weinhold ;; 675e70c4c64SPulkoMandy --target-board) 676e70c4c64SPulkoMandy assertparam "$1" $# 677e70c4c64SPulkoMandy HAIKU_BOOT_BOARD=$2 678e70c4c64SPulkoMandy is_in_list "$HAIKU_BOOT_BOARD" "$supportedTargetBoards" || ( 679e70c4c64SPulkoMandy echo "Unsupported target board: \"$HAIKU_BOOT_BOARD\"" >&2 680e70c4c64SPulkoMandy exit 1 681e70c4c64SPulkoMandy ) 682e70c4c64SPulkoMandy shift 2 683e70c4c64SPulkoMandy ;; 684c2b76f7fSJonathan Schleifer --use-clang) useClang=1; shift 1;; 6857c4641d0SOliver Tappe --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;; 686c0e8cc1aSIngo Weinhold --use-gcc-graphite) useGccGraphiteDefault=1; shift 1;; 6877986925fSIngo Weinhold --use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;; 6887986925fSIngo Weinhold --use-xattr) HAIKU_HOST_USE_XATTR=1; shift 1;; 689bc96e8f3SIngo Weinhold --use-xattr-ref) HAIKU_HOST_USE_XATTR_REF=1; shift 1;; 690022fa244SIngo Weinhold *) echo Invalid argument: \`$1\'; exit 1;; 691022fa244SIngo Weinhold esac 692022fa244SIngo Weinholddone 693022fa244SIngo Weinhold 6940df3cc9cSIngo Weinhold# detect the build platform 695338b8dc3SIngo Weinholdcase "${platform}" in 6967c4641d0SOliver Tappe Darwin) HOST_PLATFORM=darwin ;; 6977c4641d0SOliver Tappe FreeBSD) HOST_PLATFORM=freebsd 698c505b276SFrançois Revol SFDISK_BINARY=sfdisk-linux 6997986925fSIngo Weinhold if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then 7005abd9a46SIngo Weinhold echo Unsupported platform: FreeBSD ${platformMachine} 701308c212cSIngo Weinhold exit 1 702308c212cSIngo Weinhold fi ;; 7037c4641d0SOliver Tappe Haiku) HOST_PLATFORM=haiku_host ;; 7047c4641d0SOliver Tappe Linux) HOST_PLATFORM=linux ;; 7057c4641d0SOliver Tappe OpenBSD) HOST_PLATFORM=openbsd ;; 7067c4641d0SOliver Tappe SunOS) HOST_PLATFORM=sunos ;; 7077c4641d0SOliver Tappe CYGWIN_NT-*) HOST_PLATFORM=cygwin ;; 708338b8dc3SIngo Weinhold *) echo Unsupported platform: ${platform} 7094cbe4925SAxel Dörfler exit 1 ;; 7104cbe4925SAxel Dörfleresac 71152a38012Sejakowatz 712c505b276SFrançois Revol# check common locations for sfdisk 713c505b276SFrançois Revolfor sfdiskDir in /sbin /usr/sbin /usr/local/sbin ; do 714c505b276SFrançois Revol if [ -e ${sfdiskDir}/${SFDISK_BINARY} ]; then 715c505b276SFrançois Revol HOST_SFDISK=${sfdiskDir}/${SFDISK_BINARY} 716c505b276SFrançois Revol fi 717c505b276SFrançois Revoldone 718c505b276SFrançois Revol 7190962132cSAlex Smith# check for case-sensitive filesystem 7200962132cSAlex Smithmkdir haikuCaseTest 2>/dev/null 7210962132cSAlex Smithmkdir haikucasetest 2>/dev/null 7220962132cSAlex SmithcaseInsensitive=$? 72397f5a0bdSAlex Smithrmdir haikuCaseTest haikucasetest 2>/dev/null 7240962132cSAlex Smithif [ $caseInsensitive != 0 ]; then 7253ecc5287SMichael Lotz echo "You need a case-sensitive file-system to build Haiku." 7260962132cSAlex Smith if [ $HOST_PLATFORM = "darwin" ]; then 7270962132cSAlex Smith echo "You can create a case-sensitive disk image using Disk Utility and use" 7280962132cSAlex Smith echo "it to store the Haiku sources on." 7293ecc5287SMichael Lotz fi 7300962132cSAlex Smith exit 1 7313ecc5287SMichael Lotzfi 7323ecc5287SMichael Lotz 733f04f7042SNiels Sascha Reedijk# determine how to invoke sed with extended regexp support for non-GNU sed 734f04f7042SNiels Sascha Reedijkif [ $HOST_PLATFORM = "darwin" ]; then 735f04f7042SNiels Sascha Reedijk HOST_EXTENDED_REGEX_SED="sed -E" 736f04f7042SNiels Sascha Reedijkfi 737f04f7042SNiels Sascha Reedijk 738338b8dc3SIngo Weinhold# create output directory 7396e7c6fe5SIngo Weinholdmkdir -p "$buildOutputDir" || exit 1 740338b8dc3SIngo Weinhold 7412ebcd86dSIngo Weinholdif [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then 7422ebcd86dSIngo Weinhold invalidCommand=$sourceDir/build/scripts/host_build_only 7432ebcd86dSIngo Weinhold HAIKU_AR=$invalidCommand 7442ebcd86dSIngo Weinhold HAIKU_CC=$invalidCommand 7452ebcd86dSIngo Weinhold HAIKU_LD=$invalidCommand 7462ebcd86dSIngo Weinhold HAIKU_OBJCOPY=$invalidCommand 7472ebcd86dSIngo Weinhold HAIKU_RANLIB=$invalidCommand 7482ebcd86dSIngo Weinhold HAIKU_ELFEDIT=$invalidCommand 749d6f80927SJonathan Schleifer HAIKU_NASM=$invalidCommand 7502ebcd86dSIngo Weinhold HAIKU_STRIP=$invalidCommand 7512ebcd86dSIngo Weinholdelse 752c0e8cc1aSIngo Weinhold if [ -n "$HAIKU_PACKAGING_ARCHS" ]; then 753c0e8cc1aSIngo Weinhold targetArchs="$HAIKU_PACKAGING_ARCHS" 754c0e8cc1aSIngo Weinhold fi 755c0e8cc1aSIngo Weinhold HAIKU_PACKAGING_ARCHS= 756c0e8cc1aSIngo Weinhold 757483b28e4SIngo Weinhold # On Haiku determine target architectures and tools automatically. 758c0e8cc1aSIngo Weinhold if [ -z "$targetArchs" ]; then 759483b28e4SIngo Weinhold if [ $HOST_PLATFORM != haiku_host ]; then 760483b28e4SIngo Weinhold echo "Please specify the build tools to use or build (via" \ 761eaef83a9SJeroen Oortwijn "--cross-tools-prefix or --build-cross-tools) or specify a" \ 762483b28e4SIngo Weinhold "host-only build (--host-only)." >&2 763483b28e4SIngo Weinhold exit 1 764483b28e4SIngo Weinhold fi 765483b28e4SIngo Weinhold 766483b28e4SIngo Weinhold # determine primary architecture 767dda53eaeSIngo Weinhold targetArch=`package list -i /system/packages/haiku-*.hpkg \ 768483b28e4SIngo Weinhold | sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'` 769483b28e4SIngo Weinhold is_in_list "$targetArch" "$supportedTargetArchs" || ( 770483b28e4SIngo Weinhold echo "Unsupported target architecture: \"$targetArch\"" >&2 771483b28e4SIngo Weinhold exit 1 772483b28e4SIngo Weinhold ) 773c0e8cc1aSIngo Weinhold targetArchs=$targetArch 774483b28e4SIngo Weinhold 775c0e8cc1aSIngo Weinhold set_default_value HAIKU_AR_$targetArch ar 776c0e8cc1aSIngo Weinhold set_default_value HAIKU_CC_$targetArch gcc 777c0e8cc1aSIngo Weinhold set_default_value HAIKU_LD_$targetArch ld 778c0e8cc1aSIngo Weinhold set_default_value HAIKU_OBJCOPY_$targetArch objcopy 779c0e8cc1aSIngo Weinhold set_default_value HAIKU_RANLIB_$targetArch ranlib 780c0e8cc1aSIngo Weinhold set_default_value HAIKU_ELFEDIT_$targetArch elfedit 781c0e8cc1aSIngo Weinhold set_default_value HAIKU_STRIP_$targetArch strip 782483b28e4SIngo Weinhold 783483b28e4SIngo Weinhold # determine secondary architectures 784483b28e4SIngo Weinhold for targetArch in $supportedTargetArchs; do 78580262a91SMatt Madia if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then 786483b28e4SIngo Weinhold targetArchs="$targetArchs $targetArch" 787483b28e4SIngo Weinhold set_default_value HAIKU_AR_$targetArch ar-$targetArch 788483b28e4SIngo Weinhold set_default_value HAIKU_CC_$targetArch gcc-$targetArch 789483b28e4SIngo Weinhold set_default_value HAIKU_LD_$targetArch ld-$targetArch 790483b28e4SIngo Weinhold set_default_value HAIKU_OBJCOPY_$targetArch objcopy-$targetArch 791483b28e4SIngo Weinhold set_default_value HAIKU_RANLIB_$targetArch ranlib-$targetArch 792483b28e4SIngo Weinhold set_default_value HAIKU_ELFEDIT_$targetArch elfedit-$targetArch 793483b28e4SIngo Weinhold set_default_value HAIKU_STRIP_$targetArch strip-$targetArch 794483b28e4SIngo Weinhold fi 795483b28e4SIngo Weinhold done 796483b28e4SIngo Weinhold 797483b28e4SIngo Weinhold # The target architectures might have been specified explicitly. 798483b28e4SIngo Weinhold if [ -n "$haikuTargetArchs" ]; then 799483b28e4SIngo Weinhold for targetArch in $haikuTargetArchs; do 800483b28e4SIngo Weinhold is_in_list "$targetArch" "$targetArchs" || ( 801483b28e4SIngo Weinhold echo "Unsupported target architecture: \"$targetArch\"." \ 802483b28e4SIngo Weinhold "Only native architectures of the host platform can" \ 803483b28e4SIngo Weinhold "be specified." >&2 804483b28e4SIngo Weinhold exit 1 805483b28e4SIngo Weinhold ) 806483b28e4SIngo Weinhold done 807483b28e4SIngo Weinhold targetArchs="$haikuTargetArchs" 808483b28e4SIngo Weinhold fi 809c0e8cc1aSIngo Weinhold fi 810c0e8cc1aSIngo Weinhold 81168ccc989SIngo Weinhold isPrimaryArch=1 812c0e8cc1aSIngo Weinhold for targetArch in $targetArchs; do 813c0e8cc1aSIngo Weinhold # Note: targetArch is "unknown<n>" at this point, if a cross-tools 814c0e8cc1aSIngo Weinhold # prefix was specified. The standard_gcc_settings call below will get 815c0e8cc1aSIngo Weinhold # the actual architecture. 816c0e8cc1aSIngo Weinhold 817c0e8cc1aSIngo Weinhold crossToolsPrefix=`get_variable crossToolsPrefix_$targetArch` 818c0e8cc1aSIngo Weinhold 819338b8dc3SIngo Weinhold # build cross tools from sources 820c0e8cc1aSIngo Weinhold if [ -n "$buildCrossTools" -a -z "$crossToolsPrefix" ]; then 821c0e8cc1aSIngo Weinhold crossToolsDir="$outputDir/cross-tools-$targetArch" 822c0e8cc1aSIngo Weinhold targetMachine=`get_variable buildCrossToolsMachine_$targetArch` 823c0e8cc1aSIngo Weinhold script="$buildCrossToolsScript" 8248304ec7cSIngo Weinhold scriptArgs= 825c0e8cc1aSIngo Weinhold if [ $targetArch != x86_gcc2 ]; then 8268304ec7cSIngo Weinhold script="${script}_gcc4" 8278304ec7cSIngo Weinhold scriptArgs="$targetMachine" 8281e93288eSJérôme Duval set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch \ 8291e93288eSJérôme Duval $useGccGraphiteDefault 830c0e8cc1aSIngo Weinhold fi 83168ccc989SIngo Weinhold secondaryArch= 83268ccc989SIngo Weinhold if [ -z "$isPrimaryArch" ]; then 83368ccc989SIngo Weinhold secondaryArch=$targetArch 83468ccc989SIngo Weinhold fi 83586de8c37SIngo Weinhold 83686de8c37SIngo Weinhold case $HOST_PLATFORM in 83786de8c37SIngo Weinhold freebsd|openbsd) MAKE=gmake;; 83886de8c37SIngo Weinhold *) MAKE=make;; 83986de8c37SIngo Weinhold esac 84086de8c37SIngo Weinhold 84186de8c37SIngo Weinhold MAKE=$MAKE \ 84268ccc989SIngo Weinhold SECONDARY_ARCH=$secondaryArch \ 843c0e8cc1aSIngo Weinhold HAIKU_USE_GCC_GRAPHITE=`get_variable \ 844c0e8cc1aSIngo Weinhold HAIKU_USE_GCC_GRAPHITE_$targetArch` \ 845b3ece905SJérôme Duval HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \ 8468304ec7cSIngo Weinhold "$script" $scriptArgs "$sourceDir" "$buildCrossTools" \ 8478304ec7cSIngo Weinhold "$crossToolsDir" $buildCrossToolsJobs || exit 1 848c0e8cc1aSIngo Weinhold crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-" 849338b8dc3SIngo Weinhold fi 850338b8dc3SIngo Weinhold 851c0e8cc1aSIngo Weinhold # prepare gcc settings and get the actual target architecture 852c0e8cc1aSIngo Weinhold gcc="${crossToolsPrefix}gcc" 853c0e8cc1aSIngo Weinhold if [ -z "${crossToolsPrefix}" ]; then 854c0e8cc1aSIngo Weinhold gcc=`get_variable HAIKU_CC_$targetArch` 855338b8dc3SIngo Weinhold fi 856c0e8cc1aSIngo Weinhold standard_gcc_settings "$gcc" 857c0e8cc1aSIngo Weinhold targetArch=$standard_gcc_settings_targetArch 858338b8dc3SIngo Weinhold 859c0e8cc1aSIngo Weinhold # set default values for flags 860c0e8cc1aSIngo Weinhold set_default_value HAIKU_CPPFLAGS_$targetArch "" 861c0e8cc1aSIngo Weinhold set_default_value HAIKU_CCFLAGS_$targetArch "" 862c0e8cc1aSIngo Weinhold set_default_value HAIKU_CXXFLAGS_$targetArch "" 863c0e8cc1aSIngo Weinhold set_default_value HAIKU_LDFLAGS_$targetArch "" 864c0e8cc1aSIngo Weinhold set_default_value HAIKU_ARFLAGS_$targetArch cru 865c0e8cc1aSIngo Weinhold set_default_value HAIKU_UNARFLAGS_$targetArch x 866338b8dc3SIngo Weinhold 867c0e8cc1aSIngo Weinhold # Override the cross tools variables, if the tools were built or a 868c0e8cc1aSIngo Weinhold # prefix was specified. 869b7777272SAlex Smith if [ -n "$crossToolsPrefix" ]; then 870c0e8cc1aSIngo Weinhold get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar 871c0e8cc1aSIngo Weinhold get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld 872c0e8cc1aSIngo Weinhold get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy 873c0e8cc1aSIngo Weinhold get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib 874c0e8cc1aSIngo Weinhold get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip 875c0e8cc1aSIngo Weinhold 876c0e8cc1aSIngo Weinhold case `get_variable HAIKU_GCC_RAW_VERSION_$targetArch` in 877bd16f0ddSAlex Smith 4.*) 878c0e8cc1aSIngo Weinhold get_build_tool_path ELFEDIT_$targetArch \ 879c0e8cc1aSIngo Weinhold ${crossToolsPrefix}elfedit 880bd16f0ddSAlex Smith ;; 881bd16f0ddSAlex Smith esac 88252a38012Sejakowatz fi 88352a38012Sejakowatz 884c0e8cc1aSIngo Weinhold # Get the libgcc objects. We couldn't do that in standard_gcc_settings, 885c0e8cc1aSIngo Weinhold # since we need "ar", which may be set later. 886c0e8cc1aSIngo Weinhold ar=`get_variable HAIKU_AR_$targetArch` 887c0e8cc1aSIngo Weinhold libgcc=`get_variable HAIKU_GCC_LIBGCC_$targetArch` 888c0e8cc1aSIngo Weinhold set_variable HAIKU_GCC_LIBGCC_OBJECTS_$targetArch \ 889c0e8cc1aSIngo Weinhold "`$ar t $libgcc | grep -v eabi.o`" 890c0e8cc1aSIngo Weinhold # Note: We filter out eabi.o. It's present in gcc's libgcc for PPC 891c0e8cc1aSIngo Weinhold # and neither needed nor wanted. 892c0e8cc1aSIngo Weinhold 893ef57df3dSIngo Weinhold # check whether the Haiku compiler really targets Haiku 894c0e8cc1aSIngo Weinhold targetMachine=`get_variable HAIKU_GCC_MACHINE_$targetArch` 895c0e8cc1aSIngo Weinhold case "$targetMachine" in 896eedc3d0bSIngo Weinhold *-*-haiku) ;; 897c0e8cc1aSIngo Weinhold *) 898c0e8cc1aSIngo Weinhold echo The compiler specified as Haiku target compiler is not a \ 899c0e8cc1aSIngo Weinhold valid Haiku cross-compiler. Please see ReadMe.cross-compile. >&2 900eedc3d0bSIngo Weinhold echo compiler: $HAIKU_CC 901c0e8cc1aSIngo Weinhold echo compiler is configured for target: $targetMachine 902eedc3d0bSIngo Weinhold exit 1 ;; 903eedc3d0bSIngo Weinhold esac 904c0e8cc1aSIngo Weinhold 905c0e8cc1aSIngo Weinhold HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch" 90668ccc989SIngo Weinhold isPrimaryArch= 907c0e8cc1aSIngo Weinhold done 9082ebcd86dSIngo Weinholdfi 909eedc3d0bSIngo Weinhold 91052a38012Sejakowatz# Generate BuildConfig 9117c4641d0SOliver Tappecat << EOF > "$buildConfigFile" 91252a38012Sejakowatz# BuildConfig 913ab2540c4SIngo Weinhold# Note: This file has been automatically generated by configure with the 914ab2540c4SIngo Weinhold# following arguments: 91555d267a4SFrançois Revol# ${configureArgs} 91652a38012Sejakowatz 9177c4641d0SOliver TappeTARGET_PLATFORM ?= "${TARGET_PLATFORM}" ; 9187c4641d0SOliver TappeHOST_PLATFORM ?= "${HOST_PLATFORM}" ; 919338b8dc3SIngo Weinhold 9207c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS ?= "${HAIKU_INCLUDE_GPL_ADDONS}" ; 9217c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE ?= "${HAIKU_INCLUDE_PATENTED_CODE}" ; 92276fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES ?= "${HAIKU_INCLUDE_SOURCES}" ; 9237c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY ?= "${HAIKU_INCLUDE_3RDPARTY}" ; 9247c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER ?= "${HAIKU_ENABLE_MULTIUSER}" ; 9257c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY ?= "${HAIKU_DISTRO_COMPATIBILITY}" ; 9267c4641d0SOliver TappeHAIKU_USE_GCC_PIPE ?= "${HAIKU_USE_GCC_PIPE}" ; 9277986925fSIngo WeinholdHAIKU_HOST_USE_32BIT ?= "${HAIKU_HOST_USE_32BIT}" ; 9287986925fSIngo WeinholdHAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ; 929bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ; 9302ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ; 931eccc7665SIngo Weinhold 932c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ; 93365ad1ba3SAlex Smith 9347c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ; 935338b8dc3SIngo Weinhold 936d6f80927SJonathan SchleiferHAIKU_NASM ?= ${HAIKU_NASM} ; 937e70c4c64SPulkoMandyHAIKU_BOOT_BOARD ?= ${HAIKU_BOOT_BOARD} ; 938338b8dc3SIngo Weinhold 939f04f7042SNiels Sascha ReedijkHOST_EXTENDED_REGEX_SED ?= ${HOST_EXTENDED_REGEX_SED} ; 9407c4641d0SOliver TappeHOST_GCC_RAW_VERSION ?= ${HOST_GCC_RAW_VERSION} ; 9417c4641d0SOliver TappeHOST_GCC_MACHINE ?= ${HOST_GCC_MACHINE} ; 9427c4641d0SOliver TappeHOST_LD ?= ${HOST_GCC_LD} ; 9437c4641d0SOliver TappeHOST_OBJCOPY ?= ${HOST_GCC_OBJCOPY} ; 944c505b276SFrançois RevolHOST_SFDISK ?= ${HOST_SFDISK} ; 9452a5d0aafSIngo WeinholdHOST_SHA256 ?= ${HOST_SHA256} ; 9468b5934c9SIngo Weinhold 947e173a1ecSIngo WeinholdHOST_HAIKU_PORTER ?= ${HOST_HAIKU_PORTER} ; 948e173a1ecSIngo WeinholdHAIKU_PORTS ?= ${HAIKU_PORTS} ; 949e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS ?= ${HAIKU_PORTS_CROSS} ; 950e173a1ecSIngo Weinhold 951c4786ea6SlilloEOF 952c4786ea6Slillo 953c0e8cc1aSIngo Weinholdfor targetArch in $HAIKU_PACKAGING_ARCHS; do 954c0e8cc1aSIngo Weinhold variables=" 955c0e8cc1aSIngo Weinhold HAIKU_GCC_RAW_VERSION HAIKU_GCC_RAW_VERSION 956c0e8cc1aSIngo Weinhold HAIKU_GCC_MACHINE HAIKU_GCC_MACHINE 957c0e8cc1aSIngo Weinhold HAIKU_GCC_LIB_DIR HAIKU_GCC_LIB_DIR 958c0e8cc1aSIngo Weinhold HAIKU_GCC_LIBGCC HAIKU_GCC_LIBGCC 959c0e8cc1aSIngo Weinhold HAIKU_CPU HAIKU_CPU 960c0e8cc1aSIngo Weinhold HAIKU_STATIC_LIBSTDC++ HAIKU_STATIC_LIBSTDCXX 961c0e8cc1aSIngo Weinhold HAIKU_SHARED_LIBSTDC++ HAIKU_SHARED_LIBSTDCXX 962c0e8cc1aSIngo Weinhold HAIKU_STATIC_LIBSUPC++ HAIKU_STATIC_LIBSUPCXX 963c0e8cc1aSIngo Weinhold HAIKU_SHARED_LIBSUPC++ HAIKU_SHARED_LIBSUPCXX 964c0e8cc1aSIngo Weinhold HAIKU_KERNEL_LIBGCC HAIKU_KERNEL_LIBGCC 965c0e8cc1aSIngo Weinhold HAIKU_KERNEL_LIBSUPC++ HAIKU_KERNEL_LIBSUPCXX 966c0e8cc1aSIngo Weinhold HAIKU_BOOT_LIBGCC HAIKU_BOOT_LIBGCC 967c0e8cc1aSIngo Weinhold HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX 968c0e8cc1aSIngo Weinhold HAIKU_AR HAIKU_AR 969c0e8cc1aSIngo Weinhold HAIKU_CC HAIKU_CC 970c2b76f7fSJonathan Schleifer HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG 971c0e8cc1aSIngo Weinhold HAIKU_LD HAIKU_LD 972c0e8cc1aSIngo Weinhold HAIKU_OBJCOPY HAIKU_OBJCOPY 973c0e8cc1aSIngo Weinhold HAIKU_RANLIB HAIKU_RANLIB 974c0e8cc1aSIngo Weinhold HAIKU_ELFEDIT HAIKU_ELFEDIT 975c0e8cc1aSIngo Weinhold HAIKU_STRIP HAIKU_STRIP 976c0e8cc1aSIngo Weinhold HAIKU_CPPFLAGS HAIKU_CPPFLAGS 977c0e8cc1aSIngo Weinhold HAIKU_CCFLAGS HAIKU_CCFLAGS 978c0e8cc1aSIngo Weinhold HAIKU_C++FLAGS HAIKU_CXXFLAGS 979c0e8cc1aSIngo Weinhold HAIKU_LDFLAGS HAIKU_LDFLAGS 980c0e8cc1aSIngo Weinhold HAIKU_ARFLAGS HAIKU_ARFLAGS 981c0e8cc1aSIngo Weinhold HAIKU_UNARFLAGS HAIKU_UNARFLAGS 982c0e8cc1aSIngo Weinhold HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE 983c0e8cc1aSIngo Weinhold " 984c0e8cc1aSIngo Weinhold set -- $variables 985c0e8cc1aSIngo Weinhold while [ $# -ge 2 ]; do 986c0e8cc1aSIngo Weinhold value=`get_variable ${2}_$targetArch` 987c0e8cc1aSIngo Weinhold echo "${1}_${targetArch} ?= $value ;" >> "$buildConfigFile" 988c0e8cc1aSIngo Weinhold shift 2 989c0e8cc1aSIngo Weinhold done 990b1e5b60cSAxel Dörfler 991c0e8cc1aSIngo Weinhold # For variables that may have long values, distribute them over multiple 992c0e8cc1aSIngo Weinhold # lines so that jam doesn't hit the maximum line length. 993c0e8cc1aSIngo Weinhold variables=" 994c0e8cc1aSIngo Weinhold HAIKU_GCC_HEADERS_DIR HAIKU_GCC_HEADERS_DIR 995c0e8cc1aSIngo Weinhold HAIKU_C++_HEADERS_DIR HAIKU_CXX_HEADERS_DIR 99666a7f29fSJérôme Duval HAIKU_BOOT_C++_HEADERS_DIR HAIKU_BOOT_CXX_HEADERS_DIR 997c0e8cc1aSIngo Weinhold HAIKU_GCC_LIBGCC_OBJECTS HAIKU_GCC_LIBGCC_OBJECTS 998c0e8cc1aSIngo Weinhold " 999c0e8cc1aSIngo Weinhold set -- $variables 1000c0e8cc1aSIngo Weinhold while [ $# -ge 2 ]; do 1001c0e8cc1aSIngo Weinhold echo "${1}_${targetArch} ?= " >> "$buildConfigFile" 1002c0e8cc1aSIngo Weinhold get_variable ${2}_$targetArch | xargs -n 1 echo " " \ 1003c0e8cc1aSIngo Weinhold >> "$buildConfigFile" 1004c0e8cc1aSIngo Weinhold echo " ;" >> "$buildConfigFile" 1005c0e8cc1aSIngo Weinhold shift 2 1006c0e8cc1aSIngo Weinhold done 1007c0e8cc1aSIngo Weinholddone 1008b1e5b60cSAxel Dörfler 1009b1e5b60cSAxel Dörfler 10109b0dd528SIngo Weinhold# Generate a boot strap Jamfile in the output directory. 1011338b8dc3SIngo Weinhold 1012338b8dc3SIngo Weinholdcat << EOF > $outputDir/Jamfile 1013338b8dc3SIngo Weinhold# automatically generated Jamfile 1014338b8dc3SIngo Weinhold 1015338b8dc3SIngo WeinholdHAIKU_TOP = ${sourceDir} ; 1016338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR = ${outputDir} ; 1017338b8dc3SIngo Weinhold 1018338b8dc3SIngo Weinholdinclude [ FDirName \$(HAIKU_TOP) Jamfile ] ; 1019338b8dc3SIngo Weinhold 1020338b8dc3SIngo WeinholdEOF 1021