3 # configure [ <options> ]
15 --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
16 Prepare for a bootstrap build. No pre-built
17 packages will be used, instead they will be built
18 from the sources (in several phases).
19 <haikuporter> is the path to the haikuporter tool
20 suitable for the host platform.
21 <HaikuPorts cross repo> is the path to a checked
22 out HaikuPorts cross-compilation repository.
23 <HaikuPorts repo> is the path to a checked out
24 HaikuPorts repository.
25 --build-cross-tools <arch> [ <build tools dir> ]
26 Assume cross compilation. <build tools dir>
27 defines the location of the build tools sources.
28 They will be compiled and placed in the output
29 directory under "cross-tools". The HAIKU_* tools
30 variables will be set accordingly.
31 <arch> specifies the target architecture, either
32 "x86_gcc2", "x86", "x86_64", "ppc", "m68k", "arm"
33 This option and --cross-tools-prefix can be
34 specified multiple times. The first cross tools
35 specify the primary tools, the subsequent ones the
36 secondary tools (for "hybrid" images).
37 For the first --build-cross-tools the
38 <build tools dir> argument must be specified and
39 for the subsequent ones it must be omitted.
40 --cross-tools-prefix <prefix>
41 Assume cross compilation. <prefix> should be a
42 path to the directory where the cross
43 compilation tools are located, plus the platform
44 prefix, e.g. "/path/to/tools/i586-pc-haiku-".
45 This overrides the HAIKU_* tool variables.
46 --distro-compatibility <level>
47 The distribution's level of compatibility with
48 the official Haiku distribution. The generated
49 files will contain the respective trademarks
51 official -- the official Haiku distribution.
52 compatible -- a Haiku Compatible (tm) distro.
53 default -- any other distro (default value).
54 --enable-multiuser Enable experimental multiuser support.
55 --help Prints out this help.
56 --host-only Configure for building tools for the build host
57 only. Haiku cannot be built when configured like
59 --include-patented-code Enable code that is known to implemented patented
60 ideas and techniques. If this option is not
61 specified, the resulting distribution may still
62 implement patented ideas and techniques. This
63 option only disables code that is currently known
65 --include-sources Includes the source code of projects that require
66 either an offer of source code or a copy of the
67 patched sources. This is preferable when
68 distributing on physical mediums.
69 --include-3rdparty Include 3rdparty/ in the build system.
70 -j<n> Only relevant for --build-cross-tools. Is passed
71 on to the make building the build tools.
72 --no-downloads Do not download anything. Useful when trying to
73 bootstrap and build Haiku from source only.
74 --target=TARGET Select build target platform.
75 [default=${TARGET_PLATFORM}]
76 valid targets=r5,bone,dano,haiku
77 --target-arch <arch> Haiku only: Specify the target architecture to
78 build for. Must be one of the architectures of the
79 host system. The installed build tools for that
80 architecture will be used.
81 This option can be specified multiple times. The
82 first occurrence specifies the primary
83 architecture of the Haiku to build, subsequent
84 ones the secondary architectures.
85 --update re-runs last configure invocation [must be given
87 --use-clang <arch> Build with host Clang instead of GCC cross
88 compiler, targeting <arch>
89 --use-gcc-pipe Build with GCC option -pipe. Speeds up the build
90 process, but uses more memory.
91 --use-gcc-graphite Build with GCC Graphite engine for loop
92 optimizations. Only for gcc 4.
93 --use-32bit Use -m32 flag on 64bit host gcc compiler.
94 --use-xattr Use Linux xattr respectively *BSD extattr support
95 for BeOS attribute emulation. Warning: Make sure
96 your file system supports sufficient attribute
97 sizes (4 KB per file for all attributes won't
99 --use-xattr-ref Use the generic BeOS attribute emulation, but use
100 Linux xattr respectively *BSD extattr support to
101 make it more robust (i.e. attribute mix-ups become
103 --with-gdb <gdb sources dir>
104 specify the path to a GDB source dir, to build
105 GDB for each arch we build the cross-tools for.
107 environment variables:
108 CC The host compiler. Defaults to "gcc".
109 HAIKU_AR_<arch> The static library archiver for <arch>.
111 HAIKU_CC_<arch> The compiler for <arch>. Defaults to "gcc".
112 HAIKU_LD_<arch> The <arch> linker. Defaults to "ld".
113 HAIKU_OBJCOPY_<arch> The <arch> objcopy to be used. Defaults to
115 HAIKU_RANLIB_<arch> The static library indexer for <arch>. Defaults
117 HAIKU_STRIP_<arch> The <arch> strip command. Defaults to "strip".
118 HAIKU_NASM The nasm assembler (x86 and x86_64 only).
119 HAIKU_CPPFLAGS_<arch> The preprocessor flags for target architecture
120 <arch>. Defaults to "".
121 HAIKU_CCFLAGS_<arch> The C flags for target architecture <arch>.
123 HAIKU_CXXFLAGS_<arch> The C++ flags for target architecture <arch>.
125 HAIKU_LDFLAGS_<arch> The linker flags for target architecture <arch>.
127 HAIKU_ARFLAGS_<arch> The flags passed to HAIKU_AR for target
128 architecture <arch> for archiving. Defaults to
130 HAIKU_UNARFLAGS_<arch> The flags passed to HAIKU_AR for target
131 architecture <arch> for unarchiving. Defaults to
134 Non-default output directories:
135 By default all objects, build configuration, and other related files are
136 stored in /path/to/haiku_source/generated. To store objects in a non-default
137 location, run "../../relative/path/to/haiku_source/configure <options>" from
138 within your non-default location. "jam [ options ] targets" can then be run
139 directly inside your non-default location. Another option is to invoke "jam
140 [ options ] targets" from within haiku_source. This can be accomplished by
141 either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
142 jam or by creating a symlink of haiku_source/generated pointing to your
143 non-default location and running jam.
151 # Checks whether at least one parameter is left.
155 if [ $2 -lt 2 ]; then
156 echo $0: \
`$1\': Parameter expected.
163 # Checks whether at least a certain number of parameters is left.
167 if [ $3 -le $2 ]; then
168 echo $0: \`$1\': Not enough parameters.
175 # returns the absolute path of a given path.
179 if [ "x$1" != "x${1#/}" ]; then
188 # check if a directory exists or not
201 # check if a file exists or not
214 # returns the realpath of a symbolic link.
218 perl
-MCwd=realpath
-e'print realpath($ARGV[0]), "\n"' "$1"
221 # standard_gcc_settings
223 # Sets the variables for a GCC platform.
225 standard_gcc_settings
()
229 if which greadlink
> /dev
/null
2>&1; then
230 readlink
="greadlink -e"
231 elif which realpath
> /dev
/null
2>&1; then
233 elif readlink
-e / > /dev
/null
2>&1; then
234 readlink
="readlink -e"
240 local gcclib
=`$gcc -print-libgcc-file-name`
241 local gccdir
=`dirname ${gcclib}`
243 local gccRawVersion
=`$gcc -dumpversion`
244 local gccMachine
=`$gcc -dumpmachine`
246 # determine architecture from machine triple
248 arm-
*) targetCpu
=arm
;;
249 i?
86-*) targetCpu
=x86
;;
250 m68k-
*) targetCpu
=m68k
;;
251 powerpc-
*) targetCpu
=ppc
;;
252 x86_64-
*) targetCpu
=x86_64
;;
254 echo "Unsupported gcc target machine: $gccMachine" >&2
259 local targetArch
=$targetCpu
261 case $gccRawVersion in
263 # check for correct (most up-to-date) legacy compiler and complain
264 # if an older one is installed
265 if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then
266 echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
267 echo "Please download it from www.haiku-os.org...";
280 # Boot loader is 32-bit, need the 32-bit libs and c++ config
281 bootLibgcc
=`$gcc -m32 -print-file-name=libgcc.a`
282 bootLibSupCxx
=`$gcc -m32 -print-file-name=libsupc++.a`
284 local headersBase
=$gccdir/..
/..
/..
/..
285 local headers
=$headersBase/$gccMachine/include
/c
++/$gccRawVersion
286 if [ ! -d $headers ]; then
287 headers
=$headersBase/include
/c
++/$gccRawVersion
289 bootCxxHeaders
="$headers/$gccMachine/32"
293 # determine whether graphite loop optimization should/can be used
294 local useGraphite
=`get_variable HAIKU_USE_GCC_GRAPHITE_$targetCpu`
295 if [ -z "$useGraphite" ]; then
296 useGraphite
=$useGccGraphiteDefault
299 if [ "$useGraphite" != 0 ]; then
300 UNUSED
=`echo "int main() {}" | $gcc -xc -c -floop-block - 2>&1`
302 echo "GCC Graphite loop optimizations cannot be used on $targetArch"
307 set_variable HAIKU_CPU_
$targetArch $targetCpu
309 get_build_tool_path CC_
$targetArch "$gcc"
310 set_variable HAIKU_CC_IS_CLANG_
$targetArch $useClang
311 set_variable HAIKU_GCC_RAW_VERSION_
$targetArch $gccRawVersion
312 set_variable HAIKU_GCC_MACHINE_
$targetArch $gccMachine
313 set_variable HAIKU_GCC_LIB_DIR_
$targetArch $gccdir
314 set_variable HAIKU_BOOT_CXX_HEADERS_DIR_
$targetArch "$bootCxxHeaders"
315 set_variable HAIKU_BOOT_LIBSUPCXX_
$targetArch "$bootLibSupCxx"
316 set_variable HAIKU_BOOT_LIBGCC_
$targetArch $bootLibgcc
317 set_variable HAIKU_USE_GCC_GRAPHITE_
$targetArch $useGraphite
319 standard_gcc_settings_targetArch
=$targetArch
324 # Set the value of a variable.
333 # Echo the value of a variable.
342 # Set the value for a variable, if no value is set yet.
349 # get_build_tool_path
351 # Gets a usable absolute path of a build tool.
353 get_build_tool_path
()
356 local varval
="`get_variable $var`"
359 if [ ! -z "$varval" ]; then
360 # this variable is already set (probably by user) so grab its contents
364 local path
=${cmd%% *}
366 if [ -f "$path" ]; then
367 # get absolute path from relative path
369 cd "`dirname "$path"`"
370 path
="`pwd`/`basename "$path"`"
373 which "$path" > /dev
/null
2>&1 ||
{
374 echo "Build tool \"$path\" not found (maybe specify it in $var?)" >&2
379 if test "${cmd#* }" != "$cmd"; then
380 # $cmd contains arguments, so preserve them (and only them)
383 # $cmd does not contain arguments, so unset it
386 eval "$var=\"$path $cmd\""
392 for element
in $2; do
393 if [ "$1" = "$element" ]; then
400 # check for --help or -h and show usage immediately
401 if [ "$1" = "--help" ] ||
[ "$1" = "-h" ]; then
405 # ensure umask is not too restrictive
406 if [ $
(umask) -gt 22 ]; then
407 echo "Your umask is too restrictive (should be: <= 0022; is actually:" $
(umask)")"
411 # get cwd and the source directory
417 # backup the passed arguments
420 # internal default parameter values
423 platformMachine
=`uname -m`
426 buildCrossToolsScript
="$sourceDir/build/scripts/build_cross_tools"
429 useGccGraphiteDefault
=0
434 if [ -z "$CC" ]; then
438 # exported (BuildSetup) default parameter values
440 HOST_GCC_RAW_VERSION
=`$CC -dumpversion`
441 HOST_GCC_MACHINE
=`$CC -dumpmachine`
442 HAIKU_INCLUDE_PATENTED_CODE
=0
443 HAIKU_INCLUDE_SOURCES
=0
444 HAIKU_INCLUDE_3RDPARTY
=0
445 HAIKU_ENABLE_MULTIUSER
=0
446 HAIKU_DISTRO_COMPATIBILITY
=default
447 TARGET_PLATFORM
=haiku
449 HAIKU_HOST_USE_32BIT
=0
450 HAIKU_HOST_USE_XATTR
=0
451 HAIKU_HOST_USE_XATTR_REF
=0
452 HAIKU_HOST_BUILD_ONLY
=0
453 HOST_EXTENDED_REGEX_SED
="sed -r"
454 HOST_GCC_LD
=`$CC -print-prog-name=ld`
455 HOST_GCC_OBJCOPY
=`$CC -print-prog-name=objcopy`
464 HAIKU_PACKAGING_ARCHS
=
466 set_default_value HAIKU_NASM nasm
468 if sha256sum
< /dev
/null
> /dev
/null
2>&1; then
469 HOST_SHA256
=sha256sum
470 elif sha256
< /dev
/null
> /dev
/null
2>&1; then
471 HOST_SHA256
="sha256 -q"
472 elif shasum
< /dev
/null
> /dev
/null
2>&1; then
473 HOST_SHA256
="shasum -a 256"
475 echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
479 haikuRequiredLegacyGCCVersion
="2.95.3-haiku-2017_07_20"
480 export haikuRequiredLegacyGCCVersion
481 # version of legacy gcc required to build haiku
482 supportedTargetArchs
="
491 # determine output directory
492 if [ "$currentDir" = "$sourceDir" ]; then
493 outputDir
=$currentDir/generated
495 outputDir
=$currentDir
497 buildOutputDir
="$outputDir/build"
498 HAIKU_BUILD_ATTRIBUTES_DIR
="$outputDir/attributes"
499 buildConfigFile
="$buildOutputDir/BuildConfig"
501 # check for update request
502 if [ "$1" = "--update" ]; then
503 if ! [ -e "$buildConfigFile" ]; then
504 echo $0 --update: \'$buildConfigFile\' not found
- updating not possible.
507 if ! type perl
>/dev
/null
2>&1; then
508 echo $0 --update: \'perl
\' not found
- updating not possible.
511 # convert BuildConfig from jam format to shell format and evaluate it
512 shellConfigFile
="${buildConfigFile}.shell"
513 perl
"$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
514 <"$buildConfigFile" >"$shellConfigFile"
516 rm "$shellConfigFile"
522 while [ $# -gt 0 ] ; do
525 assertparams
"$1" 3 $#
526 HOST_HAIKU_PORTER
="`absolute_path $2`"
527 HAIKU_PORTS_CROSS
="`absolute_path $3`"
528 HAIKU_PORTS
="`absolute_path $4`"
531 check_file_exists
"$HOST_HAIKU_PORTER" ||
(
532 echo "Invalid path to haikuporter: $HOST_HAIKU_PORTER" >&2
535 check_dir_exists
"$HAIKU_PORTS" ||
(
536 echo "Non-existent directory $HAIKU_PORTS" >&2
539 check_dir_exists
"$HAIKU_PORTS_CROSS" ||
(
540 echo "Non-existent directory $HAIKU_PORTS_CROSS" >&2
546 if [ -z "$buildCrossTools" ]; then
547 assertparams
"$1" 2 $#
556 case "$targetArch" in
557 x86_gcc2
) targetMachine
=i586-pc-haiku
;;
558 x86
) targetMachine
=i586-pc-haiku
;;
559 x86_64
) targetMachine
=x86_64-unknown-haiku
;;
560 ppc
) targetMachine
=powerpc-apple-haiku
;;
561 m68k
) targetMachine
=m68k-unknown-haiku
;;
562 arm
) targetMachine
=arm-unknown-haiku
;;
564 echo "Unsupported target architecture: $2" >&2
568 set_variable buildCrossToolsMachine_
$targetArch $targetMachine
569 targetArchs
="$targetArchs $targetArch"
570 HAIKU_PACKAGING_ARCHS
=
572 --cross-tools-prefix)
574 targetArch
=unknown
${unknownArchIndex}
575 set_variable crossToolsPrefix_
$targetArch "$2"
576 targetArchs
="$targetArchs $targetArch"
577 HAIKU_PACKAGING_ARCHS
=
578 unknownArchIndex
=$
(($unknownArchIndex + 1))
581 --distro-compatibility)
583 HAIKU_DISTRO_COMPATIBILITY
=$2
584 case "$HAIKU_DISTRO_COMPATIBILITY" in
588 *) echo "Invalid distro compatibility" \
589 "level: $HAIKU_DISTRO_COMPATIBILITY"
594 --enable-multiuser) HAIKU_ENABLE_MULTIUSER
=1; shift 1;;
595 --host-only) HAIKU_HOST_BUILD_ONLY
=1; shift 1;;
596 --include-patented-code) HAIKU_INCLUDE_PATENTED_CODE
=1; shift 1;;
597 --include-sources) HAIKU_INCLUDE_SOURCES
=1; shift 1;;
598 --include-3rdparty) HAIKU_INCLUDE_3RDPARTY
=1; shift 1;;
599 -j*) buildCrossToolsJobs
="$1"; shift 1;;
600 --no-downloads) HAIKU_NO_DOWNLOADS
=1; shift 1;;
601 --target=*) TARGET_PLATFORM
=`echo $1 | cut -d'=' -f2-`; shift 1;;
606 if [ ! "$platform" = Haiku
]; then
607 echo "--target-arch can only be specified on Haiku." >&2
610 is_in_list
"$targetArch" "$supportedTargetArchs" ||
(
611 echo "Unsupported target architecture: \"$targetArch\"" >&2
614 haikuTargetArchs
="$haikuTargetArchs $targetArch"
620 case "$targetArch" in
621 x86
) targetMachine
=i586-pc-haiku
;;
622 x86_64
) targetMachine
=x86_64-unknown-haiku
;;
624 echo "Unsupported target architecture: $2" >&2
628 get_build_tool_path clang clang
629 if [ -n "crossToolsPrefix_$targetArch" ]; then
630 set_variable crossToolsPrefix_
$targetArch llvm-
632 targetArchs
="$targetArchs $targetArch"
633 HAIKU_PACKAGING_ARCHS
=
636 --use-gcc-pipe) HAIKU_USE_GCC_PIPE
=1; shift 1;;
637 --use-gcc-graphite) useGccGraphiteDefault
=1; shift 1;;
638 --use-32bit) HAIKU_HOST_USE_32BIT
=1; shift 1;;
639 --use-xattr) HAIKU_HOST_USE_XATTR
=1; shift 1;;
640 --use-xattr-ref) HAIKU_HOST_USE_XATTR_REF
=1; shift 1;;
641 --with-gdb) gdbSources
=$2; shift 2;;
642 *) echo Invalid argument
: \
`$1\'; exit 1;;
646 # detect the build platform
647 case "${platform}" in
648 Darwin) HOST_PLATFORM=darwin ;;
649 FreeBSD) HOST_PLATFORM=freebsd
650 if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
651 echo Unsupported platform: FreeBSD ${platformMachine}
654 Haiku) HOST_PLATFORM=haiku_host ;;
655 Linux) HOST_PLATFORM=linux ;;
656 OpenBSD) HOST_PLATFORM=openbsd ;;
657 SunOS) HOST_PLATFORM=sunos ;;
658 CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
659 *) echo Unsupported platform: ${platform}
663 # check for case-sensitive filesystem
664 mkdir haikuCaseTest 2>/dev/null
665 mkdir haikucasetest 2>/dev/null
667 rmdir haikuCaseTest haikucasetest 2>/dev/null
668 if [ $caseInsensitive != 0 ]; then
669 echo "You need a case-sensitive file-system to build Haiku."
670 if [ $HOST_PLATFORM = "darwin" ]; then
671 echo "You can create a case-sensitive disk image using Disk Utility."
676 # determine how to invoke sed with extended regexp support for non-GNU sed
677 if [ $HOST_PLATFORM = "darwin" ]; then
678 HOST_EXTENDED_REGEX_SED="sed -E"
681 # check if nasm can actually output ELF files
682 # (the stock version in OSX can't)
683 # XXX: should probably only test for x86* arch
684 if [ "$("$HAIKU_NASM" -hf | grep -c elf'[36][24] ')" -ne "2" ]; then
685 echo "$HAIKU_NASM cannot generate ELF files. Please install a working version."
686 if [ $HOST_PLATFORM = "darwin" ]; then
687 echo "You can install it from Mac Ports."
688 echo "Mac Ports is available at: http://www.macports.org/"
693 # create output directory
694 mkdir -p "$buildOutputDir" || exit 1
696 if [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
697 invalidCommand=$sourceDir/build/scripts/host_build_only
698 HAIKU_AR=$invalidCommand
699 HAIKU_CC=$invalidCommand
700 HAIKU_LD=$invalidCommand
701 HAIKU_OBJCOPY=$invalidCommand
702 HAIKU_RANLIB=$invalidCommand
703 HAIKU_ELFEDIT=$invalidCommand
704 HAIKU_NASM=$invalidCommand
705 HAIKU_STRIP=$invalidCommand
707 if [ -n "$HAIKU_PACKAGING_ARCHS" ]; then
708 targetArchs="$HAIKU_PACKAGING_ARCHS"
710 HAIKU_PACKAGING_ARCHS=
712 # On Haiku determine target architectures and tools automatically.
713 if [ -z "$targetArchs" ]; then
714 if [ $HOST_PLATFORM != haiku_host ]; then
715 echo "Please specify the build tools to use or build (via" \
716 "--cross-tools-prefix or --build-cross-tools) or specify a" \
717 "host-only build (--host-only)." >&2
718 echo "For more info, invoke $0 --help"
722 # determine primary architecture
723 targetArch=`package list
-i /system
/packages
/haiku-
*.hpkg \
724 |
sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'`
725 is_in_list "$targetArch" "$supportedTargetArchs" || (
726 echo "Unsupported target architecture: \"$targetArch\"" >&2
729 targetArchs=$targetArch
731 set_default_value HAIKU_AR_$targetArch ar
732 set_default_value HAIKU_CC_$targetArch gcc
733 set_default_value HAIKU_LD_$targetArch ld
734 set_default_value HAIKU_OBJCOPY_$targetArch objcopy
735 set_default_value HAIKU_RANLIB_$targetArch ranlib
736 set_default_value HAIKU_ELFEDIT_$targetArch elfedit
737 set_default_value HAIKU_STRIP_$targetArch strip
739 # determine secondary architectures
740 for targetArch in $supportedTargetArchs; do
741 if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then
742 targetArchs="$targetArchs $targetArch"
743 set_default_value HAIKU_AR_$targetArch ar-$targetArch
744 set_default_value HAIKU_CC_$targetArch gcc-$targetArch
745 set_default_value HAIKU_LD_$targetArch ld-$targetArch
746 set_default_value HAIKU_OBJCOPY_$targetArch objcopy-$targetArch
747 set_default_value HAIKU_RANLIB_$targetArch ranlib-$targetArch
748 set_default_value HAIKU_ELFEDIT_$targetArch elfedit-$targetArch
749 set_default_value HAIKU_STRIP_$targetArch strip-$targetArch
753 # The target architectures might have been specified explicitly.
754 if [ -n "$haikuTargetArchs" ]; then
755 for targetArch in $haikuTargetArchs; do
756 is_in_list "$targetArch" "$targetArchs" || (
757 echo "Unsupported target architecture: \"$targetArch\"." \
758 "Only native architectures of the host platform can" \
763 targetArchs="$haikuTargetArchs"
768 for targetArch in $targetArchs; do
769 # Note: targetArch is "unknown<n>" at this point, if a cross-tools
770 # prefix was specified. The standard_gcc_settings call below will get
771 # the actual architecture.
773 crossToolsPrefix=`get_variable crossToolsPrefix_
$targetArch`
775 # build cross tools from sources
776 if [ -n "$buildCrossTools" -a -z "$crossToolsPrefix" ]; then
777 crossToolsDir="$outputDir/cross-tools-$targetArch"
778 targetMachine=`get_variable buildCrossToolsMachine_
$targetArch`
779 script="$buildCrossToolsScript"
781 if [ $targetArch != x86_gcc2 ]; then
782 script="${script}_gcc4"
783 scriptArgs="$targetMachine"
784 set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch \
785 $useGccGraphiteDefault
788 if [ -z "$isPrimaryArch" ]; then
789 secondaryArch=$targetArch
792 case $HOST_PLATFORM in
793 freebsd|openbsd) MAKE=gmake;;
798 SECONDARY_ARCH=$secondaryArch \
799 HAIKU_USE_GCC_GRAPHITE=`get_variable \
800 HAIKU_USE_GCC_GRAPHITE_
$targetArch` \
801 HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
802 HAIKU_USE_GDB="$gdbSources" \
803 "$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
804 "$crossToolsDir" $buildCrossToolsJobs || exit 1
805 crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
808 # prepare gcc settings and get the actual target architecture
809 if [ $useClang = 1 ]; then
810 gcc="$HAIKU_clang -target ${targetMachine} -no-integrated-as"
812 # Clang's compiler intrinsics are not compatible with GCC's or even
813 # across versions of Clang, so we must collect them for use in the build.
814 mkdir -p "$outputDir/clang_headers" || exit 1
815 clangHeadersDir=`$gcc -print-resource-dir`/include/
816 cp $clangHeadersDir/*intrin* $clangHeadersDir/mm3* "$outputDir/clang_headers" || exit 1
817 elif [ -z "${crossToolsPrefix}" ]; then
818 gcc=`get_variable HAIKU_CC_
$targetArch`
820 gcc="${crossToolsPrefix}gcc"
822 standard_gcc_settings "$gcc"
823 targetArch=$standard_gcc_settings_targetArch
825 # set default values for flags
826 set_default_value HAIKU_CPPFLAGS_$targetArch ""
827 set_default_value HAIKU_CCFLAGS_$targetArch ""
828 set_default_value HAIKU_CXXFLAGS_$targetArch ""
829 set_default_value HAIKU_LDFLAGS_$targetArch ""
830 set_default_value HAIKU_ARFLAGS_$targetArch cru
831 set_default_value HAIKU_UNARFLAGS_$targetArch x
833 # Override the cross tools variables, if the tools were built or a
834 # prefix was specified.
835 if [ -n "$crossToolsPrefix" ]; then
836 get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
837 get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
838 get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy
839 get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib
840 get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip
842 case `get_variable HAIKU_GCC_RAW_VERSION_
$targetArch` in
844 get_build_tool_path ELFEDIT_$targetArch \
845 ${crossToolsPrefix}elfedit
850 # check whether the Haiku compiler really targets Haiku
851 targetMachine=`get_variable HAIKU_GCC_MACHINE_
$targetArch`
852 case "$targetMachine" in
855 echo The compiler specified as Haiku target compiler is not a \
856 valid Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
857 echo compiler: $HAIKU_CC
858 echo compiler is configured for target: $targetMachine
862 HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch"
867 # Generate BuildConfig
868 cat << EOF > "$buildConfigFile"
870 # Note: This file has been automatically generated by configure with the
871 # following arguments:
874 TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
875 HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
877 HAIKU_INCLUDE_PATENTED_CODE ?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
878 HAIKU_INCLUDE_SOURCES ?= "${HAIKU_INCLUDE_SOURCES}" ;
879 HAIKU_INCLUDE_3RDPARTY ?= "${HAIKU_INCLUDE_3RDPARTY}" ;
880 HAIKU_ENABLE_MULTIUSER ?= "${HAIKU_ENABLE_MULTIUSER}" ;
881 HAIKU_DISTRO_COMPATIBILITY ?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
882 HAIKU_USE_GCC_PIPE ?= "${HAIKU_USE_GCC_PIPE}" ;
883 HAIKU_HOST_USE_32BIT ?= "${HAIKU_HOST_USE_32BIT}" ;
884 HAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ;
885 HAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ;
886 HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ;
888 HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ;
890 HAIKU_NO_DOWNLOADS ?= "${HAIKU_NO_DOWNLOADS}" ;
892 HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
894 HAIKU_NASM ?= ${HAIKU_NASM} ;
895 HAIKU_BOOT_BOARD ?= ${HAIKU_BOOT_BOARD} ;
897 HOST_EXTENDED_REGEX_SED ?= ${HOST_EXTENDED_REGEX_SED} ;
898 HOST_GCC_RAW_VERSION ?= ${HOST_GCC_RAW_VERSION} ;
899 HOST_GCC_MACHINE ?= ${HOST_GCC_MACHINE} ;
900 HOST_LD ?= ${HOST_GCC_LD} ;
901 HOST_OBJCOPY ?= ${HOST_GCC_OBJCOPY} ;
902 HOST_SHA256 ?= ${HOST_SHA256} ;
904 HOST_HAIKU_PORTER ?= ${HOST_HAIKU_PORTER} ;
905 HAIKU_PORTS ?= ${HAIKU_PORTS} ;
906 HAIKU_PORTS_CROSS ?= ${HAIKU_PORTS_CROSS} ;
907 HAIKU_IS_BOOTSTRAP ?= ${HAIKU_IS_BOOTSTRAP} ;
911 for targetArch in $HAIKU_PACKAGING_ARCHS; do
913 HAIKU_GCC_RAW_VERSION HAIKU_GCC_RAW_VERSION
914 HAIKU_GCC_MACHINE HAIKU_GCC_MACHINE
915 HAIKU_GCC_LIB_DIR HAIKU_GCC_LIB_DIR
917 HAIKU_BOOT_LIBGCC HAIKU_BOOT_LIBGCC
918 HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX
921 HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG
923 HAIKU_OBJCOPY HAIKU_OBJCOPY
924 HAIKU_RANLIB HAIKU_RANLIB
925 HAIKU_ELFEDIT HAIKU_ELFEDIT
926 HAIKU_STRIP HAIKU_STRIP
927 HAIKU_CPPFLAGS HAIKU_CPPFLAGS
928 HAIKU_CCFLAGS HAIKU_CCFLAGS
929 HAIKU_C++FLAGS HAIKU_CXXFLAGS
930 HAIKU_LDFLAGS HAIKU_LDFLAGS
931 HAIKU_ARFLAGS HAIKU_ARFLAGS
932 HAIKU_UNARFLAGS HAIKU_UNARFLAGS
933 HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE
936 while [ $# -ge 2 ]; do
937 value=`get_variable
${2}_
$targetArch`
938 echo "${1}_${targetArch} ?= $value ;" >> "$buildConfigFile"
942 # For variables that may have long values, distribute them over multiple
943 # lines so that jam doesn't hit the maximum line length.
945 HAIKU_BOOT_C++_HEADERS_DIR HAIKU_BOOT_CXX_HEADERS_DIR
948 while [ $# -ge 2 ]; do
949 echo "${1}_${targetArch} ?= " >> "$buildConfigFile"
950 get_variable ${2}_$targetArch | xargs -n 1 echo " " \
951 >> "$buildConfigFile"
952 echo " ;" >> "$buildConfigFile"
958 # Generate a boot strap Jamfile in the output directory.
960 cat << EOF > $outputDir/Jamfile
961 # automatically generated Jamfile
963 HAIKU_TOP = ${sourceDir} ;
964 HAIKU_OUTPUT_DIR = ${outputDir} ;
966 include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
970 echo "Configured successfully!"