xref: /haiku/configure (revision e173a1ec1c0c1f48e355f3cbc34c0114e336ff88)
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:
15*e173a1ecSIngo Weinhold  --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
16*e173a1ecSIngo Weinhold                              Prepare for a bootstrap build. No pre-built
17*e173a1ecSIngo Weinhold                              packages will be used, instead they will be built
18*e173a1ecSIngo Weinhold                              from the sources (in several phases).
19*e173a1ecSIngo Weinhold                              <haikuporter> is the path to the haikuporter tool
20*e173a1ecSIngo Weinhold                              suitable for the host platform.
21*e173a1ecSIngo Weinhold                              <HaikuPorts cross repo> is the path to a checked
22*e173a1ecSIngo Weinhold                              out HaikuPorts cross-compilation repository.
23*e173a1ecSIngo Weinhold                              <HaikuPorts repo> is the path to a checked out
24*e173a1ecSIngo Weinhold                              HaikuPorts repository.
25338b8dc3SIngo Weinhold  --build-cross-tools <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  --build-cross-tools-gcc4 <arch> <build tools dir>
3229ef597dSIngo Weinhold                              Like "--build-cross-tools" just that gcc 4 will
33a5b60fa8SOliver Tappe                              be used for cross-compilation. Note, that the
34a5b60fa8SOliver Tappe                              resulting Haiku installation built with gcc 4
35a5b60fa8SOliver Tappe                              will not be binary compatible with BeOS R5.
3620ab75e6SIngo Weinhold                              <arch> specifies the target architecture, either
3797901ec5SIngo Weinhold                              "x86", "x86_64", "ppc", "m68k", "arm" or "mipsel".
38eccc7665SIngo Weinhold  --cross-tools-prefix <prefix>
39eccc7665SIngo Weinhold                              Assume cross compilation. <prefix> should be a
40eccc7665SIngo Weinhold                              path to the directory where the cross
41eccc7665SIngo Weinhold                              compilation tools are located, plus the platform
420da9c208SIngo Weinhold                              prefix, e.g. "/path/to/tools/i586-pc-haiku-".
43eccc7665SIngo Weinhold                              This overrides the HAIKU_* tool variables.
44a66c32ddSIngo Weinhold  --distro-compatibility <level>
45a66c32ddSIngo Weinhold                              The distribution's level of compatibility with
46a66c32ddSIngo Weinhold                              the official Haiku distribution. The generated
47a66c32ddSIngo Weinhold                              files will contain the respective trademarks
48a66c32ddSIngo Weinhold                              accordingly.
49a66c32ddSIngo Weinhold                              official -- the official Haiku distribution.
50a66c32ddSIngo Weinhold                              compatible -- a Haiku Compatible (tm) distro.
51a66c32ddSIngo Weinhold                              default -- any other distro (default value).
5260d8d8fcSIngo Weinhold  --enable-multiuser          Enable experimental multiuser support.
53eccc7665SIngo Weinhold  --help                      Prints out this help.
542ebcd86dSIngo Weinhold  --host-only                 Configure for building tools for the build host
552ebcd86dSIngo Weinhold                              only. Haiku cannot be built when configured like
562ebcd86dSIngo Weinhold                              this.
57eccc7665SIngo Weinhold  --include-gpl-addons        Include GPL licensed add-ons.
5867838392SAxel Dörfler  --include-patented-code     Enable code that is known to implemented patented
5967838392SAxel Dörfler                              ideas and techniques. If this option is not
6067838392SAxel Dörfler                              specified, the resulting distribution may still
6167838392SAxel Dörfler                              implement patented ideas and techniques. This
6267838392SAxel Dörfler                              option only disables code that is currently known
6367838392SAxel Dörfler                              to be problematic.
6476fa0be3SIngo Weinhold  --include-sources           Includes the source code of projects that require
6576fa0be3SIngo Weinhold                              either an offer of source code or a copy of the
6676fa0be3SIngo Weinhold                              patched sources. This is preferable when
6776fa0be3SIngo Weinhold                              distributing on physical mediums.
681974210fSFrançois Revol  --include-3rdparty          Include 3rdparty/ in the build system.
6960d8d8fcSIngo Weinhold  -j<n>                       Only relevant for --build-cross-tools and
7060d8d8fcSIngo Weinhold                              --build-cross-tools-gcc4. Is passed on to the
7160d8d8fcSIngo Weinhold                              make building the build tools.
727c4641d0SOliver Tappe  --target=TARGET             Select build target platform.
737c4641d0SOliver Tappe                              [default=${TARGET_PLATFORM}]
74a17b9c0cSshatty                              valid targets=r5,bone,dano,haiku
757c4641d0SOliver Tappe  --update                    re-runs last configure invocation [must be given
767c4641d0SOliver Tappe                              as first option!]
77eccc7665SIngo Weinhold  --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
785a34a443SFrançois Revol                              process, but uses more memory.
79ed38d2efSJerome Duval  --use-gcc-graphite          Build with GCC Graphite engine for loop
80ed38d2efSJerome Duval                              optimizations. Only for gcc 4.
810385b065SIngo Weinhold  --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
82bc96e8f3SIngo Weinhold  --use-xattr                 Use Linux xattr respectively *BSD extattr support
83bc96e8f3SIngo Weinhold                              for BeOS attribute emulation. Warning: Make sure
84bc96e8f3SIngo Weinhold                              your file system supports sufficient attribute
85bc96e8f3SIngo Weinhold                              sizes (4 KB per file for all attributes won't
86bc96e8f3SIngo Weinhold                              suffice).
87bc96e8f3SIngo Weinhold  --use-xattr-ref             Use the generic BeOS attribute emulation, but use
88bc96e8f3SIngo Weinhold                              Linux xattr respectively *BSD extattr support to
89bc96e8f3SIngo Weinhold                              make it more robust (i.e. attribute mix-ups become
90bc96e8f3SIngo Weinhold                              less likely).
91338b8dc3SIngo Weinhold
92338b8dc3SIngo Weinholdenvironment variables:
93338b8dc3SIngo Weinhold  HAIKU_AR                    The static library archiver. Defaults to "ar".
94338b8dc3SIngo Weinhold  HAIKU_CC                    The compiler. Defaults to "gcc".
95338b8dc3SIngo Weinhold  HAIKU_LD                    The linker. Defaults to "ld".
96338b8dc3SIngo Weinhold  HAIKU_OBJCOPY               The objcopy to be used. Defaults to "objcopy".
97338b8dc3SIngo Weinhold  HAIKU_RANLIB                The static library indexer. Defaults to "ranlib".
9877e84f21SIngo Weinhold  HAIKU_YASM                  The yasm assembler (x86 only).
9935f39081SMatt Madia  HAIKU_STRIP                 The strip command. Defaults to "strip".
100338b8dc3SIngo Weinhold  HAIKU_CPPFLAGS              The preprocessor flags. Defaults to "".
101338b8dc3SIngo Weinhold  HAIKU_CCFLAGS               The C flags. Defaults to "".
102338b8dc3SIngo Weinhold  HAIKU_CXXFLAGS              The C++ flags. Defaults to "".
103338b8dc3SIngo Weinhold  HAIKU_LDFLAGS               The linker flags. Defaults to "".
104338b8dc3SIngo Weinhold  HAIKU_ARFLAGS               The flags passed to HAIKU_AR for archiving.
10523eb9a9eSFrançois Revol                              Defaults to "cru".
106338b8dc3SIngo Weinhold  HAIKU_UNARFLAGS             The flags passed to HAIKU_AR for unarchiving.
107338b8dc3SIngo Weinhold                              Defaults to "x".
10864f6da31SIngo Weinhold
10964f6da31SIngo WeinholdNon-standard output directories:
11064f6da31SIngo Weinhold  By default all objects, build configuration, and other related files are
11164f6da31SIngo Weinhold  stored in /path/to/haiku_source/generated.  To store objects in a non-default
11264f6da31SIngo Weinhold  location, run "../../relative/path/to/haiku_source/configure <options>" from
11364f6da31SIngo Weinhold  within your non-default location.  "jam [ options ] targets" can then be run
11464f6da31SIngo Weinhold  directly inside your non-default location.  Another option is to invoke "jam
11564f6da31SIngo Weinhold  [ options ] targets" from within haiku_source.  This can be accomplished by
11664f6da31SIngo Weinhold  either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
11764f6da31SIngo Weinhold  jam or by creating a symlink of haiku_source/generated pointing to your
11864f6da31SIngo Weinhold  non-default location and running jam.
11964f6da31SIngo Weinhold
12064f6da31SIngo Weinhold
121022fa244SIngo WeinholdEOF
122022fa244SIngo Weinhold}
123022fa244SIngo Weinhold
124022fa244SIngo Weinhold# assertparam
125022fa244SIngo Weinhold#
126022fa244SIngo Weinhold# Checks whether at least one parameter is left.
127022fa244SIngo Weinhold#
128022fa244SIngo Weinholdassertparam()
129022fa244SIngo Weinhold{
13020ab75e6SIngo Weinhold	if [ $2 -lt 2 ]; then
131022fa244SIngo Weinhold		echo $0: \`$1\': Parameter expected.
132022fa244SIngo Weinhold		exit 1
133022fa244SIngo Weinhold	fi
134022fa244SIngo Weinhold}
135022fa244SIngo Weinhold
13620ab75e6SIngo Weinhold# assertparams
13720ab75e6SIngo Weinhold#
13820ab75e6SIngo Weinhold# Checks whether at least a certain number of parameters is left.
13920ab75e6SIngo Weinhold#
14020ab75e6SIngo Weinholdassertparams()
14120ab75e6SIngo Weinhold{
14220ab75e6SIngo Weinhold	if [ $3 -le $2 ]; then
14320ab75e6SIngo Weinhold		echo $0: \`$1\': Not enough parameters.
14420ab75e6SIngo Weinhold		exit 1
14520ab75e6SIngo Weinhold	fi
14620ab75e6SIngo Weinhold}
14720ab75e6SIngo Weinhold
148*e173a1ecSIngo Weinhold# absolute_path
149*e173a1ecSIngo Weinhold#
150*e173a1ecSIngo Weinhold# returns the absolute path of a given path.
151*e173a1ecSIngo Weinhold#
152*e173a1ecSIngo Weinholdabsolute_path()
153*e173a1ecSIngo Weinhold{
154*e173a1ecSIngo Weinhold	if [[ "$1" == /* ]]; then
155*e173a1ecSIngo Weinhold		echo "$1"
156*e173a1ecSIngo Weinhold	else
157*e173a1ecSIngo Weinhold		echo "`pwd`/$1"
158*e173a1ecSIngo Weinhold	fi
159*e173a1ecSIngo Weinhold}
160*e173a1ecSIngo Weinhold
1619a001156SOliver Tappe# real_path
1629a001156SOliver Tappe#
1639a001156SOliver Tappe# returns the realpath of a symbolic link.
1649a001156SOliver Tappe#
1659a001156SOliver Tappereal_path()
1669a001156SOliver Tappe{
1679a001156SOliver Tappe	perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
1689a001156SOliver Tappe}
1699a001156SOliver Tappe
17009c5682dSIngo Weinhold# standard_gcc_settings
17109c5682dSIngo Weinhold#
17209c5682dSIngo Weinhold# Sets the variables for a GCC platform.
17309c5682dSIngo Weinhold#
17409c5682dSIngo Weinholdstandard_gcc_settings()
17509c5682dSIngo Weinhold{
176138f5fb4SIngo Weinhold	if which greadlink > /dev/null 2>&1; then
177b29b48b1SMatt Madia		readlink="greadlink -e"
178138f5fb4SIngo Weinhold	elif which realpath > /dev/null 2>&1; then
179b29b48b1SMatt Madia		readlink=realpath
1809a001156SOliver Tappe	elif readlink -e / > /dev/null 2>&1; then
181b29b48b1SMatt Madia		readlink="readlink -e"
1829a001156SOliver Tappe	else
1839a001156SOliver Tappe		readlink=real_path
184b4b6d83cSMatt Madia	fi
185138f5fb4SIngo Weinhold
18609c5682dSIngo Weinhold	# PLATFORM_LINKLIBS
187338b8dc3SIngo Weinhold	gcclib=`$HAIKU_CC -print-libgcc-file-name`
18809c5682dSIngo Weinhold	gccdir=`dirname ${gcclib}`
1895b0f7b1bSOliver Tappe
1907c4641d0SOliver Tappe	HAIKU_GCC_RAW_VERSION=`$HAIKU_CC -dumpversion`
1917c4641d0SOliver Tappe	HAIKU_GCC_MACHINE=`$HAIKU_CC -dumpmachine`
192748c10f2SJerome Duval	if [ "$HAIKU_USE_GCC_GRAPHITE" != 0 ]; then
193748c10f2SJerome Duval		UNUSED=`echo "int main() {}" | $HAIKU_CC -xc -c -floop-block - 2>&1`
194748c10f2SJerome Duval		if [ $? != 0 ]; then
195748c10f2SJerome Duval			echo "GCC Graphite loop optimizations cannot be used"
196748c10f2SJerome Duval			HAIKU_USE_GCC_GRAPHITE=0
197748c10f2SJerome Duval		fi
198748c10f2SJerome Duval	fi
199338b8dc3SIngo Weinhold
200338b8dc3SIngo Weinhold	HAIKU_GCC_LIB_DIR=${gccdir}
201338b8dc3SIngo Weinhold	HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
202338b8dc3SIngo Weinhold	HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
20328b5bc75SMichael Lotz	HAIKU_GCC_HEADERS_DIR="${gccdir}/include
20428b5bc75SMichael Lotz		${gccdir}/include-fixed"
2055d978968SIngo Weinhold	HAIKU_GCC_LIBGCC_OBJECTS=`$HAIKU_AR t ${HAIKU_GCC_LIBGCC} | grep -v eabi.o`
2065d978968SIngo Weinhold		# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC and
2075d978968SIngo Weinhold		# neither needed nor wanted.
2088b5934c9SIngo Weinhold
209fc8967f1SIngo Weinhold	# determine architecture from machine triple
210fc8967f1SIngo Weinhold	case $HAIKU_GCC_MACHINE in
211fc8967f1SIngo Weinhold		arm-*)		HAIKU_CPU=arm;;
212fc8967f1SIngo Weinhold		i?86-*)		HAIKU_CPU=x86;;
213fc8967f1SIngo Weinhold		m68k-*)		HAIKU_CPU=m68k;;
214fc8967f1SIngo Weinhold		mipsel-*)	HAIKU_CPU=mipsel;;
215fc8967f1SIngo Weinhold		powerpc-*)	HAIKU_CPU=ppc;;
216fc8967f1SIngo Weinhold		x86_64-*)	HAIKU_CPU=x86_64;;
217fc8967f1SIngo Weinhold		*)
218fc8967f1SIngo Weinhold			echo "Unsupported gcc target machine: $HAIKU_GCC_MACHINE" >&2
219fc8967f1SIngo Weinhold			exit 1
220fc8967f1SIngo Weinhold			;;
221fc8967f1SIngo Weinhold	esac
222fc8967f1SIngo Weinhold
223fc8967f1SIngo Weinhold	HAIKU_PACKAGING_ARCH=$HAIKU_CPU
224fc8967f1SIngo Weinhold
2257c4641d0SOliver Tappe	case $HAIKU_GCC_RAW_VERSION in
2268b5934c9SIngo Weinhold		4.*)
2275b0f7b1bSOliver Tappe			# for gcc 4 we use the libstdc++ and libsupc++ that come with the
2285b0f7b1bSOliver Tappe			# compiler
2297c4641d0SOliver Tappe			HAIKU_STATIC_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.a`
2307c4641d0SOliver Tappe			HAIKU_SHARED_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.so`
2317c4641d0SOliver Tappe			HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
2327c4641d0SOliver Tappe			HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
23314210488SMichael Lotz
234aaeadfcbSAlex Smith			# If the architecture has separate runtime libraries for the
235aaeadfcbSAlex Smith			# kernel, use them.
236aaeadfcbSAlex Smith			HAIKU_KERNEL_LIBGCC=`$HAIKU_CC -print-file-name=libgcc-kernel.a`
237aaeadfcbSAlex Smith			if [ $HAIKU_KERNEL_LIBGCC = libgcc-kernel.a ]; then
238aaeadfcbSAlex Smith				HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
239aaeadfcbSAlex Smith			fi
240aaeadfcbSAlex Smith			HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
241aaeadfcbSAlex Smith			if [ $HAIKU_KERNEL_LIBSUPCXX = libsupc++-kernel.a ]; then
242aaeadfcbSAlex Smith				HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
243aaeadfcbSAlex Smith			fi
244aaeadfcbSAlex Smith
24514210488SMichael Lotz			local headers
2467c4641d0SOliver Tappe			if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
2477c4641d0SOliver Tappe				headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
24814210488SMichael Lotz			else
2497c4641d0SOliver Tappe				headers=$gccdir/../../../../include/c++/$HAIKU_GCC_RAW_VERSION
25014210488SMichael Lotz			fi
25114210488SMichael Lotz
2527c4641d0SOliver Tappe			HAIKU_CXX_HEADERS_DIR=$headers
2537c4641d0SOliver Tappe			for d in $HAIKU_GCC_MACHINE backward ext; do
25429ef597dSIngo Weinhold				# Note: We need the line break, otherwise the line might become
25529ef597dSIngo Weinhold				# too long for jam (512 bytes max).
2567c4641d0SOliver Tappe				HAIKU_CXX_HEADERS_DIR="$HAIKU_CXX_HEADERS_DIR
25729ef597dSIngo Weinhold					$headers/$d"
2588b5934c9SIngo Weinhold			done
259274b450aSMarcus Overhagen
2603f9f9f9aSIngo Weinhold			# Unset the HAIKU_{SHARED,STATIC}_LIB{STD,SUP}CXX variables, if the
2613f9f9f9aSIngo Weinhold			# compiler didn't give us actual file names. Otherwise resolve
2623f9f9f9aSIngo Weinhold			# symlinks to avoid problems when copying the libraries to the
2633f9f9f9aSIngo Weinhold			# image.
2648b5934c9SIngo Weinhold
2657c4641d0SOliver Tappe			if [ $HAIKU_STATIC_LIBSTDCXX = libstdc++.a ]; then
2667c4641d0SOliver Tappe				HAIKU_STATIC_LIBSTDCXX=
2673f9f9f9aSIngo Weinhold			else
268b29b48b1SMatt Madia				HAIKU_STATIC_LIBSTDCXX=`$readlink $HAIKU_STATIC_LIBSTDCXX`
2698b5934c9SIngo Weinhold			fi
2703f9f9f9aSIngo Weinhold
271ffe8b20cSIngo Weinhold			if [ $HAIKU_SHARED_LIBSTDCXX = libstdc++.so ]; then
272ffe8b20cSIngo Weinhold				HAIKU_SHARED_LIBSTDCXX=
2733f9f9f9aSIngo Weinhold			else
274b29b48b1SMatt Madia				HAIKU_SHARED_LIBSTDCXX=`$readlink $HAIKU_SHARED_LIBSTDCXX`
275ffe8b20cSIngo Weinhold			fi
2763f9f9f9aSIngo Weinhold
2777c4641d0SOliver Tappe			if [ $HAIKU_STATIC_LIBSUPCXX = libsupc++.a ]; then
2787c4641d0SOliver Tappe				HAIKU_STATIC_LIBSUPCXX=
2793f9f9f9aSIngo Weinhold			else
280b29b48b1SMatt Madia				HAIKU_STATIC_LIBSUPCXX=`$readlink $HAIKU_STATIC_LIBSUPCXX`
281c89fc875SIngo Weinhold			fi
2823f9f9f9aSIngo Weinhold
283ffe8b20cSIngo Weinhold			if [ $HAIKU_SHARED_LIBSUPCXX = libsupc++.so ]; then
284ffe8b20cSIngo Weinhold				HAIKU_SHARED_LIBSUPCXX=
2853f9f9f9aSIngo Weinhold			else
286b29b48b1SMatt Madia				HAIKU_SHARED_LIBSUPCXX=`$readlink $HAIKU_SHARED_LIBSUPCXX`
287ffe8b20cSIngo Weinhold			fi
2888b5934c9SIngo Weinhold			;;
2896cc8eecfSOliver Tappe		2.9*)
2905b0f7b1bSOliver Tappe			# check for correct (most up-to-date) legacy compiler and complain
2915b0f7b1bSOliver Tappe			# if an older one is installed
2927c4641d0SOliver Tappe			if [ $HAIKU_GCC_RAW_VERSION != $haikuRequiredLegacyGCCVersion ]; then
2935b0f7b1bSOliver Tappe				echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
2945b0f7b1bSOliver Tappe				echo "Please download it from www.haiku-os.org...";
2955b0f7b1bSOliver Tappe				exit 1;
2965b0f7b1bSOliver Tappe			fi
297aaeadfcbSAlex Smith
298aaeadfcbSAlex Smith			HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
299aaeadfcbSAlex Smith			HAIKU_KERNEL_LIBSUPCXX=
300fc8967f1SIngo Weinhold			HAIKU_PACKAGING_ARCH=x86_gcc2
3015b0f7b1bSOliver Tappe			;;
3028b5934c9SIngo Weinhold	esac
30365ad1ba3SAlex Smith
3044591ebc9SAlex Smith	case $HAIKU_GCC_MACHINE in
3054591ebc9SAlex Smith		x86_64-*)
306c864ba1aSAlex Smith			# Boot loader is 32-bit, need the 32-bit libs.
30765ad1ba3SAlex Smith			HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
30865ad1ba3SAlex Smith			HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
3094591ebc9SAlex Smith			;;
3104591ebc9SAlex Smith		*)
31165ad1ba3SAlex Smith			HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
31265ad1ba3SAlex Smith			HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
313338b8dc3SIngo Weinhold			;;
314338b8dc3SIngo Weinhold	esac
315338b8dc3SIngo Weinhold}
316338b8dc3SIngo Weinhold
317338b8dc3SIngo Weinhold# set_default_value
318338b8dc3SIngo Weinhold#
319338b8dc3SIngo Weinhold# Set the value for a variable, if no value is set yet.
320338b8dc3SIngo Weinhold#
321338b8dc3SIngo Weinholdset_default_value()
322338b8dc3SIngo Weinhold{
323338b8dc3SIngo Weinhold	eval "$1=\${$1-$2}"
324338b8dc3SIngo Weinhold}
325338b8dc3SIngo Weinhold
326338b8dc3SIngo Weinhold# get_build_tool_path
327338b8dc3SIngo Weinhold#
328338b8dc3SIngo Weinhold# Gets a usable absolute path of a build tool.
329338b8dc3SIngo Weinhold#
330338b8dc3SIngo Weinholdget_build_tool_path()
331338b8dc3SIngo Weinhold{
332338b8dc3SIngo Weinhold	local var="HAIKU_$1"
333338b8dc3SIngo Weinhold	local tool=$2
334338b8dc3SIngo Weinhold	local path="${crossToolsPrefix}$tool"
335338b8dc3SIngo Weinhold
336338b8dc3SIngo Weinhold	if [ -f "$path" ]; then
337338b8dc3SIngo Weinhold		# get absolute path
338a559f87aSFrançois Revol		local oldPwd="`pwd`"
339a559f87aSFrançois Revol		cd "`dirname "$path"`"
340a559f87aSFrançois Revol		path="`pwd`/`basename "$path"`"
341338b8dc3SIngo Weinhold		cd $oldPwd
342338b8dc3SIngo Weinhold	else
3437fe2e06cSMatt Madia		which "$path" > /dev/null 2>&1 || {
344338b8dc3SIngo Weinhold			echo "Build tool \"$path\" not found." >&2
345338b8dc3SIngo Weinhold			exit 1
346338b8dc3SIngo Weinhold		}
347338b8dc3SIngo Weinhold	fi
348338b8dc3SIngo Weinhold
349338b8dc3SIngo Weinhold	eval "$var=$path"
350338b8dc3SIngo Weinhold}
351338b8dc3SIngo Weinhold
352338b8dc3SIngo Weinhold# get cwd and the source directory
353338b8dc3SIngo WeinholdcurrentDir=`pwd`
3546e7c6fe5SIngo Weinholdcd `dirname "$0"`
355338b8dc3SIngo WeinholdsourceDir=`pwd`
3566e7c6fe5SIngo Weinholdcd "$currentDir"
357338b8dc3SIngo Weinhold
35855d267a4SFrançois Revol# backup the passed arguments
35955d267a4SFrançois RevolconfigureArgs="$@"
36055d267a4SFrançois Revol
3617c4641d0SOliver Tappe# internal default parameter values
362022fa244SIngo Weinhold#
36352a38012Sejakowatzplatform=`uname`
3645abd9a46SIngo WeinholdplatformMachine=`uname  -m`
365338b8dc3SIngo WeinholdcrossToolsPrefix=
366338b8dc3SIngo WeinholdbuildCrossTools=
36729ef597dSIngo WeinholdbuildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
36820ab75e6SIngo WeinholdbuildCrossToolsMachine=
36960d8d8fcSIngo WeinholdbuildCrossToolsJobs=
3707c4641d0SOliver Tappe
3717c4641d0SOliver Tappe# exported (BuildSetup) default parameter values
3727c4641d0SOliver Tappe#
3737c4641d0SOliver TappeHAIKU_GCC_RAW_VERSION=
374fc8967f1SIngo WeinholdHAIKU_CPU=x86
375fc8967f1SIngo WeinholdHAIKU_PACKAGING_ARCH=x86_gcc2
3767c4641d0SOliver TappeHAIKU_GCC_MACHINE=i586-pc-haiku
3777c4641d0SOliver TappeHAIKU_STATIC_LIBSTDCXX=
3787c4641d0SOliver TappeHAIKU_SHARED_LIBSTDCXX=
3797c4641d0SOliver TappeHAIKU_STATIC_LIBSUPCXX=
3807c4641d0SOliver TappeHAIKU_SHARED_LIBSUPCXX=
3817c4641d0SOliver TappeHAIKU_CXX_HEADERS_DIR=
3827c4641d0SOliver TappeHOST_GCC_RAW_VERSION=`gcc -dumpversion`
3837c4641d0SOliver TappeHOST_GCC_MACHINE=`gcc -dumpmachine`
3847c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS=0
3857c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE=0
38676fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES=0
3877c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY=0
3887c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER=0
3897c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY=default
3907c4641d0SOliver TappeTARGET_PLATFORM=haiku
3917c4641d0SOliver TappeHAIKU_USE_GCC_PIPE=0
392748c10f2SJerome DuvalHAIKU_USE_GCC_GRAPHITE=0
3937986925fSIngo WeinholdHAIKU_HOST_USE_32BIT=0
3947986925fSIngo WeinholdHAIKU_HOST_USE_XATTR=0
395bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF=0
3962ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY=0
3977c4641d0SOliver TappeHOST_GCC_LD=`gcc -print-prog-name=ld`
3987c4641d0SOliver TappeHOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
399c505b276SFrançois RevolSFDISK_BINARY=sfdisk
400c505b276SFrançois RevolHOST_SFDISK=$SFDISK_BINARY
4012a5d0aafSIngo WeinholdHOST_SHA256=
402*e173a1ecSIngo WeinholdHOST_HAIKU_PORTER=
403*e173a1ecSIngo WeinholdHAIKU_PORTS=
404*e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS=
4052a5d0aafSIngo Weinhold
4063942ca0dSIngo Weinholdif sha256sum < /dev/null > /dev/null 2>&1; then
4072a5d0aafSIngo Weinhold	HOST_SHA256=sha256sum
4083942ca0dSIngo Weinholdelif sha256 < /dev/null > /dev/null 2>&1; then
4092a5d0aafSIngo Weinhold	HOST_SHA256="sha256 -q"
4102a5d0aafSIngo Weinholdelse
4112a5d0aafSIngo Weinhold	echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
4122a5d0aafSIngo Weinhold	exit 1
4132a5d0aafSIngo Weinholdfi
414338b8dc3SIngo Weinhold
415983aba29SOliver TappehaikuRequiredLegacyGCCVersion="2.95.3-haiku-2013_07_15"
416a559f87aSFrançois Revolexport haikuRequiredLegacyGCCVersion
417af4bf973SOliver Tappe	# version of legacy gcc required to build haiku
418af4bf973SOliver Tappe
419338b8dc3SIngo Weinholdset_default_value HAIKU_AR			ar
420338b8dc3SIngo Weinholdset_default_value HAIKU_CC			gcc
421338b8dc3SIngo Weinholdset_default_value HAIKU_LD			ld
422338b8dc3SIngo Weinholdset_default_value HAIKU_OBJCOPY		objcopy
423338b8dc3SIngo Weinholdset_default_value HAIKU_RANLIB		ranlib
424385d69fcSAlex Smithset_default_value HAIKU_ELFEDIT		elfedit
42577e84f21SIngo Weinholdset_default_value HAIKU_YASM		yasm
42635f39081SMatt Madiaset_default_value HAIKU_STRIP		strip
427338b8dc3SIngo Weinholdset_default_value HAIKU_CPPFLAGS	""
428338b8dc3SIngo Weinholdset_default_value HAIKU_CCFLAGS		""
429338b8dc3SIngo Weinholdset_default_value HAIKU_CXXFLAGS	""
430338b8dc3SIngo Weinholdset_default_value HAIKU_LDFLAGS		""
43123eb9a9eSFrançois Revolset_default_value HAIKU_ARFLAGS		cru
432338b8dc3SIngo Weinholdset_default_value HAIKU_UNARFLAGS	x
43362339647SAxel Dörfler
4347c4641d0SOliver Tappe# determine output directory
4357c4641d0SOliver Tappeif [ "$currentDir" = "$sourceDir" ]; then
4367c4641d0SOliver Tappe	outputDir=$currentDir/generated
4377c4641d0SOliver Tappeelse
4387c4641d0SOliver Tappe	outputDir=$currentDir
4397c4641d0SOliver Tappefi
4407c4641d0SOliver TappebuildOutputDir="$outputDir/build"
4417c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
4427c4641d0SOliver TappebuildConfigFile="$buildOutputDir/BuildConfig"
4437c4641d0SOliver Tappe
4447c4641d0SOliver Tappe# check for update request
4457c4641d0SOliver Tappeif [ "$1" = "--update" ]; then
4467c4641d0SOliver Tappe	if ! [ -e "$buildConfigFile" ]; then
4477c4641d0SOliver Tappe		echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
4487c4641d0SOliver Tappe		exit 1
4497c4641d0SOliver Tappe	fi
4507c4641d0SOliver Tappe	if ! type perl >/dev/null 2>&1; then
4517c4641d0SOliver Tappe		echo $0 --update: \'perl\' not found - updating not possible.
4527c4641d0SOliver Tappe		exit 1
4537c4641d0SOliver Tappe	fi
4547c4641d0SOliver Tappe	# convert BuildConfig from jam format to shell format and evaluate it
4557c4641d0SOliver Tappe	shellConfigFile="${buildConfigFile}.shell"
4567c4641d0SOliver Tappe	perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
4577c4641d0SOliver Tappe		<"$buildConfigFile" >"$shellConfigFile"
4587c4641d0SOliver Tappe	. "$shellConfigFile"
4597c4641d0SOliver Tappe	rm "$shellConfigFile"
4607c4641d0SOliver Tappe	shift
4617c4641d0SOliver Tappefi
4627c4641d0SOliver Tappe
463022fa244SIngo Weinhold# parse parameters
464022fa244SIngo Weinhold#
46520ab75e6SIngo Weinholdwhile [ $# -gt 0 ] ; do
466022fa244SIngo Weinhold	case "$1" in
467*e173a1ecSIngo Weinhold		--bootstrap)
468*e173a1ecSIngo Weinhold			assertparams "$1" 3 $#
469*e173a1ecSIngo Weinhold			HOST_HAIKU_PORTER="`absolute_path $2`"
470*e173a1ecSIngo Weinhold			HAIKU_PORTS_CROSS="`absolute_path $3`"
471*e173a1ecSIngo Weinhold			HAIKU_PORTS="`absolute_path $4`"
472*e173a1ecSIngo Weinhold			shift 4
473*e173a1ecSIngo Weinhold			;;
474a5b60fa8SOliver Tappe		--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
4759b0dd528SIngo Weinhold		--build-cross-tools-gcc4)
4769b0dd528SIngo Weinhold			assertparams "$1" 2 $#
4779b0dd528SIngo Weinhold			buildCrossTools=$3
4789b0dd528SIngo Weinhold			buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
47920ab75e6SIngo Weinhold			case "$2" in
4807c4641d0SOliver Tappe				x86)	HAIKU_GCC_MACHINE=i586-pc-haiku;;
481fc8967f1SIngo Weinhold				x86_64)	HAIKU_GCC_MACHINE=x86_64-unknown-haiku;;
482fc8967f1SIngo Weinhold				ppc)	HAIKU_GCC_MACHINE=powerpc-apple-haiku;;
483fc8967f1SIngo Weinhold				m68k)	HAIKU_GCC_MACHINE=m68k-unknown-haiku;;
484fc8967f1SIngo Weinhold				arm)	HAIKU_GCC_MACHINE=arm-unknown-haiku;;
485*e173a1ecSIngo Weinhold				mipsel)	HAIKU_GCC_MACHINE=mipsel-unknown-haiku;;
48620ab75e6SIngo Weinhold				*)		echo "Unsupported target architecture: $2"
48720ab75e6SIngo Weinhold						exit 1;;
48820ab75e6SIngo Weinhold			esac
4897c4641d0SOliver Tappe			buildCrossToolsMachine=$HAIKU_GCC_MACHINE
4909b0dd528SIngo Weinhold			shift 3
4919b0dd528SIngo Weinhold			;;
4929b0dd528SIngo Weinhold		--cross-tools-prefix)
4939b0dd528SIngo Weinhold			assertparam "$1" $#
4949b0dd528SIngo Weinhold			crossToolsPrefix=$2
4959b0dd528SIngo Weinhold			shift 2
4969b0dd528SIngo Weinhold			;;
497a66c32ddSIngo Weinhold		--distro-compatibility)
4989b0dd528SIngo Weinhold			assertparam "$1" $#
4997c4641d0SOliver Tappe			HAIKU_DISTRO_COMPATIBILITY=$2
5007c4641d0SOliver Tappe			case "$HAIKU_DISTRO_COMPATIBILITY" in
501a66c32ddSIngo Weinhold				official)	;;
502a66c32ddSIngo Weinhold				compatible)	;;
503a66c32ddSIngo Weinhold				default)	;;
504a66c32ddSIngo Weinhold				*)			echo "Invalid distro compatibility" \
5057c4641d0SOliver Tappe								"level: $HAIKU_DISTRO_COMPATIBILITY"
506a66c32ddSIngo Weinhold							exit 1;;
507a66c32ddSIngo Weinhold			esac
5089b0dd528SIngo Weinhold			shift 2
5099b0dd528SIngo Weinhold			;;
5107c4641d0SOliver Tappe		--enable-multiuser)	HAIKU_ENABLE_MULTIUSER=1; shift 1;;
51160d8d8fcSIngo Weinhold		--help | -h)	usage; exit 0;;
5122ebcd86dSIngo Weinhold		--host-only)	HAIKU_HOST_BUILD_ONLY=1; shift 1;;
5137c4641d0SOliver Tappe		--include-gpl-addons)	HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;;
5147c4641d0SOliver Tappe		--include-patented-code)	HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;;
51576fa0be3SIngo Weinhold		--include-sources)	HAIKU_INCLUDE_SOURCES=1; shift 1;;
5167c4641d0SOliver Tappe		--include-3rdparty)	HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
51760d8d8fcSIngo Weinhold        -j*)				buildCrossToolsJobs="$1"; shift 1;;
5187c4641d0SOliver Tappe		--target=*)     TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
5197c4641d0SOliver Tappe		--use-gcc-pipe)	HAIKU_USE_GCC_PIPE=1; shift 1;;
520748c10f2SJerome Duval		--use-gcc-graphite)	HAIKU_USE_GCC_GRAPHITE=1; shift 1;;
5217986925fSIngo Weinhold		--use-32bit)	HAIKU_HOST_USE_32BIT=1; shift 1;;
5227986925fSIngo Weinhold		--use-xattr)	HAIKU_HOST_USE_XATTR=1; shift 1;;
523bc96e8f3SIngo Weinhold		--use-xattr-ref)	HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
524022fa244SIngo Weinhold		*)				echo Invalid argument: \`$1\'; exit 1;;
525022fa244SIngo Weinhold	esac
526022fa244SIngo Weinholddone
527022fa244SIngo Weinhold
5280df3cc9cSIngo Weinhold# detect the build platform
529338b8dc3SIngo Weinholdcase "${platform}" in
5300df3cc9cSIngo Weinhold	BeOS)	revision=`uname -r`
5310df3cc9cSIngo Weinhold			case "$revision" in
5327c4641d0SOliver Tappe				6.*)	HOST_PLATFORM=dano ;;
5337c4641d0SOliver Tappe				5.1)	HOST_PLATFORM=dano ;;
5347c4641d0SOliver Tappe				5.0.4)	HOST_PLATFORM=bone ;;
5357c4641d0SOliver Tappe				5.0*)	HOST_PLATFORM=r5 ;;
5360df3cc9cSIngo Weinhold				*)		echo Unknown BeOS version: $revision
5370df3cc9cSIngo Weinhold						exit 1 ;;
5380df3cc9cSIngo Weinhold			esac
5390df3cc9cSIngo Weinhold			;;
5407c4641d0SOliver Tappe	Darwin)	HOST_PLATFORM=darwin ;;
5417c4641d0SOliver Tappe	FreeBSD)	HOST_PLATFORM=freebsd
542c505b276SFrançois Revol				SFDISK_BINARY=sfdisk-linux
5437986925fSIngo Weinhold				if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
5445abd9a46SIngo Weinhold					echo Unsupported platform: FreeBSD ${platformMachine}
545308c212cSIngo Weinhold					exit 1
546308c212cSIngo Weinhold				fi	;;
5477c4641d0SOliver Tappe	Haiku)	HOST_PLATFORM=haiku_host ;;
5487c4641d0SOliver Tappe	Linux)	HOST_PLATFORM=linux ;;
5497c4641d0SOliver Tappe	OpenBSD) HOST_PLATFORM=openbsd ;;
5507c4641d0SOliver Tappe	SunOS)	HOST_PLATFORM=sunos ;;
5517c4641d0SOliver Tappe	CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
552338b8dc3SIngo Weinhold	*)		echo Unsupported platform: ${platform}
5534cbe4925SAxel Dörfler			exit 1 ;;
5544cbe4925SAxel Dörfleresac
55552a38012Sejakowatz
556c505b276SFrançois Revol# check common locations for sfdisk
557c505b276SFrançois Revolfor sfdiskDir in /sbin /usr/sbin /usr/local/sbin ; do
558c505b276SFrançois Revol	if [ -e ${sfdiskDir}/${SFDISK_BINARY} ]; then
559c505b276SFrançois Revol		HOST_SFDISK=${sfdiskDir}/${SFDISK_BINARY}
560c505b276SFrançois Revol	fi
561c505b276SFrançois Revoldone
562c505b276SFrançois Revol
5630962132cSAlex Smith# check for case-sensitive filesystem
5640962132cSAlex Smithmkdir haikuCaseTest 2>/dev/null
5650962132cSAlex Smithmkdir haikucasetest 2>/dev/null
5660962132cSAlex SmithcaseInsensitive=$?
56797f5a0bdSAlex Smithrmdir haikuCaseTest haikucasetest 2>/dev/null
5680962132cSAlex Smithif [ $caseInsensitive != 0 ]; then
5693ecc5287SMichael Lotz	echo "You need a case-sensitive file-system to build Haiku."
5700962132cSAlex Smith	if [ $HOST_PLATFORM = "darwin" ]; then
5710962132cSAlex Smith		echo "You can create a case-sensitive disk image using Disk Utility and use"
5720962132cSAlex Smith		echo "it to store the Haiku sources on."
5733ecc5287SMichael Lotz	fi
5740962132cSAlex Smith	exit 1
5753ecc5287SMichael Lotzfi
5763ecc5287SMichael Lotz
577338b8dc3SIngo Weinhold# create output directory
5786e7c6fe5SIngo Weinholdmkdir -p "$buildOutputDir" || exit 1
579338b8dc3SIngo Weinhold
5802ebcd86dSIngo Weinholdif [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
5812ebcd86dSIngo Weinhold	invalidCommand=$sourceDir/build/scripts/host_build_only
5822ebcd86dSIngo Weinhold	HAIKU_AR=$invalidCommand
5832ebcd86dSIngo Weinhold	HAIKU_CC=$invalidCommand
5842ebcd86dSIngo Weinhold	HAIKU_LD=$invalidCommand
5852ebcd86dSIngo Weinhold	HAIKU_OBJCOPY=$invalidCommand
5862ebcd86dSIngo Weinhold	HAIKU_RANLIB=$invalidCommand
5872ebcd86dSIngo Weinhold	HAIKU_ELFEDIT=$invalidCommand
5882ebcd86dSIngo Weinhold	HAIKU_YASM=$invalidCommand
5892ebcd86dSIngo Weinhold	HAIKU_STRIP=$invalidCommand
5902ebcd86dSIngo Weinholdelse
591338b8dc3SIngo Weinhold	# build cross tools from sources
592338b8dc3SIngo Weinhold	if [ -n "$buildCrossTools" ]; then
5930837d6c6SJerome Duval		export HAIKU_USE_GCC_GRAPHITE
59420ab75e6SIngo Weinhold		"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
59560d8d8fcSIngo Weinhold			"$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1
5967c4641d0SOliver Tappe		crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-"
597338b8dc3SIngo Weinhold	fi
598338b8dc3SIngo Weinhold
599338b8dc3SIngo Weinhold	# cross tools
600338b8dc3SIngo Weinhold	if [ -n "$crossToolsPrefix" ]; then
601338b8dc3SIngo Weinhold		get_build_tool_path AR ar
602338b8dc3SIngo Weinhold		get_build_tool_path CC gcc
603338b8dc3SIngo Weinhold		get_build_tool_path LD ld
604338b8dc3SIngo Weinhold		get_build_tool_path OBJCOPY objcopy
605338b8dc3SIngo Weinhold		get_build_tool_path RANLIB ranlib
60635f39081SMatt Madia		get_build_tool_path STRIP strip
607338b8dc3SIngo Weinhold	fi
608338b8dc3SIngo Weinhold
609338b8dc3SIngo Weinhold	# prepare gcc settings
610338b8dc3SIngo Weinhold	standard_gcc_settings
611338b8dc3SIngo Weinhold
612b7777272SAlex Smith	# cross tools for gcc4 builds
613b7777272SAlex Smith	if [ -n "$crossToolsPrefix" ]; then
614bd16f0ddSAlex Smith		case $HAIKU_GCC_RAW_VERSION in
615bd16f0ddSAlex Smith			4.*)
616385d69fcSAlex Smith				get_build_tool_path ELFEDIT elfedit
617bd16f0ddSAlex Smith			;;
618bd16f0ddSAlex Smith		esac
61952a38012Sejakowatz	fi
62052a38012Sejakowatz
621eedc3d0bSIngo Weinhold	# check whether the Haiku compiler really targets Haiku or BeOS
6227c4641d0SOliver Tappe	case "$HAIKU_GCC_MACHINE" in
623eedc3d0bSIngo Weinhold		*-*-haiku)	;;
624eedc3d0bSIngo Weinhold		*-*-beos)	;;
625eedc3d0bSIngo Weinhold		*) echo The compiler specified as Haiku target compiler is not a valid \
626eedc3d0bSIngo Weinhold				Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
627eedc3d0bSIngo Weinhold		echo compiler: $HAIKU_CC
6287c4641d0SOliver Tappe		echo compiler is configured for target: $HAIKU_GCC_MACHINE
629eedc3d0bSIngo Weinhold		exit 1 ;;
630eedc3d0bSIngo Weinhold	esac
6312ebcd86dSIngo Weinholdfi
632eedc3d0bSIngo Weinhold
63352a38012Sejakowatz# Generate BuildConfig
6347c4641d0SOliver Tappecat << EOF > "$buildConfigFile"
63552a38012Sejakowatz# BuildConfig
636ab2540c4SIngo Weinhold# Note: This file has been automatically generated by configure with the
637ab2540c4SIngo Weinhold# following arguments:
63855d267a4SFrançois Revol# ${configureArgs}
63952a38012Sejakowatz
6407c4641d0SOliver TappeTARGET_PLATFORM 			?= "${TARGET_PLATFORM}" ;
6417c4641d0SOliver TappeHOST_PLATFORM				?= "${HOST_PLATFORM}" ;
642338b8dc3SIngo Weinhold
6437c4641d0SOliver TappeHAIKU_INCLUDE_GPL_ADDONS			?= "${HAIKU_INCLUDE_GPL_ADDONS}" ;
6447c4641d0SOliver TappeHAIKU_INCLUDE_PATENTED_CODE			?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
64576fa0be3SIngo WeinholdHAIKU_INCLUDE_SOURCES				?= "${HAIKU_INCLUDE_SOURCES}" ;
6467c4641d0SOliver TappeHAIKU_INCLUDE_3RDPARTY				?= "${HAIKU_INCLUDE_3RDPARTY}" ;
6477c4641d0SOliver TappeHAIKU_ENABLE_MULTIUSER				?= "${HAIKU_ENABLE_MULTIUSER}" ;
6487c4641d0SOliver TappeHAIKU_DISTRO_COMPATIBILITY			?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
6497c4641d0SOliver TappeHAIKU_USE_GCC_PIPE					?= "${HAIKU_USE_GCC_PIPE}" ;
650748c10f2SJerome DuvalHAIKU_USE_GCC_GRAPHITE				?= "${HAIKU_USE_GCC_GRAPHITE}" ;
6517986925fSIngo WeinholdHAIKU_HOST_USE_32BIT				?= "${HAIKU_HOST_USE_32BIT}" ;
6527986925fSIngo WeinholdHAIKU_HOST_USE_XATTR				?= "${HAIKU_HOST_USE_XATTR}" ;
653bc96e8f3SIngo WeinholdHAIKU_HOST_USE_XATTR_REF			?= "${HAIKU_HOST_USE_XATTR_REF}" ;
6542ebcd86dSIngo WeinholdHAIKU_HOST_BUILD_ONLY				?= "${HAIKU_HOST_BUILD_ONLY}" ;
655eccc7665SIngo Weinhold
6567c4641d0SOliver TappeHAIKU_GCC_RAW_VERSION		?= ${HAIKU_GCC_RAW_VERSION} ;
6577c4641d0SOliver TappeHAIKU_GCC_MACHINE			?= ${HAIKU_GCC_MACHINE} ;
658338b8dc3SIngo WeinholdHAIKU_GCC_LIB_DIR			?= ${HAIKU_GCC_LIB_DIR} ;
659338b8dc3SIngo WeinholdHAIKU_GCC_HEADERS_DIR		?= ${HAIKU_GCC_HEADERS_DIR} ;
660338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC			?= ${HAIKU_GCC_LIBGCC} ;
661338b8dc3SIngo Weinhold
662fc8967f1SIngo WeinholdHAIKU_CPU					?= ${HAIKU_CPU} ;
663fc8967f1SIngo WeinholdHAIKU_PACKAGING_ARCH		?= ${HAIKU_PACKAGING_ARCH} ;
664fc8967f1SIngo Weinhold
6657c4641d0SOliver TappeHAIKU_STATIC_LIBSTDC++		?= ${HAIKU_STATIC_LIBSTDCXX} ;
6667c4641d0SOliver TappeHAIKU_SHARED_LIBSTDC++		?= ${HAIKU_SHARED_LIBSTDCXX} ;
6677c4641d0SOliver TappeHAIKU_STATIC_LIBSUPC++		?= ${HAIKU_STATIC_LIBSUPCXX} ;
6687c4641d0SOliver TappeHAIKU_SHARED_LIBSUPC++		?= ${HAIKU_SHARED_LIBSUPCXX} ;
6697c4641d0SOliver TappeHAIKU_C++_HEADERS_DIR		?= ${HAIKU_CXX_HEADERS_DIR} ;
6708b5934c9SIngo Weinhold
671c864ba1aSAlex SmithHAIKU_KERNEL_LIBGCC			?= ${HAIKU_KERNEL_LIBGCC} ;
672c864ba1aSAlex SmithHAIKU_KERNEL_LIBSUPC++		?= ${HAIKU_KERNEL_LIBSUPCXX} ;
67365ad1ba3SAlex SmithHAIKU_BOOT_LIBGCC			?= ${HAIKU_BOOT_LIBGCC} ;
67465ad1ba3SAlex SmithHAIKU_BOOT_LIBSUPC++		?= ${HAIKU_BOOT_LIBSUPCXX} ;
67565ad1ba3SAlex Smith
6767c4641d0SOliver TappeHAIKU_BUILD_ATTRIBUTES_DIR	?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
677338b8dc3SIngo Weinhold
678338b8dc3SIngo WeinholdHAIKU_AR					?= ${HAIKU_AR} ;
679338b8dc3SIngo WeinholdHAIKU_CC					?= ${HAIKU_CC} ;
680338b8dc3SIngo WeinholdHAIKU_LD					?= ${HAIKU_LD} ;
681338b8dc3SIngo WeinholdHAIKU_OBJCOPY				?= ${HAIKU_OBJCOPY} ;
682338b8dc3SIngo WeinholdHAIKU_RANLIB				?= ${HAIKU_RANLIB} ;
683385d69fcSAlex SmithHAIKU_ELFEDIT				?= ${HAIKU_ELFEDIT} ;
68477e84f21SIngo WeinholdHAIKU_YASM					?= ${HAIKU_YASM} ;
68535f39081SMatt MadiaHAIKU_STRIP					?= ${HAIKU_STRIP} ;
686338b8dc3SIngo WeinholdHAIKU_CPPFLAGS				?= ${HAIKU_CPPFLAGS} ;
687338b8dc3SIngo WeinholdHAIKU_CCFLAGS				?= ${HAIKU_CCFLAGS} ;
6880d47dc5dSAlex SmithHAIKU_C++FLAGS				?= ${HAIKU_CXXFLAGS} ;
689338b8dc3SIngo WeinholdHAIKU_LDFLAGS				?= ${HAIKU_LDFLAGS} ;
690338b8dc3SIngo WeinholdHAIKU_ARFLAGS				?= ${HAIKU_ARFLAGS} ;
691338b8dc3SIngo WeinholdHAIKU_UNARFLAGS				?= ${HAIKU_UNARFLAGS} ;
692338b8dc3SIngo Weinhold
6937c4641d0SOliver TappeHOST_GCC_RAW_VERSION		?= ${HOST_GCC_RAW_VERSION} ;
6947c4641d0SOliver TappeHOST_GCC_MACHINE			?= ${HOST_GCC_MACHINE} ;
6957c4641d0SOliver TappeHOST_LD						?= ${HOST_GCC_LD} ;
6967c4641d0SOliver TappeHOST_OBJCOPY				?= ${HOST_GCC_OBJCOPY} ;
697c505b276SFrançois RevolHOST_SFDISK					?= ${HOST_SFDISK} ;
6982a5d0aafSIngo WeinholdHOST_SHA256					?= ${HOST_SHA256} ;
6998b5934c9SIngo Weinhold
700*e173a1ecSIngo WeinholdHOST_HAIKU_PORTER			?= ${HOST_HAIKU_PORTER} ;
701*e173a1ecSIngo WeinholdHAIKU_PORTS					?= ${HAIKU_PORTS} ;
702*e173a1ecSIngo WeinholdHAIKU_PORTS_CROSS			?= ${HAIKU_PORTS_CROSS} ;
703*e173a1ecSIngo Weinhold
704c4786ea6SlilloEOF
705c4786ea6Slillo
706b1e5b60cSAxel Dörfler# Libgcc.a objects
707b1e5b60cSAxel Dörfler
7086e7c6fe5SIngo Weinholdcat << EOF > "$buildOutputDir/libgccObjects"
709b1e5b60cSAxel Dörfler# libgcc.a objects to be linked against libroot.so
710b1e5b60cSAxel Dörfler# Note: This file has been automatically generated by configure.
711b1e5b60cSAxel Dörfler
712338b8dc3SIngo WeinholdHAIKU_GCC_LIBGCC_OBJECTS	?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
713b1e5b60cSAxel DörflerEOF
714b1e5b60cSAxel Dörfler
7159b0dd528SIngo Weinhold# Generate a boot strap Jamfile in the output directory.
716338b8dc3SIngo Weinhold
717338b8dc3SIngo Weinholdcat << EOF > $outputDir/Jamfile
718338b8dc3SIngo Weinhold# automatically generated Jamfile
719338b8dc3SIngo Weinhold
720338b8dc3SIngo WeinholdHAIKU_TOP			= ${sourceDir} ;
721338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR	= ${outputDir} ;
722338b8dc3SIngo Weinhold
723338b8dc3SIngo Weinholdinclude [ FDirName \$(HAIKU_TOP) Jamfile ] ;
724338b8dc3SIngo Weinhold
725338b8dc3SIngo WeinholdEOF
726