xref: /haiku/configure (revision a04a520b0d0c0d075c2a002bb42a1fe7be20ca69)
152a38012Sejakowatz#!/bin/sh
252a38012Sejakowatz#
3338b8dc3SIngo Weinhold# configure [ <options> ]
4614026d7Sshatty
5022fa244SIngo Weinhold# usage
6022fa244SIngo Weinhold#
7022fa244SIngo Weinhold# Prints usage.
8022fa244SIngo Weinhold#
9022fa244SIngo Weinholdusage()
10022fa244SIngo Weinhold{
11022fa244SIngo Weinhold	cat << EOF
12022fa244SIngo Weinhold
13022fa244SIngo WeinholdUsage: $0 <options>
14022fa244SIngo Weinholdoptions:
15e173a1ecSIngo Weinhold  --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
16e173a1ecSIngo Weinhold                              Prepare for a bootstrap build. No pre-built
17e173a1ecSIngo Weinhold                              packages will be used, instead they will be built
18e173a1ecSIngo Weinhold                              from the sources (in several phases).
19e173a1ecSIngo Weinhold                              <haikuporter> is the path to the haikuporter tool
20e173a1ecSIngo Weinhold                              suitable for the host platform.
21e173a1ecSIngo Weinhold                              <HaikuPorts cross repo> is the path to a checked
22e173a1ecSIngo Weinhold                              out HaikuPorts cross-compilation repository.
23e173a1ecSIngo Weinhold                              <HaikuPorts repo> is the path to a checked out
24e173a1ecSIngo Weinhold                              HaikuPorts repository.
25c0e8cc1aSIngo Weinhold  --build-cross-tools <arch> [ <build tools dir> ]
26338b8dc3SIngo Weinhold                              Assume cross compilation. <build tools dir>
27338b8dc3SIngo Weinhold                              defines the location of the build tools sources.
28338b8dc3SIngo Weinhold                              They will be compiled and placed in the output
29a5b60fa8SOliver Tappe                              directory under "cross-tools". The HAIKU_* tools
30a5b60fa8SOliver Tappe                              variables will be set accordingly.
3120ab75e6SIngo Weinhold                              <arch> specifies the target architecture, either
321b38c341SAlexander von Gluck IV                              "x86_gcc2", "x86", "x86_64", "ppc", "m68k", "arm"
33c0e8cc1aSIngo Weinhold                              This option and --cross-tools-prefix can be
34c0e8cc1aSIngo Weinhold                              specified multiple times. The first cross tools
35c0e8cc1aSIngo Weinhold                              specify the primary tools, the subsequent ones the
36c0e8cc1aSIngo Weinhold                              secondary tools (for "hybrid" images).
37c0e8cc1aSIngo Weinhold                              For the first --build-cross-tools the
38c0e8cc1aSIngo Weinhold                              <build tools dir> argument must be specified and
39c0e8cc1aSIngo Weinhold                              for the subsequent ones it must be omitted.
40eccc7665SIngo Weinhold  --cross-tools-prefix <prefix>
41eccc7665SIngo Weinhold                              Assume cross compilation. <prefix> should be a
42eccc7665SIngo Weinhold                              path to the directory where the cross
43eccc7665SIngo Weinhold                              compilation tools are located, plus the platform
440da9c208SIngo Weinhold                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
45eccc7665SIngo Weinhold                              This overrides the HAIKU_* tool variables.
46a66c32ddSIngo Weinhold  --distro-compatibility <level>
47a66c32ddSIngo Weinhold                              The distribution's level of compatibility with
48a66c32ddSIngo Weinhold                              the official Haiku distribution. The generated
49a66c32ddSIngo Weinhold                              files will contain the respective trademarks
50a66c32ddSIngo Weinhold                              accordingly.
51a66c32ddSIngo Weinhold                              official -- the official Haiku distribution.
52a66c32ddSIngo Weinhold                              compatible -- a Haiku Compatible (tm) distro.
53a66c32ddSIngo Weinhold                              default -- any other distro (default value).
5460d8d8fcSIngo Weinhold  --enable-multiuser          Enable experimental multiuser support.
55eccc7665SIngo Weinhold  --help                      Prints out this help.
562ebcd86dSIngo Weinhold  --host-only                 Configure for building tools for the build host
572ebcd86dSIngo Weinhold                              only. Haiku cannot be built when configured like
582ebcd86dSIngo Weinhold                              this.
59eccc7665SIngo Weinhold  --include-gpl-addons        Include GPL licensed add-ons.
6067838392SAxel Dörfler  --include-patented-code     Enable code that is known to implemented patented
6167838392SAxel Dörfler                              ideas and techniques. If this option is not
6267838392SAxel Dörfler                              specified, the resulting distribution may still
6367838392SAxel Dörfler                              implement patented ideas and techniques. This
6467838392SAxel Dörfler                              option only disables code that is currently known
6567838392SAxel Dörfler                              to be problematic.
6676fa0be3SIngo Weinhold  --include-sources           Includes the source code of projects that require
6776fa0be3SIngo Weinhold                              either an offer of source code or a copy of the
6876fa0be3SIngo Weinhold                              patched sources. This is preferable when
6976fa0be3SIngo Weinhold                              distributing on physical mediums.
701974210fSFrançois Revol  --include-3rdparty          Include 3rdparty/ in the build system.
7160d8d8fcSIngo Weinhold  -j<n>                       Only relevant for --build-cross-tools and
7260d8d8fcSIngo Weinhold                              --build-cross-tools-gcc4. Is passed on to the
7360d8d8fcSIngo Weinhold                              make building the build tools.
7486d7e283SOliver Tappe  --remote-user <username>    Use given username when logging into 
7586d7e283SOliver Tappe                              git.haiku-os.org (via ssh).
767c4641d0SOliver Tappe  --target=TARGET             Select build target platform.
777c4641d0SOliver Tappe                              [default=${TARGET_PLATFORM}]
78a17b9c0cSshatty                              valid targets=r5,bone,dano,haiku
79483b28e4SIngo Weinhold  --target-arch <arch>        Haiku only: Specify the target architecture to
80483b28e4SIngo Weinhold                              build for. Must be one of the architectures of the
81483b28e4SIngo Weinhold                              host system. The installed build tools for that
82483b28e4SIngo Weinhold                              architecture will be used.
83483b28e4SIngo Weinhold                              This option can be specified multiple times. The
84483b28e4SIngo Weinhold                              first occurrence specifies the primary
85483b28e4SIngo Weinhold                              architecture of the Haiku to build, subsequent
86483b28e4SIngo Weinhold                              ones the secondary architectures.
877c4641d0SOliver Tappe  --update                    re-runs last configure invocation [must be given
887c4641d0SOliver Tappe                              as first option!]
89eccc7665SIngo Weinhold  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
905a34a443SFrançois Revol                              process, but uses more memory.
91ed38d2efSJerome Duval  --use-gcc-graphite          Build with GCC Graphite engine for loop
92ed38d2efSJerome Duval                              optimizations. Only for gcc 4.
930385b065SIngo Weinhold  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
94bc96e8f3SIngo Weinhold  --use-xattr                 Use Linux xattr respectively *BSD extattr support
95bc96e8f3SIngo Weinhold                              for BeOS attribute emulation. Warning: Make sure
96bc96e8f3SIngo Weinhold                              your file system supports sufficient attribute
97bc96e8f3SIngo Weinhold                              sizes (4 KB per file for all attributes won't
98bc96e8f3SIngo Weinhold                              suffice).
99bc96e8f3SIngo Weinhold  --use-xattr-ref             Use the generic BeOS attribute emulation, but use
100bc96e8f3SIngo Weinhold                              Linux xattr respectively *BSD extattr support to
101bc96e8f3SIngo Weinhold                              make it more robust (i.e. attribute mix-ups become
102bc96e8f3SIngo Weinhold                              less likely).
103338b8dc3SIngo Weinhold
104338b8dc3SIngo Weinholdenvironment variables:
105c0e8cc1aSIngo Weinhold  HAIKU_AR_x86_gcc2           The static library archiver for x86_gcc2.
106c0e8cc1aSIngo Weinhold                              Defaults to "ar".
107c0e8cc1aSIngo Weinhold  HAIKU_CC_x86_gcc2           The x86_gcc2 compiler. Defaults to "gcc".
108c0e8cc1aSIngo Weinhold  HAIKU_LD_x86_gcc2           The x86_gcc2 linker. Defaults to "ld".
109c0e8cc1aSIngo Weinhold  HAIKU_OBJCOPY_x86_gcc2      The x86_gcc2 objcopy to be used. Defaults to
110c0e8cc1aSIngo Weinhold                              "objcopy".
111c0e8cc1aSIngo Weinhold  HAIKU_RANLIB_x86_gcc2       The static library indexer for x86_gcc2. Defaults
112c0e8cc1aSIngo Weinhold                              to "ranlib".
113c0e8cc1aSIngo Weinhold  HAIKU_STRIP_x86_gcc2        The x86_gcc2 strip command. Defaults to "strip".
114*a04a520bSJonathan Schleifer  HAIKU_NASM                  The nasm assembler (x86 and x86_64 only).
115c0e8cc1aSIngo Weinhold  HAIKU_CPPFLAGS_<arch>       The preprocessor flags for target architecture
116c0e8cc1aSIngo Weinhold                              <arch>. Defaults to "".
117c0e8cc1aSIngo Weinhold  HAIKU_CCFLAGS_<arch>        The C flags for target architecture <arch>.
118c0e8cc1aSIngo Weinhold                              Defaults to "".
119c0e8cc1aSIngo Weinhold  HAIKU_CXXFLAGS_<arch>       The C++ flags for target architecture <arch>.
120c0e8cc1aSIngo Weinhold                              Defaults to "".
121c0e8cc1aSIngo Weinhold  HAIKU_LDFLAGS_<arch>        The linker flags for target architecture <arch>.
122c0e8cc1aSIngo Weinhold                              Defaults to "".
123c0e8cc1aSIngo Weinhold  HAIKU_ARFLAGS_<arch>        The flags passed to HAIKU_AR for target
124c0e8cc1aSIngo Weinhold                              architecture <arch> for archiving. Defaults to
125c0e8cc1aSIngo Weinhold                              "cru".
126c0e8cc1aSIngo Weinhold  HAIKU_UNARFLAGS_<arch>      The flags passed to HAIKU_AR for target
127c0e8cc1aSIngo Weinhold                              architecture <arch> for unarchiving. Defaults to
128c0e8cc1aSIngo Weinhold                              "x".
12964f6da31SIngo Weinhold
130c0e8cc1aSIngo WeinholdNon-default output directories:
13164f6da31SIngo Weinhold  By default all objects, build configuration, and other related files are
13264f6da31SIngo Weinhold  stored in /path/to/haiku_source/generated.  To store objects in a non-default
13364f6da31SIngo Weinhold  location, run "../../relative/path/to/haiku_source/configure <options>" from
13464f6da31SIngo Weinhold  within your non-default location.  "jam [ options ] targets" can then be run
13564f6da31SIngo Weinhold  directly inside your non-default location.  Another option is to invoke "jam
13664f6da31SIngo Weinhold  [ options ] targets" from within haiku_source.  This can be accomplished by
13764f6da31SIngo Weinhold  either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
13864f6da31SIngo Weinhold  jam or by creating a symlink of haiku_source/generated pointing to your
13964f6da31SIngo Weinhold  non-default location and running jam.
14064f6da31SIngo Weinhold
14164f6da31SIngo Weinhold
142022fa244SIngo WeinholdEOF
143022fa244SIngo Weinhold}
144022fa244SIngo Weinhold
145022fa244SIngo Weinhold# assertparam
146022fa244SIngo Weinhold#
147022fa244SIngo Weinhold# Checks whether at least one parameter is left.
148022fa244SIngo Weinhold#
149022fa244SIngo Weinholdassertparam()
150022fa244SIngo Weinhold{
15120ab75e6SIngo Weinhold	if [ $2 -lt 2 ]; then
152022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
153022fa244SIngo Weinhold		exit 1
154022fa244SIngo Weinhold	fi
155022fa244SIngo Weinhold}
156022fa244SIngo Weinhold
15720ab75e6SIngo Weinhold# assertparams
15820ab75e6SIngo Weinhold#
15920ab75e6SIngo Weinhold# Checks whether at least a certain number of parameters is left.
16020ab75e6SIngo Weinhold#
16120ab75e6SIngo Weinholdassertparams()
16220ab75e6SIngo Weinhold{
16320ab75e6SIngo Weinhold	if [ $3 -le $2 ]; then
16420ab75e6SIngo Weinhold		echo $0: \`$1\': Not enough parameters.
16520ab75e6SIngo Weinhold		exit 1
16620ab75e6SIngo Weinhold	fi
16720ab75e6SIngo Weinhold}
16820ab75e6SIngo Weinhold
169e173a1ecSIngo Weinhold# absolute_path
170e173a1ecSIngo Weinhold#
171e173a1ecSIngo Weinhold# returns the absolute path of a given path.
172e173a1ecSIngo Weinhold#
173e173a1ecSIngo Weinholdabsolute_path()
174e173a1ecSIngo Weinhold{
1756a4f3954SFrançois Revol	if [ "x$1" != "x${1#/}" ]; then
176e173a1ecSIngo Weinhold		echo "$1"
177e173a1ecSIngo Weinhold	else
178e173a1ecSIngo Weinhold		echo "`pwd`/$1"
179e173a1ecSIngo Weinhold	fi
180e173a1ecSIngo Weinhold}
181e173a1ecSIngo Weinhold
1829a001156SOliver Tappe# real_path
1839a001156SOliver Tappe#
1849a001156SOliver Tappe# returns the realpath of a symbolic link.
1859a001156SOliver Tappe#
1869a001156SOliver Tappereal_path()
1879a001156SOliver Tappe{
1889a001156SOliver Tappe	perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
1899a001156SOliver Tappe}
1909a001156SOliver Tappe
19109c5682dSIngo Weinhold# standard_gcc_settings
19209c5682dSIngo Weinhold#
19309c5682dSIngo Weinhold# Sets the variables for a GCC platform.
19409c5682dSIngo Weinhold#
19509c5682dSIngo Weinholdstandard_gcc_settings()
19609c5682dSIngo Weinhold{
197c0e8cc1aSIngo Weinhold	local gcc=$1
198c0e8cc1aSIngo Weinhold
199138f5fb4SIngo Weinhold	if which greadlink > /dev/null 2>&1; then
200b29b48b1SMatt Madia		readlink="greadlink -e"
201138f5fb4SIngo Weinhold	elif which realpath > /dev/null 2>&1; then
202b29b48b1SMatt Madia		readlink=realpath
2039a001156SOliver Tappe	elif readlink -e / > /dev/null 2>&1; then
204b29b48b1SMatt Madia		readlink="readlink -e"
2059a001156SOliver Tappe	else
2069a001156SOliver Tappe		readlink=real_path
207b4b6d83cSMatt Madia	fi
208138f5fb4SIngo Weinhold
20909c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
210c0e8cc1aSIngo Weinhold	local gcclib=`$gcc -print-libgcc-file-name`
211c0e8cc1aSIngo Weinhold	local gccdir=`dirname ${gcclib}`
2125b0f7b1bSOliver Tappe
213c0e8cc1aSIngo Weinhold	local gccRawVersion=`$gcc -dumpversion`
214c0e8cc1aSIngo Weinhold	local gccMachine=`$gcc -dumpmachine`
215338b8dc3SIngo Weinhold
216c0e8cc1aSIngo Weinhold	local libgcc=${gccdir}/libgcc.a
2178b5934c9SIngo Weinhold
218fc8967f1SIngo Weinhold	# determine architecture from machine triple
219c0e8cc1aSIngo Weinhold	case $gccMachine in
220c0e8cc1aSIngo Weinhold		arm-*)		targetCpu=arm;;
221c0e8cc1aSIngo Weinhold		i?86-*)		targetCpu=x86;;
222c0e8cc1aSIngo Weinhold		m68k-*)		targetCpu=m68k;;
223c0e8cc1aSIngo Weinhold		powerpc-*)	targetCpu=ppc;;
224c0e8cc1aSIngo Weinhold		x86_64-*)	targetCpu=x86_64;;
225fc8967f1SIngo Weinhold		*)
226c0e8cc1aSIngo Weinhold			echo "Unsupported gcc target machine: $gccMachine" >&2
227fc8967f1SIngo Weinhold			exit 1
228fc8967f1SIngo Weinhold			;;
229fc8967f1SIngo Weinhold	esac
230fc8967f1SIngo Weinhold
231c0e8cc1aSIngo Weinhold	local targetArch=$targetCpu
232c0e8cc1aSIngo Weinhold	local staticLibStdCxx
233c0e8cc1aSIngo Weinhold	local sharedLibStdCxx
234c0e8cc1aSIngo Weinhold	local staticLibSupCxx
235c0e8cc1aSIngo Weinhold	local sharedLibSupCxx
236c0e8cc1aSIngo Weinhold	local kernelLibgcc
237c0e8cc1aSIngo Weinhold	local cxxHeaders
238fc8967f1SIngo Weinhold
239c0e8cc1aSIngo Weinhold	case $gccRawVersion in
2408b5934c9SIngo Weinhold		4.*)
2415b0f7b1bSOliver Tappe			# for gcc 4 we use the libstdc++ and libsupc++ that come with the
2425b0f7b1bSOliver Tappe			# compiler
243c0e8cc1aSIngo Weinhold			staticLibStdCxx=`$gcc -print-file-name=libstdc++.a`
244c0e8cc1aSIngo Weinhold			sharedLibStdCxx=`$gcc -print-file-name=libstdc++.so`
245c0e8cc1aSIngo Weinhold			staticLibSupCxx=`$gcc -print-file-name=libsupc++.a`
246c0e8cc1aSIngo Weinhold			sharedLibSupCxx=`$gcc -print-file-name=libsupc++.so`
24714210488SMichael Lotz
248aaeadfcbSAlex Smith			# If the architecture has separate runtime libraries for the
249aaeadfcbSAlex Smith			# kernel, use them.
250c0e8cc1aSIngo Weinhold			kernelLibgcc=`$gcc -print-file-name=libgcc-kernel.a`
251c0e8cc1aSIngo Weinhold			if [ $kernelLibgcc = libgcc-kernel.a ]; then
252c0e8cc1aSIngo Weinhold				kernelLibgcc=$libgcc
253aaeadfcbSAlex Smith			fi
254c0e8cc1aSIngo Weinhold			kernelLibSupCxx=`$gcc -print-file-name=libsupc++-kernel.a`
255c0e8cc1aSIngo Weinhold			if [ $kernelLibSupCxx = libsupc++-kernel.a ]; then
256c0e8cc1aSIngo Weinhold				kernelLibSupCxx=$staticLibSupCxx
257aaeadfcbSAlex Smith			fi
258aaeadfcbSAlex Smith
259c0e8cc1aSIngo Weinhold			local headersBase=$gccdir/../../../..
260c0e8cc1aSIngo Weinhold			local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion
261c0e8cc1aSIngo Weinhold			if [ ! -d $headers ]; then
262c0e8cc1aSIngo Weinhold				headers=$headersBase/include/c++/$gccRawVersion
26314210488SMichael Lotz			fi
26414210488SMichael Lotz
265c0e8cc1aSIngo Weinhold			cxxHeaders=$headers
266c0e8cc1aSIngo Weinhold			for d in $gccMachine backward ext; do
26729ef597dSIngo Weinhold				# Note: We need the line break, otherwise the line might become
26829ef597dSIngo Weinhold				# too long for jam (512 bytes max).
269c0e8cc1aSIngo Weinhold				cxxHeaders="$cxxHeaders $headers/$d"
2708b5934c9SIngo Weinhold			done
271274b450aSMarcus Overhagen
2723f9f9f9aSIngo Weinhold			# Unset the HAIKU_{SHARED,STATIC}_LIB{STD,SUP}CXX variables, if the
2733f9f9f9aSIngo Weinhold			# compiler didn't give us actual file names. Otherwise resolve
2743f9f9f9aSIngo Weinhold			# symlinks to avoid problems when copying the libraries to the
2753f9f9f9aSIngo Weinhold			# image.
2768b5934c9SIngo Weinhold
277c0e8cc1aSIngo Weinhold			if [ $staticLibStdCxx = libstdc++.a ]; then
278c0e8cc1aSIngo Weinhold				staticLibStdCxx=
2793f9f9f9aSIngo Weinhold			else
280c0e8cc1aSIngo Weinhold				staticLibStdCxx=`$readlink $staticLibStdCxx`
2818b5934c9SIngo Weinhold			fi
2823f9f9f9aSIngo Weinhold
283c0e8cc1aSIngo Weinhold			if [ $sharedLibStdCxx = libstdc++.so ]; then
284c0e8cc1aSIngo Weinhold				sharedLibStdCxx=
2853f9f9f9aSIngo Weinhold			else
286c0e8cc1aSIngo Weinhold				sharedLibStdCxx=`$readlink $sharedLibStdCxx`
287ffe8b20cSIngo Weinhold			fi
2883f9f9f9aSIngo Weinhold
289c0e8cc1aSIngo Weinhold			if [ $staticLibSupCxx = libsupc++.a ]; then
290c0e8cc1aSIngo Weinhold				staticLibSupCxx=
2913f9f9f9aSIngo Weinhold			else
292c0e8cc1aSIngo Weinhold				staticLibSupCxx=`$readlink $staticLibSupCxx`
293c89fc875SIngo Weinhold			fi
2943f9f9f9aSIngo Weinhold
295c0e8cc1aSIngo Weinhold			if [ $sharedLibSupCxx = libsupc++.so ]; then
296c0e8cc1aSIngo Weinhold				sharedLibSupCxx=
2973f9f9f9aSIngo Weinhold			else
298c0e8cc1aSIngo Weinhold				sharedLibSupCxx=`$readlink $sharedLibSupCxx`
299ffe8b20cSIngo Weinhold			fi
3008b5934c9SIngo Weinhold			;;
3016cc8eecfSOliver Tappe		2.9*)
3025b0f7b1bSOliver Tappe			# check for correct (most up-to-date) legacy compiler and complain
3035b0f7b1bSOliver Tappe			# if an older one is installed
304c0e8cc1aSIngo Weinhold			if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then
3055b0f7b1bSOliver Tappe				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
3065b0f7b1bSOliver Tappe				echo "Please download it from www.haiku-os.org...";
3075b0f7b1bSOliver Tappe				exit 1;
3085b0f7b1bSOliver Tappe			fi
309aaeadfcbSAlex Smith
310c0e8cc1aSIngo Weinhold			kernelLibgcc=$libgcc
311c0e8cc1aSIngo Weinhold			kernelLibSupCxx=
312c0e8cc1aSIngo Weinhold			targetArch=x86_gcc2
3135b0f7b1bSOliver Tappe			;;
3148b5934c9SIngo Weinhold	esac
31565ad1ba3SAlex Smith
316c0e8cc1aSIngo Weinhold	local bootLibgcc
317c0e8cc1aSIngo Weinhold	local bootLibSupCxx
31866a7f29fSJérôme Duval	local bootCxxHeaders
319c0e8cc1aSIngo Weinhold	case $gccMachine in
3204591ebc9SAlex Smith		x86_64-*)
32166a7f29fSJérôme Duval			# Boot loader is 32-bit, need the 32-bit libs and c++ config
322c0e8cc1aSIngo Weinhold			bootLibgcc=`$gcc -m32 -print-libgcc-file-name`
323c0e8cc1aSIngo Weinhold			bootLibSupCxx=`$gcc -m32 -print-file-name=libsupc++.a`
32466a7f29fSJérôme Duval
32566a7f29fSJérôme Duval			local headersBase=$gccdir/../../../..
32666a7f29fSJérôme Duval			local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion
32766a7f29fSJérôme Duval			if [ ! -d $headers ]; then
32866a7f29fSJérôme Duval				headers=$headersBase/include/c++/$gccRawVersion
32966a7f29fSJérôme Duval			fi
33066a7f29fSJérôme Duval			bootCxxHeaders="$headers/$gccMachine/32"
3314591ebc9SAlex Smith			;;
3324591ebc9SAlex Smith		*)
333c0e8cc1aSIngo Weinhold			bootLibgcc=$libgcc
334c0e8cc1aSIngo Weinhold			bootLibSupCxx=$staticLibSupCxx
335338b8dc3SIngo Weinhold			;;
336338b8dc3SIngo Weinhold	esac
337c0e8cc1aSIngo Weinhold
338c0e8cc1aSIngo Weinhold	# determine whether graphite loop optimization should/can be used
339c0e8cc1aSIngo Weinhold	local useGraphite=`get_variable HAIKU_USE_GCC_GRAPHITE_$targetCpu`
340c0e8cc1aSIngo Weinhold	if [ -z "$useGraphite" ]; then
341c0e8cc1aSIngo Weinhold		useGraphite=$useGccGraphiteDefault
342c0e8cc1aSIngo Weinhold	fi
343c0e8cc1aSIngo Weinhold
344c0e8cc1aSIngo Weinhold	if [ "$useGraphite" != 0 ]; then
345c0e8cc1aSIngo Weinhold		UNUSED=`echo "int main() {}" | $gcc -xc -c -floop-block - 2>&1`
346c0e8cc1aSIngo Weinhold		if [ $? != 0 ]; then
347c0e8cc1aSIngo Weinhold			echo "GCC Graphite loop optimizations cannot be used on $targetArch"
348c0e8cc1aSIngo Weinhold			useGraphite=0
349c0e8cc1aSIngo Weinhold		fi
350c0e8cc1aSIngo Weinhold	fi
351c0e8cc1aSIngo Weinhold
352c0e8cc1aSIngo Weinhold	set_variable HAIKU_CPU_$targetArch $targetCpu
353c0e8cc1aSIngo Weinhold
354c0e8cc1aSIngo Weinhold	get_build_tool_path CC_$targetArch "$gcc"
355c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_RAW_VERSION_$targetArch $gccRawVersion
356c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine
357c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir
358c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_LIBGCC_$targetArch $libgcc
359c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_GLUE_CODE_$targetArch "crtbegin.o crtend.o"
360c0e8cc1aSIngo Weinhold	set_variable HAIKU_GCC_HEADERS_DIR_$targetArch \
361c0e8cc1aSIngo Weinhold		"${gccdir}/include ${gccdir}/include-fixed"
362c0e8cc1aSIngo Weinhold	set_variable HAIKU_STATIC_LIBSTDCXX_$targetArch "$staticLibStdCxx"
363c0e8cc1aSIngo Weinhold	set_variable HAIKU_SHARED_LIBSTDCXX_$targetArch "$sharedLibStdCxx"
364c0e8cc1aSIngo Weinhold	set_variable HAIKU_STATIC_LIBSUPCXX_$targetArch "$staticLibSupCxx"
365c0e8cc1aSIngo Weinhold	set_variable HAIKU_SHARED_LIBSUPCXX_$targetArch "$sharedLibSupCxx"
366c0e8cc1aSIngo Weinhold	set_variable HAIKU_KERNEL_LIBSUPCXX_$targetArch "$kernelLibSupCxx"
367c0e8cc1aSIngo Weinhold	set_variable HAIKU_BOOT_LIBSUPCXX_$targetArch "$bootLibSupCxx"
368c0e8cc1aSIngo Weinhold	set_variable HAIKU_KERNEL_LIBGCC_$targetArch $kernelLibgcc
369c0e8cc1aSIngo Weinhold	set_variable HAIKU_CXX_HEADERS_DIR_$targetArch "$cxxHeaders"
370c0e8cc1aSIngo Weinhold	set_variable HAIKU_BOOT_LIBGCC_$targetArch $bootLibgcc
37166a7f29fSJérôme Duval	set_variable HAIKU_BOOT_CXX_HEADERS_DIR_$targetArch "$bootCxxHeaders"
372c0e8cc1aSIngo Weinhold	set_variable HAIKU_USE_GCC_GRAPHITE_$targetArch $useGraphite
373c0e8cc1aSIngo Weinhold
374c0e8cc1aSIngo Weinhold	standard_gcc_settings_targetArch=$targetArch
375c0e8cc1aSIngo Weinhold}
376c0e8cc1aSIngo Weinhold
377c0e8cc1aSIngo Weinhold# set_variable
378c0e8cc1aSIngo Weinhold#
379c0e8cc1aSIngo Weinhold# Set the value of a variable.
380c0e8cc1aSIngo Weinhold#
381c0e8cc1aSIngo Weinholdset_variable()
382c0e8cc1aSIngo Weinhold{
383c0e8cc1aSIngo Weinhold	eval "$1=\"$2\""
384c0e8cc1aSIngo Weinhold}
385c0e8cc1aSIngo Weinhold
386c0e8cc1aSIngo Weinhold# get_variable
387c0e8cc1aSIngo Weinhold#
388c0e8cc1aSIngo Weinhold# Echo the value of a variable.
389c0e8cc1aSIngo Weinhold#
390c0e8cc1aSIngo Weinholdget_variable()
391c0e8cc1aSIngo Weinhold{
392c0e8cc1aSIngo Weinhold	eval "echo \${$1}"
39309c5682dSIngo Weinhold}
39409c5682dSIngo Weinhold
395338b8dc3SIngo Weinhold# set_default_value
396338b8dc3SIngo Weinhold#
397338b8dc3SIngo Weinhold# Set the value for a variable, if no value is set yet.
398338b8dc3SIngo Weinhold#
399338b8dc3SIngo Weinholdset_default_value()
400338b8dc3SIngo Weinhold{
401338b8dc3SIngo Weinhold	eval "$1=\${$1-$2}"
402338b8dc3SIngo Weinhold}
403338b8dc3SIngo Weinhold
404338b8dc3SIngo Weinhold# get_build_tool_path
405338b8dc3SIngo Weinhold#
406338b8dc3SIngo Weinhold# Gets a usable absolute path of a build tool.
407338b8dc3SIngo Weinhold#
408338b8dc3SIngo Weinholdget_build_tool_path()
409338b8dc3SIngo Weinhold{
410338b8dc3SIngo Weinhold	local var="HAIKU_$1"
411c0e8cc1aSIngo Weinhold	local path=$2
412338b8dc3SIngo Weinhold
413338b8dc3SIngo Weinhold	if [ -f "$path" ]; then
414338b8dc3SIngo Weinhold		# get absolute path
415a559f87aSFrançois Revol		local oldPwd="`pwd`"
416a559f87aSFrançois Revol		cd "`dirname "$path"`"
417a559f87aSFrançois Revol		path="`pwd`/`basename "$path"`"
418338b8dc3SIngo Weinhold		cd $oldPwd
419338b8dc3SIngo Weinhold	else
4207fe2e06cSMatt Madia		which "$path" > /dev/null 2>&1 || {
421338b8dc3SIngo Weinhold			echo "Build tool \"$path\" not found." >&2
422338b8dc3SIngo Weinhold			exit 1
423338b8dc3SIngo Weinhold		}
424338b8dc3SIngo Weinhold	fi
425338b8dc3SIngo Weinhold
426338b8dc3SIngo Weinhold	eval "$var=$path"
427338b8dc3SIngo Weinhold}
428338b8dc3SIngo Weinhold
429483b28e4SIngo Weinholdis_in_list()
430483b28e4SIngo Weinhold{
431483b28e4SIngo Weinhold	local element
432483b28e4SIngo Weinhold	for element in $2; do
433483b28e4SIngo Weinhold		if [ "$1" = "$element" ]; then
434483b28e4SIngo Weinhold			return 0
435483b28e4SIngo Weinhold		fi
436483b28e4SIngo Weinhold	done
437483b28e4SIngo Weinhold	return 1
438483b28e4SIngo Weinhold}
439483b28e4SIngo Weinhold
440338b8dc3SIngo Weinhold# get cwd and the source directory
441338b8dc3SIngo WeinholdcurrentDir=`pwd`
4426e7c6fe5SIngo Weinholdcd `dirname "$0"`
443338b8dc3SIngo WeinholdsourceDir=`pwd`
4446e7c6fe5SIngo Weinholdcd "$currentDir"
445338b8dc3SIngo Weinhold
44655d267a4SFrançois Revol# backup the passed arguments
44755d267a4SFrançois RevolconfigureArgs="$@"
44855d267a4SFrançois Revol
4497c4641d0SOliver Tappe# internal default parameter values
450022fa244SIngo Weinhold#
45152a38012Sejakowatzplatform=`uname`
4525abd9a46SIngo WeinholdplatformMachine=`uname  -m`
453c0e8cc1aSIngo WeinholdtargetArchs=
454338b8dc3SIngo WeinholdbuildCrossTools=
45529ef597dSIngo WeinholdbuildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
45660d8d8fcSIngo WeinholdbuildCrossToolsJobs=
457c0e8cc1aSIngo WeinholduseGccGraphiteDefault=0
458c0e8cc1aSIngo WeinholdunknownArchIndex=1
459483b28e4SIngo WeinholdhaikuTargetArchs=
4607c4641d0SOliver Tappe
4617c4641d0SOliver Tappe# exported (BuildSetup) default parameter values
4627c4641d0SOliver Tappe#
4637c4641d0SOliver TappeHOST_GCC_RAW_VERSION=`gcc -dumpversion`
4647c4641d0SOliver TappeHOST_GCC_MACHINE=`gcc -dumpmachine`
4657c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS=0
4667c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE=0
46776fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES=0
4687c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY=0
4697c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER=0
4707c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY=default
4717c4641d0SOliver TappeTARGET_PLATFORM=haiku
4727c4641d0SOliver TappeHAIKU_USE_GCC_PIPE=0
4737986925fSIngo WeinholdHAIKU_HOST_USE_32BIT=0
4747986925fSIngo WeinholdHAIKU_HOST_USE_XATTR=0
475bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF=0
4762ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY=0
477f04f7042SNiels Sascha ReedijkHOST_EXTENDED_REGEX_SED="sed -r"
4787c4641d0SOliver TappeHOST_GCC_LD=`gcc -print-prog-name=ld`
4797c4641d0SOliver TappeHOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
480c505b276SFrançois RevolSFDISK_BINARY=sfdisk
481c505b276SFrançois RevolHOST_SFDISK=$SFDISK_BINARY
4822a5d0aafSIngo WeinholdHOST_SHA256=
483e173a1ecSIngo WeinholdHOST_HAIKU_PORTER=
484e173a1ecSIngo WeinholdHAIKU_PORTS=
485e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS=
4862a5d0aafSIngo Weinhold
487c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCHS=
488c0e8cc1aSIngo Weinhold
489*a04a520bSJonathan Schleiferset_default_value HAIKU_NASM		nasm
490c0e8cc1aSIngo Weinhold
4913942ca0dSIngo Weinholdif sha256sum < /dev/null > /dev/null 2>&1; then
4922a5d0aafSIngo Weinhold	HOST_SHA256=sha256sum
4933942ca0dSIngo Weinholdelif sha256 < /dev/null > /dev/null 2>&1; then
4942a5d0aafSIngo Weinhold	HOST_SHA256="sha256 -q"
495b5a871b1SNiels Sascha Reedijkelif shasum < /dev/null > /dev/null 2>&1; then
496b5a871b1SNiels Sascha Reedijk	HOST_SHA256="shasum -a 256"
4972a5d0aafSIngo Weinholdelse
4982a5d0aafSIngo Weinhold	echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
4992a5d0aafSIngo Weinhold	exit 1
5002a5d0aafSIngo Weinholdfi
501338b8dc3SIngo Weinhold
502cc91b333SIngo WeinholdhaikuRequiredLegacyGCCVersion="2.95.3-haiku-2013_08_15"
503a559f87aSFrançois Revolexport haikuRequiredLegacyGCCVersion
504af4bf973SOliver Tappe	# version of legacy gcc required to build haiku
505483b28e4SIngo WeinholdsupportedTargetArchs="
506483b28e4SIngo Weinhold	arm
507483b28e4SIngo Weinhold	m68k
508483b28e4SIngo Weinhold	ppc
509483b28e4SIngo Weinhold	x86
510483b28e4SIngo Weinhold	x86_64
511483b28e4SIngo Weinhold	x86_gcc2
512483b28e4SIngo Weinhold	"
513af4bf973SOliver Tappe
5147c4641d0SOliver Tappe# determine output directory
5157c4641d0SOliver Tappeif [ "$currentDir" = "$sourceDir" ]; then
5167c4641d0SOliver Tappe	outputDir=$currentDir/generated
5177c4641d0SOliver Tappeelse
5187c4641d0SOliver Tappe	outputDir=$currentDir
5197c4641d0SOliver Tappefi
5207c4641d0SOliver TappebuildOutputDir="$outputDir/build"
5217c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
5227c4641d0SOliver TappebuildConfigFile="$buildOutputDir/BuildConfig"
5237c4641d0SOliver Tappe
5247c4641d0SOliver Tappe# check for update request
5257c4641d0SOliver Tappeif [ "$1" = "--update" ]; then
5267c4641d0SOliver Tappe	if ! [ -e "$buildConfigFile" ]; then
5277c4641d0SOliver Tappe		echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
5287c4641d0SOliver Tappe		exit 1
5297c4641d0SOliver Tappe	fi
5307c4641d0SOliver Tappe	if ! type perl >/dev/null 2>&1; then
5317c4641d0SOliver Tappe		echo $0 --update: \'perl\' not found - updating not possible.
5327c4641d0SOliver Tappe		exit 1
5337c4641d0SOliver Tappe	fi
5347c4641d0SOliver Tappe	# convert BuildConfig from jam format to shell format and evaluate it
5357c4641d0SOliver Tappe	shellConfigFile="${buildConfigFile}.shell"
5367c4641d0SOliver Tappe	perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
5377c4641d0SOliver Tappe		<"$buildConfigFile" >"$shellConfigFile"
5387c4641d0SOliver Tappe	. "$shellConfigFile"
5397c4641d0SOliver Tappe	rm "$shellConfigFile"
5407c4641d0SOliver Tappe	shift
5417c4641d0SOliver Tappefi
5427c4641d0SOliver Tappe
543022fa244SIngo Weinhold# parse parameters
544022fa244SIngo Weinhold#
54520ab75e6SIngo Weinholdwhile [ $# -gt 0 ] ; do
546022fa244SIngo Weinhold	case "$1" in
547e173a1ecSIngo Weinhold		--bootstrap)
548e173a1ecSIngo Weinhold			assertparams "$1" 3 $#
549e173a1ecSIngo Weinhold			HOST_HAIKU_PORTER="`absolute_path $2`"
550e173a1ecSIngo Weinhold			HAIKU_PORTS_CROSS="`absolute_path $3`"
551e173a1ecSIngo Weinhold			HAIKU_PORTS="`absolute_path $4`"
552e173a1ecSIngo Weinhold			shift 4
553e173a1ecSIngo Weinhold			;;
554c0e8cc1aSIngo Weinhold		--build-cross-tools)
555c0e8cc1aSIngo Weinhold			if [ -z "$buildCrossTools" ]; then
5569b0dd528SIngo Weinhold				assertparams "$1" 2 $#
557c0e8cc1aSIngo Weinhold				targetArch=$2
5589b0dd528SIngo Weinhold				buildCrossTools=$3
5599b0dd528SIngo Weinhold				shift 3
560c0e8cc1aSIngo Weinhold			else
561c0e8cc1aSIngo Weinhold				assertparam "$1" $#
562c0e8cc1aSIngo Weinhold				targetArch=$2
563c0e8cc1aSIngo Weinhold				shift 2
564c0e8cc1aSIngo Weinhold			fi
565c0e8cc1aSIngo Weinhold			case "$targetArch" in
566c0e8cc1aSIngo Weinhold				x86_gcc2)	targetMachine=i586-pc-haiku;;
567c0e8cc1aSIngo Weinhold				x86)		targetMachine=i586-pc-haiku;;
568c0e8cc1aSIngo Weinhold				x86_64)		targetMachine=x86_64-unknown-haiku;;
569c0e8cc1aSIngo Weinhold				ppc)		targetMachine=powerpc-apple-haiku;;
570c0e8cc1aSIngo Weinhold				m68k)		targetMachine=m68k-unknown-haiku;;
571c0e8cc1aSIngo Weinhold				arm)		targetMachine=arm-unknown-haiku;;
572c0e8cc1aSIngo Weinhold				*)
573c0e8cc1aSIngo Weinhold					echo "Unsupported target architecture: $2" >&2
574c0e8cc1aSIngo Weinhold					exit 1
575c0e8cc1aSIngo Weinhold					;;
576c0e8cc1aSIngo Weinhold			esac
577c0e8cc1aSIngo Weinhold			set_variable buildCrossToolsMachine_$targetArch $targetMachine
578c0e8cc1aSIngo Weinhold			targetArchs="$targetArchs $targetArch"
579c0e8cc1aSIngo Weinhold			HAIKU_PACKAGING_ARCHS=
5809b0dd528SIngo Weinhold			;;
5819b0dd528SIngo Weinhold		--cross-tools-prefix)
5829b0dd528SIngo Weinhold			assertparam "$1" $#
583c0e8cc1aSIngo Weinhold			targetArch=unknown${unknownArchIndex}
584c0e8cc1aSIngo Weinhold			set_variable crossToolsPrefix_$targetArch "$2"
585c0e8cc1aSIngo Weinhold			targetArchs="$targetArchs $targetArch"
586c0e8cc1aSIngo Weinhold			HAIKU_PACKAGING_ARCHS=
587d68208faSMatt Madia			unknownArchIndex=$(($unknownArchIndex + 1))
5889b0dd528SIngo Weinhold			shift 2
5899b0dd528SIngo Weinhold			;;
590a66c32ddSIngo Weinhold		--distro-compatibility)
5919b0dd528SIngo Weinhold			assertparam "$1" $#
5927c4641d0SOliver Tappe			HAIKU_DISTRO_COMPATIBILITY=$2
5937c4641d0SOliver Tappe			case "$HAIKU_DISTRO_COMPATIBILITY" in
594a66c32ddSIngo Weinhold				official)	;;
595a66c32ddSIngo Weinhold				compatible)	;;
596a66c32ddSIngo Weinhold				default)	;;
597a66c32ddSIngo Weinhold				*)			echo "Invalid distro compatibility" \
5987c4641d0SOliver Tappe								"level: $HAIKU_DISTRO_COMPATIBILITY"
599a66c32ddSIngo Weinhold							exit 1;;
600a66c32ddSIngo Weinhold			esac
6019b0dd528SIngo Weinhold			shift 2
6029b0dd528SIngo Weinhold			;;
6037c4641d0SOliver Tappe		--enable-multiuser)	HAIKU_ENABLE_MULTIUSER=1; shift 1;;
60460d8d8fcSIngo Weinhold		--help | -h)	usage; exit 0;;
6052ebcd86dSIngo Weinhold		--host-only)	HAIKU_HOST_BUILD_ONLY=1; shift 1;;
6067c4641d0SOliver Tappe		--include-gpl-addons)	HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;;
6077c4641d0SOliver Tappe		--include-patented-code)	HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;;
60876fa0be3SIngo Weinhold		--include-sources)	HAIKU_INCLUDE_SOURCES=1; shift 1;;
6097c4641d0SOliver Tappe		--include-3rdparty)	HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
61060d8d8fcSIngo Weinhold        -j*)				buildCrossToolsJobs="$1"; shift 1;;
6117c4641d0SOliver Tappe		--target=*)     TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
612483b28e4SIngo Weinhold		--target-arch)
613483b28e4SIngo Weinhold			assertparam "$1" $#
614483b28e4SIngo Weinhold			targetArch=$2
615483b28e4SIngo Weinhold			shift 2
616483b28e4SIngo Weinhold			if [ ! "$platform" = Haiku ]; then
617483b28e4SIngo Weinhold				echo "--target-arch can only be specified on Haiku." >&2
618483b28e4SIngo Weinhold				exit 1
619483b28e4SIngo Weinhold			fi
620483b28e4SIngo Weinhold			is_in_list "$targetArch" "$supportedTargetArchs" || (
621483b28e4SIngo Weinhold				echo "Unsupported target architecture: \"$targetArch\"" >&2
622483b28e4SIngo Weinhold				exit 1
623483b28e4SIngo Weinhold			)
624483b28e4SIngo Weinhold			haikuTargetArchs="$haikuTargetArchs $targetArch"
625483b28e4SIngo Weinhold			;;
6267c4641d0SOliver Tappe		--use-gcc-pipe)	HAIKU_USE_GCC_PIPE=1; shift 1;;
627c0e8cc1aSIngo Weinhold		--use-gcc-graphite)	useGccGraphiteDefault=1; shift 1;;
6287986925fSIngo Weinhold		--use-32bit)	HAIKU_HOST_USE_32BIT=1; shift 1;;
6297986925fSIngo Weinhold		--use-xattr)	HAIKU_HOST_USE_XATTR=1; shift 1;;
630bc96e8f3SIngo Weinhold		--use-xattr-ref)	HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
631022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
632022fa244SIngo Weinhold	esac
633022fa244SIngo Weinholddone
634022fa244SIngo Weinhold
6350df3cc9cSIngo Weinhold# detect the build platform
636338b8dc3SIngo Weinholdcase "${platform}" in
6377c4641d0SOliver Tappe	Darwin)	HOST_PLATFORM=darwin ;;
6387c4641d0SOliver Tappe	FreeBSD)	HOST_PLATFORM=freebsd
639c505b276SFrançois Revol				SFDISK_BINARY=sfdisk-linux
6407986925fSIngo Weinhold				if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
6415abd9a46SIngo Weinhold					echo Unsupported platform: FreeBSD ${platformMachine}
642308c212cSIngo Weinhold					exit 1
643308c212cSIngo Weinhold				fi	;;
6447c4641d0SOliver Tappe	Haiku)	HOST_PLATFORM=haiku_host ;;
6457c4641d0SOliver Tappe	Linux)	HOST_PLATFORM=linux ;;
6467c4641d0SOliver Tappe	OpenBSD) HOST_PLATFORM=openbsd ;;
6477c4641d0SOliver Tappe	SunOS)	HOST_PLATFORM=sunos ;;
6487c4641d0SOliver Tappe	CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
649338b8dc3SIngo Weinhold	*)		echo Unsupported platform: ${platform}
6504cbe4925SAxel Dörfler			exit 1 ;;
6514cbe4925SAxel Dörfleresac
65252a38012Sejakowatz
653c505b276SFrançois Revol# check common locations for sfdisk
654c505b276SFrançois Revolfor sfdiskDir in /sbin /usr/sbin /usr/local/sbin ; do
655c505b276SFrançois Revol	if [ -e ${sfdiskDir}/${SFDISK_BINARY} ]; then
656c505b276SFrançois Revol		HOST_SFDISK=${sfdiskDir}/${SFDISK_BINARY}
657c505b276SFrançois Revol	fi
658c505b276SFrançois Revoldone
659c505b276SFrançois Revol
6600962132cSAlex Smith# check for case-sensitive filesystem
6610962132cSAlex Smithmkdir haikuCaseTest 2>/dev/null
6620962132cSAlex Smithmkdir haikucasetest 2>/dev/null
6630962132cSAlex SmithcaseInsensitive=$?
66497f5a0bdSAlex Smithrmdir haikuCaseTest haikucasetest 2>/dev/null
6650962132cSAlex Smithif [ $caseInsensitive != 0 ]; then
6663ecc5287SMichael Lotz	echo "You need a case-sensitive file-system to build Haiku."
6670962132cSAlex Smith	if [ $HOST_PLATFORM = "darwin" ]; then
6680962132cSAlex Smith		echo "You can create a case-sensitive disk image using Disk Utility and use"
6690962132cSAlex Smith		echo "it to store the Haiku sources on."
6703ecc5287SMichael Lotz	fi
6710962132cSAlex Smith	exit 1
6723ecc5287SMichael Lotzfi
6733ecc5287SMichael Lotz
674f04f7042SNiels Sascha Reedijk# determine how to invoke sed with extended regexp support for non-GNU sed
675f04f7042SNiels Sascha Reedijkif [ $HOST_PLATFORM = "darwin" ]; then
676f04f7042SNiels Sascha Reedijk	HOST_EXTENDED_REGEX_SED="sed -E"
677f04f7042SNiels Sascha Reedijkfi
678f04f7042SNiels Sascha Reedijk
679338b8dc3SIngo Weinhold# create output directory
6806e7c6fe5SIngo Weinholdmkdir -p "$buildOutputDir" || exit 1
681338b8dc3SIngo Weinhold
6822ebcd86dSIngo Weinholdif [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
6832ebcd86dSIngo Weinhold	invalidCommand=$sourceDir/build/scripts/host_build_only
6842ebcd86dSIngo Weinhold	HAIKU_AR=$invalidCommand
6852ebcd86dSIngo Weinhold	HAIKU_CC=$invalidCommand
6862ebcd86dSIngo Weinhold	HAIKU_LD=$invalidCommand
6872ebcd86dSIngo Weinhold	HAIKU_OBJCOPY=$invalidCommand
6882ebcd86dSIngo Weinhold	HAIKU_RANLIB=$invalidCommand
6892ebcd86dSIngo Weinhold	HAIKU_ELFEDIT=$invalidCommand
6902ebcd86dSIngo Weinhold	HAIKU_YASM=$invalidCommand
6912ebcd86dSIngo Weinhold	HAIKU_STRIP=$invalidCommand
6922ebcd86dSIngo Weinholdelse
693c0e8cc1aSIngo Weinhold	if [ -n "$HAIKU_PACKAGING_ARCHS" ]; then
694c0e8cc1aSIngo Weinhold		targetArchs="$HAIKU_PACKAGING_ARCHS"
695c0e8cc1aSIngo Weinhold	fi
696c0e8cc1aSIngo Weinhold	HAIKU_PACKAGING_ARCHS=
697c0e8cc1aSIngo Weinhold
698483b28e4SIngo Weinhold	# On Haiku determine target architectures and tools automatically.
699c0e8cc1aSIngo Weinhold	if [ -z "$targetArchs" ]; then
700483b28e4SIngo Weinhold		if [ $HOST_PLATFORM != haiku_host ]; then
701483b28e4SIngo Weinhold			echo "Please specify the build tools to use or build (via" \
702eaef83a9SJeroen Oortwijn				"--cross-tools-prefix or --build-cross-tools) or specify a" \
703483b28e4SIngo Weinhold				"host-only build (--host-only)." >&2
704483b28e4SIngo Weinhold			exit 1
705483b28e4SIngo Weinhold		fi
706483b28e4SIngo Weinhold
707483b28e4SIngo Weinhold		# determine primary architecture
708dda53eaeSIngo Weinhold		targetArch=`package list -i /system/packages/haiku-*.hpkg \
709483b28e4SIngo Weinhold			| sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'`
710483b28e4SIngo Weinhold		is_in_list "$targetArch" "$supportedTargetArchs" || (
711483b28e4SIngo Weinhold			echo "Unsupported target architecture: \"$targetArch\"" >&2
712483b28e4SIngo Weinhold			exit 1
713483b28e4SIngo Weinhold		)
714c0e8cc1aSIngo Weinhold		targetArchs=$targetArch
715483b28e4SIngo Weinhold
716c0e8cc1aSIngo Weinhold		set_default_value HAIKU_AR_$targetArch			ar
717c0e8cc1aSIngo Weinhold		set_default_value HAIKU_CC_$targetArch			gcc
718c0e8cc1aSIngo Weinhold		set_default_value HAIKU_LD_$targetArch			ld
719c0e8cc1aSIngo Weinhold		set_default_value HAIKU_OBJCOPY_$targetArch		objcopy
720c0e8cc1aSIngo Weinhold		set_default_value HAIKU_RANLIB_$targetArch		ranlib
721c0e8cc1aSIngo Weinhold		set_default_value HAIKU_ELFEDIT_$targetArch		elfedit
722c0e8cc1aSIngo Weinhold		set_default_value HAIKU_STRIP_$targetArch		strip
723483b28e4SIngo Weinhold
724483b28e4SIngo Weinhold		# determine secondary architectures
725483b28e4SIngo Weinhold		for targetArch in $supportedTargetArchs; do
72680262a91SMatt Madia			if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then
727483b28e4SIngo Weinhold				targetArchs="$targetArchs $targetArch"
728483b28e4SIngo Weinhold				set_default_value HAIKU_AR_$targetArch		ar-$targetArch
729483b28e4SIngo Weinhold				set_default_value HAIKU_CC_$targetArch		gcc-$targetArch
730483b28e4SIngo Weinhold				set_default_value HAIKU_LD_$targetArch		ld-$targetArch
731483b28e4SIngo Weinhold				set_default_value HAIKU_OBJCOPY_$targetArch	objcopy-$targetArch
732483b28e4SIngo Weinhold				set_default_value HAIKU_RANLIB_$targetArch	ranlib-$targetArch
733483b28e4SIngo Weinhold				set_default_value HAIKU_ELFEDIT_$targetArch	elfedit-$targetArch
734483b28e4SIngo Weinhold				set_default_value HAIKU_STRIP_$targetArch	strip-$targetArch
735483b28e4SIngo Weinhold			fi
736483b28e4SIngo Weinhold		done
737483b28e4SIngo Weinhold
738483b28e4SIngo Weinhold		# The target architectures might have been specified explicitly.
739483b28e4SIngo Weinhold		if [ -n "$haikuTargetArchs" ]; then
740483b28e4SIngo Weinhold			for targetArch in $haikuTargetArchs; do
741483b28e4SIngo Weinhold				is_in_list "$targetArch" "$targetArchs" || (
742483b28e4SIngo Weinhold					echo "Unsupported target architecture: \"$targetArch\"." \
743483b28e4SIngo Weinhold						"Only native architectures of the host platform can" \
744483b28e4SIngo Weinhold						"be specified." >&2
745483b28e4SIngo Weinhold					exit 1
746483b28e4SIngo Weinhold				)
747483b28e4SIngo Weinhold			done
748483b28e4SIngo Weinhold			targetArchs="$haikuTargetArchs"
749483b28e4SIngo Weinhold		fi
750c0e8cc1aSIngo Weinhold	fi
751c0e8cc1aSIngo Weinhold
75268ccc989SIngo Weinhold	isPrimaryArch=1
753c0e8cc1aSIngo Weinhold	for targetArch in $targetArchs; do
754c0e8cc1aSIngo Weinhold		# Note: targetArch is "unknown<n>" at this point, if a cross-tools
755c0e8cc1aSIngo Weinhold		# prefix was specified. The standard_gcc_settings call below will get
756c0e8cc1aSIngo Weinhold		# the actual architecture.
757c0e8cc1aSIngo Weinhold
758c0e8cc1aSIngo Weinhold		crossToolsPrefix=`get_variable crossToolsPrefix_$targetArch`
759c0e8cc1aSIngo Weinhold
760338b8dc3SIngo Weinhold		# build cross tools from sources
761c0e8cc1aSIngo Weinhold		if [ -n "$buildCrossTools" -a -z "$crossToolsPrefix" ]; then
762c0e8cc1aSIngo Weinhold			crossToolsDir="$outputDir/cross-tools-$targetArch"
763c0e8cc1aSIngo Weinhold			targetMachine=`get_variable buildCrossToolsMachine_$targetArch`
764c0e8cc1aSIngo Weinhold			script="$buildCrossToolsScript"
7658304ec7cSIngo Weinhold			scriptArgs=
766c0e8cc1aSIngo Weinhold			if [ $targetArch != x86_gcc2 ]; then
7678304ec7cSIngo Weinhold				script="${script}_gcc4"
7688304ec7cSIngo Weinhold				scriptArgs="$targetMachine"
7691e93288eSJérôme Duval				set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch	\
7701e93288eSJérôme Duval					$useGccGraphiteDefault
771c0e8cc1aSIngo Weinhold			fi
77268ccc989SIngo Weinhold			secondaryArch=
77368ccc989SIngo Weinhold			if [ -z "$isPrimaryArch" ]; then
77468ccc989SIngo Weinhold				secondaryArch=$targetArch
77568ccc989SIngo Weinhold			fi
77686de8c37SIngo Weinhold
77786de8c37SIngo Weinhold			case $HOST_PLATFORM in
77886de8c37SIngo Weinhold				freebsd|openbsd)	MAKE=gmake;;
77986de8c37SIngo Weinhold				*)					MAKE=make;;
78086de8c37SIngo Weinhold			esac
78186de8c37SIngo Weinhold
78286de8c37SIngo Weinhold			MAKE=$MAKE \
78368ccc989SIngo Weinhold			SECONDARY_ARCH=$secondaryArch \
784c0e8cc1aSIngo Weinhold			HAIKU_USE_GCC_GRAPHITE=`get_variable \
785c0e8cc1aSIngo Weinhold				HAIKU_USE_GCC_GRAPHITE_$targetArch` \
786b3ece905SJérôme Duval			HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
7878304ec7cSIngo Weinhold			"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
7888304ec7cSIngo Weinhold				"$crossToolsDir" $buildCrossToolsJobs || exit 1
789c0e8cc1aSIngo Weinhold			crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
790338b8dc3SIngo Weinhold		fi
791338b8dc3SIngo Weinhold
792c0e8cc1aSIngo Weinhold		# prepare gcc settings and get the actual target architecture
793c0e8cc1aSIngo Weinhold		gcc="${crossToolsPrefix}gcc"
794c0e8cc1aSIngo Weinhold		if [ -z "${crossToolsPrefix}" ]; then
795c0e8cc1aSIngo Weinhold			gcc=`get_variable HAIKU_CC_$targetArch`
796338b8dc3SIngo Weinhold		fi
797c0e8cc1aSIngo Weinhold		standard_gcc_settings "$gcc"
798c0e8cc1aSIngo Weinhold		targetArch=$standard_gcc_settings_targetArch
799338b8dc3SIngo Weinhold
800c0e8cc1aSIngo Weinhold		# set default values for flags
801c0e8cc1aSIngo Weinhold		set_default_value HAIKU_CPPFLAGS_$targetArch	""
802c0e8cc1aSIngo Weinhold		set_default_value HAIKU_CCFLAGS_$targetArch		""
803c0e8cc1aSIngo Weinhold		set_default_value HAIKU_CXXFLAGS_$targetArch	""
804c0e8cc1aSIngo Weinhold		set_default_value HAIKU_LDFLAGS_$targetArch		""
805c0e8cc1aSIngo Weinhold		set_default_value HAIKU_ARFLAGS_$targetArch		cru
806c0e8cc1aSIngo Weinhold		set_default_value HAIKU_UNARFLAGS_$targetArch	x
807338b8dc3SIngo Weinhold
808c0e8cc1aSIngo Weinhold		# Override the cross tools variables, if the tools were built or a
809c0e8cc1aSIngo Weinhold		# prefix was specified.
810b7777272SAlex Smith		if [ -n "$crossToolsPrefix" ]; then
811c0e8cc1aSIngo Weinhold			get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
812c0e8cc1aSIngo Weinhold			get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
813c0e8cc1aSIngo Weinhold			get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy
814c0e8cc1aSIngo Weinhold			get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib
815c0e8cc1aSIngo Weinhold			get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip
816c0e8cc1aSIngo Weinhold
817c0e8cc1aSIngo Weinhold			case `get_variable HAIKU_GCC_RAW_VERSION_$targetArch` in
818bd16f0ddSAlex Smith				4.*)
819c0e8cc1aSIngo Weinhold					get_build_tool_path ELFEDIT_$targetArch \
820c0e8cc1aSIngo Weinhold						${crossToolsPrefix}elfedit
821bd16f0ddSAlex Smith				;;
822bd16f0ddSAlex Smith			esac
82352a38012Sejakowatz		fi
82452a38012Sejakowatz
825c0e8cc1aSIngo Weinhold		# Get the libgcc objects. We couldn't do that in standard_gcc_settings,
826c0e8cc1aSIngo Weinhold		# since we need "ar", which may be set later.
827c0e8cc1aSIngo Weinhold		ar=`get_variable HAIKU_AR_$targetArch`
828c0e8cc1aSIngo Weinhold		libgcc=`get_variable HAIKU_GCC_LIBGCC_$targetArch`
829c0e8cc1aSIngo Weinhold		set_variable HAIKU_GCC_LIBGCC_OBJECTS_$targetArch \
830c0e8cc1aSIngo Weinhold			"`$ar t $libgcc | grep -v eabi.o`"
831c0e8cc1aSIngo Weinhold			# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC
832c0e8cc1aSIngo Weinhold			# and neither needed nor wanted.
833c0e8cc1aSIngo Weinhold
834ef57df3dSIngo Weinhold		# check whether the Haiku compiler really targets Haiku
835c0e8cc1aSIngo Weinhold		targetMachine=`get_variable HAIKU_GCC_MACHINE_$targetArch`
836c0e8cc1aSIngo Weinhold		case "$targetMachine" in
837eedc3d0bSIngo Weinhold			*-*-haiku)	;;
838c0e8cc1aSIngo Weinhold			*)
839c0e8cc1aSIngo Weinhold				echo The compiler specified as Haiku target compiler is not a \
840c0e8cc1aSIngo Weinhold				valid Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
841eedc3d0bSIngo Weinhold				echo compiler: $HAIKU_CC
842c0e8cc1aSIngo Weinhold				echo compiler is configured for target: $targetMachine
843eedc3d0bSIngo Weinhold				exit 1 ;;
844eedc3d0bSIngo Weinhold		esac
845c0e8cc1aSIngo Weinhold
846c0e8cc1aSIngo Weinhold		HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch"
84768ccc989SIngo Weinhold		isPrimaryArch=
848c0e8cc1aSIngo Weinhold	done
8492ebcd86dSIngo Weinholdfi
850eedc3d0bSIngo Weinhold
85152a38012Sejakowatz# Generate BuildConfig
8527c4641d0SOliver Tappecat << EOF > "$buildConfigFile"
85352a38012Sejakowatz# BuildConfig
854ab2540c4SIngo Weinhold# Note: This file has been automatically generated by configure with the
855ab2540c4SIngo Weinhold# following arguments:
85655d267a4SFrançois Revol# ${configureArgs}
85752a38012Sejakowatz
8587c4641d0SOliver TappeTARGET_PLATFORM 			?= "${TARGET_PLATFORM}" ;
8597c4641d0SOliver TappeHOST_PLATFORM				?= "${HOST_PLATFORM}" ;
860338b8dc3SIngo Weinhold
8617c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS			?= "${HAIKU_INCLUDE_GPL_ADDONS}" ;
8627c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE			?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
86376fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES				?= "${HAIKU_INCLUDE_SOURCES}" ;
8647c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY				?= "${HAIKU_INCLUDE_3RDPARTY}" ;
8657c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER				?= "${HAIKU_ENABLE_MULTIUSER}" ;
8667c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY			?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
8677c4641d0SOliver TappeHAIKU_USE_GCC_PIPE					?= "${HAIKU_USE_GCC_PIPE}" ;
8687986925fSIngo WeinholdHAIKU_HOST_USE_32BIT				?= "${HAIKU_HOST_USE_32BIT}" ;
8697986925fSIngo WeinholdHAIKU_HOST_USE_XATTR				?= "${HAIKU_HOST_USE_XATTR}" ;
870bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF			?= "${HAIKU_HOST_USE_XATTR_REF}" ;
8712ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY				?= "${HAIKU_HOST_BUILD_ONLY}" ;
872eccc7665SIngo Weinhold
873c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCHS		?= ${HAIKU_PACKAGING_ARCHS} ;
87465ad1ba3SAlex Smith
8757c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR	?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
876338b8dc3SIngo Weinhold
87777e84f21SIngo WeinholdHAIKU_YASM					?= ${HAIKU_YASM} ;
878338b8dc3SIngo Weinhold
879f04f7042SNiels Sascha ReedijkHOST_EXTENDED_REGEX_SED		?= ${HOST_EXTENDED_REGEX_SED} ;
8807c4641d0SOliver TappeHOST_GCC_RAW_VERSION		?= ${HOST_GCC_RAW_VERSION} ;
8817c4641d0SOliver TappeHOST_GCC_MACHINE			?= ${HOST_GCC_MACHINE} ;
8827c4641d0SOliver TappeHOST_LD						?= ${HOST_GCC_LD} ;
8837c4641d0SOliver TappeHOST_OBJCOPY				?= ${HOST_GCC_OBJCOPY} ;
884c505b276SFrançois RevolHOST_SFDISK					?= ${HOST_SFDISK} ;
8852a5d0aafSIngo WeinholdHOST_SHA256					?= ${HOST_SHA256} ;
8868b5934c9SIngo Weinhold
887e173a1ecSIngo WeinholdHOST_HAIKU_PORTER			?= ${HOST_HAIKU_PORTER} ;
888e173a1ecSIngo WeinholdHAIKU_PORTS					?= ${HAIKU_PORTS} ;
889e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS			?= ${HAIKU_PORTS_CROSS} ;
890e173a1ecSIngo Weinhold
891c4786ea6SlilloEOF
892c4786ea6Slillo
893c0e8cc1aSIngo Weinholdfor targetArch in $HAIKU_PACKAGING_ARCHS; do
894c0e8cc1aSIngo Weinhold	variables="
895c0e8cc1aSIngo Weinhold		HAIKU_GCC_RAW_VERSION		HAIKU_GCC_RAW_VERSION
896c0e8cc1aSIngo Weinhold		HAIKU_GCC_MACHINE			HAIKU_GCC_MACHINE
897c0e8cc1aSIngo Weinhold		HAIKU_GCC_LIB_DIR			HAIKU_GCC_LIB_DIR
898c0e8cc1aSIngo Weinhold		HAIKU_GCC_LIBGCC			HAIKU_GCC_LIBGCC
899c0e8cc1aSIngo Weinhold		HAIKU_CPU					HAIKU_CPU
900c0e8cc1aSIngo Weinhold		HAIKU_STATIC_LIBSTDC++		HAIKU_STATIC_LIBSTDCXX
901c0e8cc1aSIngo Weinhold		HAIKU_SHARED_LIBSTDC++		HAIKU_SHARED_LIBSTDCXX
902c0e8cc1aSIngo Weinhold		HAIKU_STATIC_LIBSUPC++		HAIKU_STATIC_LIBSUPCXX
903c0e8cc1aSIngo Weinhold		HAIKU_SHARED_LIBSUPC++		HAIKU_SHARED_LIBSUPCXX
904c0e8cc1aSIngo Weinhold		HAIKU_KERNEL_LIBGCC			HAIKU_KERNEL_LIBGCC
905c0e8cc1aSIngo Weinhold		HAIKU_KERNEL_LIBSUPC++		HAIKU_KERNEL_LIBSUPCXX
906c0e8cc1aSIngo Weinhold		HAIKU_BOOT_LIBGCC			HAIKU_BOOT_LIBGCC
907c0e8cc1aSIngo Weinhold		HAIKU_BOOT_LIBSUPC++		HAIKU_BOOT_LIBSUPCXX
908c0e8cc1aSIngo Weinhold		HAIKU_AR					HAIKU_AR
909c0e8cc1aSIngo Weinhold		HAIKU_CC					HAIKU_CC
910c0e8cc1aSIngo Weinhold		HAIKU_LD					HAIKU_LD
911c0e8cc1aSIngo Weinhold		HAIKU_OBJCOPY				HAIKU_OBJCOPY
912c0e8cc1aSIngo Weinhold		HAIKU_RANLIB				HAIKU_RANLIB
913c0e8cc1aSIngo Weinhold		HAIKU_ELFEDIT				HAIKU_ELFEDIT
914c0e8cc1aSIngo Weinhold		HAIKU_STRIP					HAIKU_STRIP
915c0e8cc1aSIngo Weinhold		HAIKU_CPPFLAGS				HAIKU_CPPFLAGS
916c0e8cc1aSIngo Weinhold		HAIKU_CCFLAGS				HAIKU_CCFLAGS
917c0e8cc1aSIngo Weinhold		HAIKU_C++FLAGS				HAIKU_CXXFLAGS
918c0e8cc1aSIngo Weinhold		HAIKU_LDFLAGS				HAIKU_LDFLAGS
919c0e8cc1aSIngo Weinhold		HAIKU_ARFLAGS				HAIKU_ARFLAGS
920c0e8cc1aSIngo Weinhold		HAIKU_UNARFLAGS				HAIKU_UNARFLAGS
921c0e8cc1aSIngo Weinhold		HAIKU_USE_GCC_GRAPHITE		HAIKU_USE_GCC_GRAPHITE
922c0e8cc1aSIngo Weinhold		"
923c0e8cc1aSIngo Weinhold	set -- $variables
924c0e8cc1aSIngo Weinhold	while [ $# -ge 2 ]; do
925c0e8cc1aSIngo Weinhold		value=`get_variable ${2}_$targetArch`
926c0e8cc1aSIngo Weinhold		echo "${1}_${targetArch} ?= $value ;" >> "$buildConfigFile"
927c0e8cc1aSIngo Weinhold		shift 2
928c0e8cc1aSIngo Weinhold	done
929b1e5b60cSAxel Dörfler
930c0e8cc1aSIngo Weinhold	# For variables that may have long values, distribute them over multiple
931c0e8cc1aSIngo Weinhold	# lines so that jam doesn't hit the maximum line length.
932c0e8cc1aSIngo Weinhold	variables="
933c0e8cc1aSIngo Weinhold		HAIKU_GCC_HEADERS_DIR		HAIKU_GCC_HEADERS_DIR
934c0e8cc1aSIngo Weinhold		HAIKU_C++_HEADERS_DIR		HAIKU_CXX_HEADERS_DIR
93566a7f29fSJérôme Duval		HAIKU_BOOT_C++_HEADERS_DIR	HAIKU_BOOT_CXX_HEADERS_DIR
936c0e8cc1aSIngo Weinhold		HAIKU_GCC_LIBGCC_OBJECTS	HAIKU_GCC_LIBGCC_OBJECTS
937c0e8cc1aSIngo Weinhold		"
938c0e8cc1aSIngo Weinhold	set -- $variables
939c0e8cc1aSIngo Weinhold	while [ $# -ge 2 ]; do
940c0e8cc1aSIngo Weinhold		echo "${1}_${targetArch} ?= " >> "$buildConfigFile"
941c0e8cc1aSIngo Weinhold		get_variable ${2}_$targetArch | xargs -n 1 echo "   " \
942c0e8cc1aSIngo Weinhold			>> "$buildConfigFile"
943c0e8cc1aSIngo Weinhold		echo "    ;" >> "$buildConfigFile"
944c0e8cc1aSIngo Weinhold		shift 2
945c0e8cc1aSIngo Weinhold	done
946c0e8cc1aSIngo Weinholddone
947b1e5b60cSAxel Dörfler
948b1e5b60cSAxel Dörfler
9499b0dd528SIngo Weinhold# Generate a boot strap Jamfile in the output directory.
950338b8dc3SIngo Weinhold
951338b8dc3SIngo Weinholdcat << EOF > $outputDir/Jamfile
952338b8dc3SIngo Weinhold# automatically generated Jamfile
953338b8dc3SIngo Weinhold
954338b8dc3SIngo WeinholdHAIKU_TOP			= ${sourceDir} ;
955338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR	= ${outputDir} ;
956338b8dc3SIngo Weinhold
957338b8dc3SIngo Weinholdinclude [ FDirName \$(HAIKU_TOP) Jamfile ] ;
958338b8dc3SIngo Weinhold
959338b8dc3SIngo WeinholdEOF
960