2002-07-09 16:24:59 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2005-10-29 20:27:43 +04:00
|
|
|
# configure [ <options> ]
|
2004-10-18 05:59:54 +04:00
|
|
|
|
2014-04-26 19:25:25 +04:00
|
|
|
# set flag to exit script when exit command is executed
|
|
|
|
set -e
|
|
|
|
|
2002-07-15 02:09:44 +04:00
|
|
|
# usage
|
|
|
|
#
|
|
|
|
# Prints usage.
|
|
|
|
#
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
Usage: $0 <options>
|
|
|
|
options:
|
2013-07-21 06:10:48 +04:00
|
|
|
--bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
|
|
|
|
Prepare for a bootstrap build. No pre-built
|
|
|
|
packages will be used, instead they will be built
|
|
|
|
from the sources (in several phases).
|
|
|
|
<haikuporter> is the path to the haikuporter tool
|
|
|
|
suitable for the host platform.
|
|
|
|
<HaikuPorts cross repo> is the path to a checked
|
|
|
|
out HaikuPorts cross-compilation repository.
|
|
|
|
<HaikuPorts repo> is the path to a checked out
|
|
|
|
HaikuPorts repository.
|
2013-07-26 01:52:11 +04:00
|
|
|
--build-cross-tools <arch> [ <build tools dir> ]
|
2005-10-29 20:27:43 +04:00
|
|
|
Assume cross compilation. <build tools dir>
|
|
|
|
defines the location of the build tools sources.
|
|
|
|
They will be compiled and placed in the output
|
2006-10-04 03:41:59 +04:00
|
|
|
directory under "cross-tools". The HAIKU_* tools
|
|
|
|
variables will be set accordingly.
|
2005-12-07 01:45:11 +03:00
|
|
|
<arch> specifies the target architecture, either
|
2014-02-19 02:27:18 +04:00
|
|
|
"x86_gcc2", "x86", "x86_64", "ppc", "m68k", "arm"
|
2013-07-26 01:52:11 +04:00
|
|
|
This option and --cross-tools-prefix can be
|
|
|
|
specified multiple times. The first cross tools
|
|
|
|
specify the primary tools, the subsequent ones the
|
|
|
|
secondary tools (for "hybrid" images).
|
|
|
|
For the first --build-cross-tools the
|
|
|
|
<build tools dir> argument must be specified and
|
|
|
|
for the subsequent ones it must be omitted.
|
2007-02-04 17:03:21 +03:00
|
|
|
--cross-tools-prefix <prefix>
|
|
|
|
Assume cross compilation. <prefix> should be a
|
|
|
|
path to the directory where the cross
|
|
|
|
compilation tools are located, plus the platform
|
2008-03-24 02:06:23 +03:00
|
|
|
prefix, e.g. "/path/to/tools/i586-pc-haiku-".
|
2007-02-04 17:03:21 +03:00
|
|
|
This overrides the HAIKU_* tool variables.
|
2007-05-20 21:50:11 +04:00
|
|
|
--distro-compatibility <level>
|
|
|
|
The distribution's level of compatibility with
|
|
|
|
the official Haiku distribution. The generated
|
|
|
|
files will contain the respective trademarks
|
|
|
|
accordingly.
|
|
|
|
official -- the official Haiku distribution.
|
|
|
|
compatible -- a Haiku Compatible (tm) distro.
|
|
|
|
default -- any other distro (default value).
|
2009-11-23 22:34:55 +03:00
|
|
|
--enable-multiuser Enable experimental multiuser support.
|
2007-02-04 17:03:21 +03:00
|
|
|
--help Prints out this help.
|
2013-07-04 01:19:00 +04:00
|
|
|
--host-only Configure for building tools for the build host
|
|
|
|
only. Haiku cannot be built when configured like
|
|
|
|
this.
|
2007-02-04 17:03:21 +03:00
|
|
|
--include-gpl-addons Include GPL licensed add-ons.
|
2009-08-21 21:20:23 +04:00
|
|
|
--include-patented-code Enable code that is known to implemented patented
|
|
|
|
ideas and techniques. If this option is not
|
|
|
|
specified, the resulting distribution may still
|
|
|
|
implement patented ideas and techniques. This
|
|
|
|
option only disables code that is currently known
|
|
|
|
to be problematic.
|
2010-02-25 19:13:22 +03:00
|
|
|
--include-sources Includes the source code of projects that require
|
|
|
|
either an offer of source code or a copy of the
|
|
|
|
patched sources. This is preferable when
|
|
|
|
distributing on physical mediums.
|
2008-01-25 17:48:51 +03:00
|
|
|
--include-3rdparty Include 3rdparty/ in the build system.
|
2014-05-12 09:33:31 +04:00
|
|
|
-j<n> Only relevant for --build-cross-tools. Is passed
|
|
|
|
on to the make building the build tools.
|
2014-05-01 01:47:55 +04:00
|
|
|
--no-downloads Do not download anything. Useful when trying to
|
|
|
|
bootstrap and build Haiku from source only.
|
2014-04-27 09:16:02 +04:00
|
|
|
--remote-user <username> Use given username when logging into
|
2014-01-22 12:32:33 +04:00
|
|
|
git.haiku-os.org (via ssh).
|
2010-01-11 05:55:41 +03:00
|
|
|
--target=TARGET Select build target platform.
|
2010-01-04 22:36:58 +03:00
|
|
|
[default=${TARGET_PLATFORM}]
|
2004-10-25 12:44:06 +04:00
|
|
|
valid targets=r5,bone,dano,haiku
|
2013-08-12 19:18:02 +04:00
|
|
|
--target-arch <arch> Haiku only: Specify the target architecture to
|
|
|
|
build for. Must be one of the architectures of the
|
|
|
|
host system. The installed build tools for that
|
|
|
|
architecture will be used.
|
|
|
|
This option can be specified multiple times. The
|
|
|
|
first occurrence specifies the primary
|
|
|
|
architecture of the Haiku to build, subsequent
|
|
|
|
ones the secondary architectures.
|
2014-04-23 00:21:18 +04:00
|
|
|
--target-board <board> ARM only: Specify the board to build for. Must be
|
2014-04-28 02:03:16 +04:00
|
|
|
one of beagle,raspberry_pi,verdex.
|
2010-01-11 05:55:41 +03:00
|
|
|
--update re-runs last configure invocation [must be given
|
2010-01-04 22:36:58 +03:00
|
|
|
as first option!]
|
2014-04-03 20:26:29 +04:00
|
|
|
--use-clang Build with host Clang instead of GCC cross
|
|
|
|
compiler
|
2007-02-04 17:03:21 +03:00
|
|
|
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
|
2007-02-15 12:10:31 +03:00
|
|
|
process, but uses more memory.
|
2013-04-06 16:07:24 +04:00
|
|
|
--use-gcc-graphite Build with GCC Graphite engine for loop
|
|
|
|
optimizations. Only for gcc 4.
|
2007-08-23 02:07:03 +04:00
|
|
|
--use-32bit Use -m32 flag on 64bit host gcc compiler.
|
2013-06-07 04:27:48 +04:00
|
|
|
--use-xattr Use Linux xattr respectively *BSD extattr support
|
|
|
|
for BeOS attribute emulation. Warning: Make sure
|
|
|
|
your file system supports sufficient attribute
|
|
|
|
sizes (4 KB per file for all attributes won't
|
|
|
|
suffice).
|
|
|
|
--use-xattr-ref Use the generic BeOS attribute emulation, but use
|
|
|
|
Linux xattr respectively *BSD extattr support to
|
|
|
|
make it more robust (i.e. attribute mix-ups become
|
|
|
|
less likely).
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
environment variables:
|
2014-07-26 13:21:51 +04:00
|
|
|
CC The host compiler. Defaults to "gcc".
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_AR_x86_gcc2 The static library archiver for x86_gcc2.
|
|
|
|
Defaults to "ar".
|
|
|
|
HAIKU_CC_x86_gcc2 The x86_gcc2 compiler. Defaults to "gcc".
|
|
|
|
HAIKU_LD_x86_gcc2 The x86_gcc2 linker. Defaults to "ld".
|
|
|
|
HAIKU_OBJCOPY_x86_gcc2 The x86_gcc2 objcopy to be used. Defaults to
|
|
|
|
"objcopy".
|
|
|
|
HAIKU_RANLIB_x86_gcc2 The static library indexer for x86_gcc2. Defaults
|
|
|
|
to "ranlib".
|
|
|
|
HAIKU_STRIP_x86_gcc2 The x86_gcc2 strip command. Defaults to "strip".
|
2014-03-29 02:07:04 +04:00
|
|
|
HAIKU_NASM The nasm assembler (x86 and x86_64 only).
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_CPPFLAGS_<arch> The preprocessor flags for target architecture
|
|
|
|
<arch>. Defaults to "".
|
|
|
|
HAIKU_CCFLAGS_<arch> The C flags for target architecture <arch>.
|
|
|
|
Defaults to "".
|
|
|
|
HAIKU_CXXFLAGS_<arch> The C++ flags for target architecture <arch>.
|
|
|
|
Defaults to "".
|
|
|
|
HAIKU_LDFLAGS_<arch> The linker flags for target architecture <arch>.
|
|
|
|
Defaults to "".
|
|
|
|
HAIKU_ARFLAGS_<arch> The flags passed to HAIKU_AR for target
|
|
|
|
architecture <arch> for archiving. Defaults to
|
|
|
|
"cru".
|
|
|
|
HAIKU_UNARFLAGS_<arch> The flags passed to HAIKU_AR for target
|
|
|
|
architecture <arch> for unarchiving. Defaults to
|
|
|
|
"x".
|
|
|
|
|
|
|
|
Non-default output directories:
|
2009-02-24 17:20:24 +03:00
|
|
|
By default all objects, build configuration, and other related files are
|
2009-02-03 04:08:40 +03:00
|
|
|
stored in /path/to/haiku_source/generated. To store objects in a non-default
|
2009-02-24 17:20:24 +03:00
|
|
|
location, run "../../relative/path/to/haiku_source/configure <options>" from
|
|
|
|
within your non-default location. "jam [ options ] targets" can then be run
|
|
|
|
directly inside your non-default location. Another option is to invoke "jam
|
|
|
|
[ options ] targets" from within haiku_source. This can be accomplished by
|
|
|
|
either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking
|
|
|
|
jam or by creating a symlink of haiku_source/generated pointing to your
|
2009-02-03 04:08:40 +03:00
|
|
|
non-default location and running jam.
|
|
|
|
|
|
|
|
|
2002-07-15 02:09:44 +04:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
# assertparam
|
|
|
|
#
|
|
|
|
# Checks whether at least one parameter is left.
|
|
|
|
#
|
|
|
|
assertparam()
|
|
|
|
{
|
2005-12-07 01:45:11 +03:00
|
|
|
if [ $2 -lt 2 ]; then
|
2002-07-15 02:09:44 +04:00
|
|
|
echo $0: \`$1\': Parameter expected.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2005-12-07 01:45:11 +03:00
|
|
|
# assertparams
|
|
|
|
#
|
|
|
|
# Checks whether at least a certain number of parameters is left.
|
|
|
|
#
|
|
|
|
assertparams()
|
|
|
|
{
|
|
|
|
if [ $3 -le $2 ]; then
|
|
|
|
echo $0: \`$1\': Not enough parameters.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-07-21 06:10:48 +04:00
|
|
|
# absolute_path
|
|
|
|
#
|
|
|
|
# returns the absolute path of a given path.
|
|
|
|
#
|
|
|
|
absolute_path()
|
|
|
|
{
|
2013-09-29 01:58:12 +04:00
|
|
|
if [ "x$1" != "x${1#/}" ]; then
|
2013-07-21 06:10:48 +04:00
|
|
|
echo "$1"
|
|
|
|
else
|
|
|
|
echo "`pwd`/$1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-26 19:25:25 +04:00
|
|
|
# check_dir_exists
|
|
|
|
#
|
|
|
|
# check if a directory exists or not
|
|
|
|
#
|
|
|
|
check_dir_exists()
|
|
|
|
{
|
|
|
|
if [ -d "$1" ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-27 09:18:29 +04:00
|
|
|
# check_file_exists
|
|
|
|
#
|
|
|
|
# check if a file exists or not
|
|
|
|
#
|
|
|
|
check_file_exists()
|
|
|
|
{
|
|
|
|
if [ -f "$1" ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-08-30 20:17:36 +04:00
|
|
|
# real_path
|
|
|
|
#
|
|
|
|
# returns the realpath of a symbolic link.
|
|
|
|
#
|
|
|
|
real_path()
|
|
|
|
{
|
|
|
|
perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
|
|
|
|
}
|
|
|
|
|
2003-05-06 02:07:33 +04:00
|
|
|
# standard_gcc_settings
|
|
|
|
#
|
|
|
|
# Sets the variables for a GCC platform.
|
|
|
|
#
|
|
|
|
standard_gcc_settings()
|
|
|
|
{
|
2013-07-26 01:52:11 +04:00
|
|
|
local gcc=$1
|
|
|
|
|
2010-04-20 23:01:53 +04:00
|
|
|
if which greadlink > /dev/null 2>&1; then
|
2010-04-20 07:16:36 +04:00
|
|
|
readlink="greadlink -e"
|
2010-04-20 23:01:53 +04:00
|
|
|
elif which realpath > /dev/null 2>&1; then
|
2010-04-20 07:16:36 +04:00
|
|
|
readlink=realpath
|
2010-08-30 20:17:36 +04:00
|
|
|
elif readlink -e / > /dev/null 2>&1; then
|
2010-04-20 07:16:36 +04:00
|
|
|
readlink="readlink -e"
|
2010-08-30 20:17:36 +04:00
|
|
|
else
|
|
|
|
readlink=real_path
|
2010-04-20 06:36:56 +04:00
|
|
|
fi
|
2010-04-20 23:01:53 +04:00
|
|
|
|
2003-05-06 02:07:33 +04:00
|
|
|
# PLATFORM_LINKLIBS
|
2013-07-26 01:52:11 +04:00
|
|
|
local gcclib=`$gcc -print-libgcc-file-name`
|
|
|
|
local gccdir=`dirname ${gcclib}`
|
2006-09-03 21:22:48 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
local gccRawVersion=`$gcc -dumpversion`
|
|
|
|
local gccMachine=`$gcc -dumpmachine`
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2013-07-20 03:01:21 +04:00
|
|
|
# determine architecture from machine triple
|
2013-07-26 01:52:11 +04:00
|
|
|
case $gccMachine in
|
|
|
|
arm-*) targetCpu=arm;;
|
|
|
|
i?86-*) targetCpu=x86;;
|
|
|
|
m68k-*) targetCpu=m68k;;
|
|
|
|
powerpc-*) targetCpu=ppc;;
|
|
|
|
x86_64-*) targetCpu=x86_64;;
|
2013-07-20 03:01:21 +04:00
|
|
|
*)
|
2013-07-26 01:52:11 +04:00
|
|
|
echo "Unsupported gcc target machine: $gccMachine" >&2
|
2013-07-20 03:01:21 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
local targetArch=$targetCpu
|
2013-07-20 03:01:21 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
case $gccRawVersion in
|
2006-11-16 22:52:27 +03:00
|
|
|
2.9*)
|
2006-09-03 21:22:48 +04:00
|
|
|
# check for correct (most up-to-date) legacy compiler and complain
|
|
|
|
# if an older one is installed
|
2013-07-26 01:52:11 +04:00
|
|
|
if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then
|
2006-09-03 21:22:48 +04:00
|
|
|
echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
|
|
|
|
echo "Please download it from www.haiku-os.org...";
|
|
|
|
exit 1;
|
|
|
|
fi
|
2012-08-16 20:38:01 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
targetArch=x86_gcc2
|
2013-07-20 03:01:21 +04:00
|
|
|
;;
|
2005-11-13 01:58:54 +03:00
|
|
|
esac
|
2012-05-27 00:47:27 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
local bootLibgcc
|
|
|
|
local bootLibSupCxx
|
2014-01-16 01:41:27 +04:00
|
|
|
local bootCxxHeaders
|
2013-07-26 01:52:11 +04:00
|
|
|
case $gccMachine in
|
2012-08-18 22:48:55 +04:00
|
|
|
x86_64-*)
|
2014-01-16 01:41:27 +04:00
|
|
|
# Boot loader is 32-bit, need the 32-bit libs and c++ config
|
2014-08-01 16:53:45 +04:00
|
|
|
bootLibgcc=`$gcc -m32 -print-file-name=libgcc.a`
|
2013-07-26 01:52:11 +04:00
|
|
|
bootLibSupCxx=`$gcc -m32 -print-file-name=libsupc++.a`
|
2014-01-16 01:41:27 +04:00
|
|
|
|
|
|
|
local headersBase=$gccdir/../../../..
|
|
|
|
local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion
|
|
|
|
if [ ! -d $headers ]; then
|
|
|
|
headers=$headersBase/include/c++/$gccRawVersion
|
|
|
|
fi
|
|
|
|
bootCxxHeaders="$headers/$gccMachine/32"
|
2013-07-20 03:01:21 +04:00
|
|
|
;;
|
2005-11-13 01:58:54 +03:00
|
|
|
esac
|
2013-07-26 01:52:11 +04:00
|
|
|
|
|
|
|
# determine whether graphite loop optimization should/can be used
|
|
|
|
local useGraphite=`get_variable HAIKU_USE_GCC_GRAPHITE_$targetCpu`
|
|
|
|
if [ -z "$useGraphite" ]; then
|
|
|
|
useGraphite=$useGccGraphiteDefault
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$useGraphite" != 0 ]; then
|
|
|
|
UNUSED=`echo "int main() {}" | $gcc -xc -c -floop-block - 2>&1`
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo "GCC Graphite loop optimizations cannot be used on $targetArch"
|
|
|
|
useGraphite=0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
set_variable HAIKU_CPU_$targetArch $targetCpu
|
|
|
|
|
|
|
|
get_build_tool_path CC_$targetArch "$gcc"
|
2014-04-03 20:26:29 +04:00
|
|
|
if [ $useClang = 1 ]; then
|
|
|
|
# The get_build_tool_path above is needed to get the path to the rest
|
|
|
|
# of the build tools
|
|
|
|
local path=`dirname $(get_variable HAIKU_CC_$targetArch)`
|
|
|
|
set_variable HAIKU_CC_$targetArch \
|
|
|
|
"PATH=\\\"$path:\\\$PATH\\\" clang -target $gccMachine"
|
|
|
|
set_variable HAIKU_CC_IS_CLANG_$targetArch 1
|
|
|
|
else
|
|
|
|
set_variable HAIKU_CC_IS_CLANG_$targetArch 0
|
|
|
|
fi
|
2013-07-26 01:52:11 +04:00
|
|
|
set_variable HAIKU_GCC_RAW_VERSION_$targetArch $gccRawVersion
|
|
|
|
set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine
|
|
|
|
set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir
|
2014-08-01 16:53:45 +04:00
|
|
|
set_variable HAIKU_BOOT_CXX_HEADERS_DIR_$targetArch "$bootCxxHeaders"
|
2013-07-26 01:52:11 +04:00
|
|
|
set_variable HAIKU_BOOT_LIBSUPCXX_$targetArch "$bootLibSupCxx"
|
|
|
|
set_variable HAIKU_BOOT_LIBGCC_$targetArch $bootLibgcc
|
|
|
|
set_variable HAIKU_USE_GCC_GRAPHITE_$targetArch $useGraphite
|
|
|
|
|
|
|
|
standard_gcc_settings_targetArch=$targetArch
|
|
|
|
}
|
|
|
|
|
|
|
|
# set_variable
|
|
|
|
#
|
|
|
|
# Set the value of a variable.
|
|
|
|
#
|
|
|
|
set_variable()
|
|
|
|
{
|
|
|
|
eval "$1=\"$2\""
|
|
|
|
}
|
|
|
|
|
|
|
|
# get_variable
|
|
|
|
#
|
|
|
|
# Echo the value of a variable.
|
|
|
|
#
|
|
|
|
get_variable()
|
|
|
|
{
|
|
|
|
eval "echo \${$1}"
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# set_default_value
|
|
|
|
#
|
|
|
|
# Set the value for a variable, if no value is set yet.
|
|
|
|
#
|
|
|
|
set_default_value()
|
|
|
|
{
|
2006-01-11 11:36:21 +03:00
|
|
|
eval "$1=\${$1-$2}"
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# get_build_tool_path
|
|
|
|
#
|
|
|
|
# Gets a usable absolute path of a build tool.
|
|
|
|
#
|
|
|
|
get_build_tool_path()
|
|
|
|
{
|
|
|
|
local var="HAIKU_$1"
|
2013-07-26 01:52:11 +04:00
|
|
|
local path=$2
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if [ -f "$path" ]; then
|
|
|
|
# get absolute path
|
2008-04-12 06:40:10 +04:00
|
|
|
local oldPwd="`pwd`"
|
|
|
|
cd "`dirname "$path"`"
|
|
|
|
path="`pwd`/`basename "$path"`"
|
2005-10-29 20:27:43 +04:00
|
|
|
cd $oldPwd
|
|
|
|
else
|
2010-04-20 06:18:54 +04:00
|
|
|
which "$path" > /dev/null 2>&1 || {
|
2005-10-29 20:27:43 +04:00
|
|
|
echo "Build tool \"$path\" not found." >&2
|
|
|
|
exit 1
|
|
|
|
}
|
2004-07-05 22:35:35 +04:00
|
|
|
fi
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
eval "$var=$path"
|
2003-05-06 02:07:33 +04:00
|
|
|
}
|
|
|
|
|
2013-08-12 19:18:02 +04:00
|
|
|
is_in_list()
|
|
|
|
{
|
|
|
|
local element
|
|
|
|
for element in $2; do
|
|
|
|
if [ "$1" = "$element" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2014-08-30 23:39:53 +04:00
|
|
|
# check for --help or -h and show usage immediately
|
|
|
|
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
2014-07-26 13:39:30 +04:00
|
|
|
usage; exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# get cwd and the source directory
|
|
|
|
currentDir=`pwd`
|
2006-08-03 21:57:34 +04:00
|
|
|
cd `dirname "$0"`
|
2005-10-29 20:27:43 +04:00
|
|
|
sourceDir=`pwd`
|
2006-08-03 21:57:34 +04:00
|
|
|
cd "$currentDir"
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2010-01-03 06:05:12 +03:00
|
|
|
# backup the passed arguments
|
|
|
|
configureArgs="$@"
|
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
# internal default parameter values
|
2002-07-15 02:09:44 +04:00
|
|
|
#
|
2002-07-09 16:24:59 +04:00
|
|
|
platform=`uname`
|
2009-02-24 17:20:24 +03:00
|
|
|
platformMachine=`uname -m`
|
2013-07-26 01:52:11 +04:00
|
|
|
targetArchs=
|
2005-10-29 20:27:43 +04:00
|
|
|
buildCrossTools=
|
2005-11-18 17:17:04 +03:00
|
|
|
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
2009-11-23 22:34:55 +03:00
|
|
|
buildCrossToolsJobs=
|
2014-04-03 20:26:29 +04:00
|
|
|
useClang=0
|
2013-07-26 01:52:11 +04:00
|
|
|
useGccGraphiteDefault=0
|
|
|
|
unknownArchIndex=1
|
2013-08-12 19:18:02 +04:00
|
|
|
haikuTargetArchs=
|
2010-01-04 22:36:58 +03:00
|
|
|
|
2014-07-26 13:21:51 +04:00
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
CC=gcc
|
|
|
|
fi
|
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
# exported (BuildSetup) default parameter values
|
|
|
|
#
|
2014-07-26 13:21:51 +04:00
|
|
|
HOST_GCC_RAW_VERSION=`$CC -dumpversion`
|
|
|
|
HOST_GCC_MACHINE=`$CC -dumpmachine`
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_INCLUDE_GPL_ADDONS=0
|
|
|
|
HAIKU_INCLUDE_PATENTED_CODE=0
|
2010-02-25 19:13:22 +03:00
|
|
|
HAIKU_INCLUDE_SOURCES=0
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_INCLUDE_3RDPARTY=0
|
|
|
|
HAIKU_ENABLE_MULTIUSER=0
|
|
|
|
HAIKU_DISTRO_COMPATIBILITY=default
|
|
|
|
TARGET_PLATFORM=haiku
|
|
|
|
HAIKU_USE_GCC_PIPE=0
|
2010-02-04 00:21:39 +03:00
|
|
|
HAIKU_HOST_USE_32BIT=0
|
|
|
|
HAIKU_HOST_USE_XATTR=0
|
2013-06-07 04:27:48 +04:00
|
|
|
HAIKU_HOST_USE_XATTR_REF=0
|
2013-07-04 01:19:00 +04:00
|
|
|
HAIKU_HOST_BUILD_ONLY=0
|
2013-09-29 23:27:47 +04:00
|
|
|
HOST_EXTENDED_REGEX_SED="sed -r"
|
2014-07-26 13:21:51 +04:00
|
|
|
HOST_GCC_LD=`$CC -print-prog-name=ld`
|
|
|
|
HOST_GCC_OBJCOPY=`$CC -print-prog-name=objcopy`
|
2013-07-06 04:17:15 +04:00
|
|
|
HOST_SHA256=
|
2013-07-21 06:10:48 +04:00
|
|
|
HOST_HAIKU_PORTER=
|
|
|
|
HAIKU_PORTS=
|
|
|
|
HAIKU_PORTS_CROSS=
|
2014-04-23 00:21:18 +04:00
|
|
|
HAIKU_BOOT_BOARD=
|
2014-05-01 01:47:55 +04:00
|
|
|
HAIKU_NO_DOWNLOADS=0
|
2013-07-06 04:17:15 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_PACKAGING_ARCHS=
|
|
|
|
|
2014-03-29 02:07:04 +04:00
|
|
|
set_default_value HAIKU_NASM nasm
|
2013-07-26 01:52:11 +04:00
|
|
|
|
2013-07-06 14:19:46 +04:00
|
|
|
if sha256sum < /dev/null > /dev/null 2>&1; then
|
2013-07-06 04:17:15 +04:00
|
|
|
HOST_SHA256=sha256sum
|
2013-07-06 14:19:46 +04:00
|
|
|
elif sha256 < /dev/null > /dev/null 2>&1; then
|
2013-07-06 04:17:15 +04:00
|
|
|
HOST_SHA256="sha256 -q"
|
2013-09-29 12:21:06 +04:00
|
|
|
elif shasum < /dev/null > /dev/null 2>&1; then
|
|
|
|
HOST_SHA256="shasum -a 256"
|
2013-07-06 04:17:15 +04:00
|
|
|
else
|
|
|
|
echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2014-07-28 13:14:33 +04:00
|
|
|
haikuRequiredLegacyGCCVersion="2.95.3-haiku-2014_07_26"
|
2008-04-12 06:40:10 +04:00
|
|
|
export haikuRequiredLegacyGCCVersion
|
2006-09-16 19:40:36 +04:00
|
|
|
# version of legacy gcc required to build haiku
|
2013-08-12 19:18:02 +04:00
|
|
|
supportedTargetArchs="
|
|
|
|
arm
|
|
|
|
m68k
|
|
|
|
ppc
|
|
|
|
x86
|
|
|
|
x86_64
|
|
|
|
x86_gcc2
|
|
|
|
"
|
2014-04-23 00:21:18 +04:00
|
|
|
supportedTargetBoards="
|
|
|
|
beagle
|
2014-04-28 02:03:16 +04:00
|
|
|
raspberry_pi
|
2014-04-23 00:21:18 +04:00
|
|
|
verdex
|
|
|
|
"
|
2006-09-16 19:40:36 +04:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
# determine output directory
|
|
|
|
if [ "$currentDir" = "$sourceDir" ]; then
|
|
|
|
outputDir=$currentDir/generated
|
|
|
|
else
|
|
|
|
outputDir=$currentDir
|
|
|
|
fi
|
|
|
|
buildOutputDir="$outputDir/build"
|
|
|
|
HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes"
|
|
|
|
buildConfigFile="$buildOutputDir/BuildConfig"
|
|
|
|
|
|
|
|
# check for update request
|
|
|
|
if [ "$1" = "--update" ]; then
|
|
|
|
if ! [ -e "$buildConfigFile" ]; then
|
|
|
|
echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! type perl >/dev/null 2>&1; then
|
|
|
|
echo $0 --update: \'perl\' not found - updating not possible.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# convert BuildConfig from jam format to shell format and evaluate it
|
|
|
|
shellConfigFile="${buildConfigFile}.shell"
|
|
|
|
perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
|
|
|
|
<"$buildConfigFile" >"$shellConfigFile"
|
|
|
|
. "$shellConfigFile"
|
|
|
|
rm "$shellConfigFile"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2002-07-15 02:09:44 +04:00
|
|
|
# parse parameters
|
|
|
|
#
|
2005-12-07 01:45:11 +03:00
|
|
|
while [ $# -gt 0 ] ; do
|
2002-07-15 02:09:44 +04:00
|
|
|
case "$1" in
|
2013-07-21 06:10:48 +04:00
|
|
|
--bootstrap)
|
|
|
|
assertparams "$1" 3 $#
|
|
|
|
HOST_HAIKU_PORTER="`absolute_path $2`"
|
|
|
|
HAIKU_PORTS_CROSS="`absolute_path $3`"
|
|
|
|
HAIKU_PORTS="`absolute_path $4`"
|
2014-04-27 09:18:29 +04:00
|
|
|
check_file_exists "$HOST_HAIKU_PORTER" || (
|
|
|
|
echo "Invalid path to haikuporter: $HOST_HAIKU_PORTER" >&2
|
2014-04-26 19:25:25 +04:00
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
check_dir_exists "$HAIKU_PORTS" || (
|
|
|
|
echo "Non-existent directory $HAIKU_PORTS" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
check_dir_exists "$HAIKU_PORTS_CROSS" || (
|
|
|
|
echo "Non-existent directory $HAIKU_PORTS_CROSS" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
2013-07-21 06:10:48 +04:00
|
|
|
shift 4
|
|
|
|
;;
|
2013-07-26 01:52:11 +04:00
|
|
|
--build-cross-tools)
|
|
|
|
if [ -z "$buildCrossTools" ]; then
|
|
|
|
assertparams "$1" 2 $#
|
|
|
|
targetArch=$2
|
|
|
|
buildCrossTools=$3
|
|
|
|
shift 3
|
|
|
|
else
|
|
|
|
assertparam "$1" $#
|
|
|
|
targetArch=$2
|
|
|
|
shift 2
|
|
|
|
fi
|
|
|
|
case "$targetArch" in
|
|
|
|
x86_gcc2) targetMachine=i586-pc-haiku;;
|
|
|
|
x86) targetMachine=i586-pc-haiku;;
|
|
|
|
x86_64) targetMachine=x86_64-unknown-haiku;;
|
|
|
|
ppc) targetMachine=powerpc-apple-haiku;;
|
|
|
|
m68k) targetMachine=m68k-unknown-haiku;;
|
|
|
|
arm) targetMachine=arm-unknown-haiku;;
|
|
|
|
*)
|
|
|
|
echo "Unsupported target architecture: $2" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2008-05-18 03:47:39 +04:00
|
|
|
esac
|
2013-07-26 01:52:11 +04:00
|
|
|
set_variable buildCrossToolsMachine_$targetArch $targetMachine
|
|
|
|
targetArchs="$targetArchs $targetArch"
|
|
|
|
HAIKU_PACKAGING_ARCHS=
|
2008-05-18 03:47:39 +04:00
|
|
|
;;
|
|
|
|
--cross-tools-prefix)
|
|
|
|
assertparam "$1" $#
|
2013-07-26 01:52:11 +04:00
|
|
|
targetArch=unknown${unknownArchIndex}
|
|
|
|
set_variable crossToolsPrefix_$targetArch "$2"
|
|
|
|
targetArchs="$targetArchs $targetArch"
|
|
|
|
HAIKU_PACKAGING_ARCHS=
|
2013-09-22 21:57:53 +04:00
|
|
|
unknownArchIndex=$(($unknownArchIndex + 1))
|
2008-05-18 03:47:39 +04:00
|
|
|
shift 2
|
|
|
|
;;
|
2007-05-20 21:50:11 +04:00
|
|
|
--distro-compatibility)
|
2008-05-18 03:47:39 +04:00
|
|
|
assertparam "$1" $#
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_DISTRO_COMPATIBILITY=$2
|
|
|
|
case "$HAIKU_DISTRO_COMPATIBILITY" in
|
2008-05-18 03:47:39 +04:00
|
|
|
official) ;;
|
|
|
|
compatible) ;;
|
|
|
|
default) ;;
|
|
|
|
*) echo "Invalid distro compatibility" \
|
2010-01-04 22:36:58 +03:00
|
|
|
"level: $HAIKU_DISTRO_COMPATIBILITY"
|
2008-05-18 03:47:39 +04:00
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
shift 2
|
|
|
|
;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--enable-multiuser) HAIKU_ENABLE_MULTIUSER=1; shift 1;;
|
2013-07-04 01:19:00 +04:00
|
|
|
--host-only) HAIKU_HOST_BUILD_ONLY=1; shift 1;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--include-gpl-addons) HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;;
|
|
|
|
--include-patented-code) HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;;
|
2010-02-25 19:13:22 +03:00
|
|
|
--include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--include-3rdparty) HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
|
2009-11-23 22:34:55 +03:00
|
|
|
-j*) buildCrossToolsJobs="$1"; shift 1;;
|
2014-05-01 01:47:55 +04:00
|
|
|
--no-downloads) HAIKU_NO_DOWNLOADS=1; shift 1;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--target=*) TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
2013-08-12 19:18:02 +04:00
|
|
|
--target-arch)
|
|
|
|
assertparam "$1" $#
|
|
|
|
targetArch=$2
|
|
|
|
shift 2
|
|
|
|
if [ ! "$platform" = Haiku ]; then
|
|
|
|
echo "--target-arch can only be specified on Haiku." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
is_in_list "$targetArch" "$supportedTargetArchs" || (
|
|
|
|
echo "Unsupported target architecture: \"$targetArch\"" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
haikuTargetArchs="$haikuTargetArchs $targetArch"
|
|
|
|
;;
|
2014-04-23 00:21:18 +04:00
|
|
|
--target-board)
|
|
|
|
assertparam "$1" $#
|
|
|
|
HAIKU_BOOT_BOARD=$2
|
|
|
|
is_in_list "$HAIKU_BOOT_BOARD" "$supportedTargetBoards" || (
|
|
|
|
echo "Unsupported target board: \"$HAIKU_BOOT_BOARD\"" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
shift 2
|
|
|
|
;;
|
2014-04-03 20:26:29 +04:00
|
|
|
--use-clang) useClang=1; shift 1;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
|
2013-07-26 01:52:11 +04:00
|
|
|
--use-gcc-graphite) useGccGraphiteDefault=1; shift 1;;
|
2010-02-04 00:21:39 +03:00
|
|
|
--use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;;
|
|
|
|
--use-xattr) HAIKU_HOST_USE_XATTR=1; shift 1;;
|
2013-06-07 04:27:48 +04:00
|
|
|
--use-xattr-ref) HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
|
2002-07-15 02:09:44 +04:00
|
|
|
*) echo Invalid argument: \`$1\'; exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2005-10-31 03:00:27 +03:00
|
|
|
# detect the build platform
|
2005-10-29 20:27:43 +04:00
|
|
|
case "${platform}" in
|
2010-01-04 22:36:58 +03:00
|
|
|
Darwin) HOST_PLATFORM=darwin ;;
|
|
|
|
FreeBSD) HOST_PLATFORM=freebsd
|
2010-02-04 00:21:39 +03:00
|
|
|
if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
|
2009-02-24 17:20:24 +03:00
|
|
|
echo Unsupported platform: FreeBSD ${platformMachine}
|
|
|
|
exit 1
|
2009-02-24 17:14:40 +03:00
|
|
|
fi ;;
|
2010-01-04 22:36:58 +03:00
|
|
|
Haiku) HOST_PLATFORM=haiku_host ;;
|
|
|
|
Linux) HOST_PLATFORM=linux ;;
|
|
|
|
OpenBSD) HOST_PLATFORM=openbsd ;;
|
|
|
|
SunOS) HOST_PLATFORM=sunos ;;
|
|
|
|
CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
|
2005-10-29 20:27:43 +04:00
|
|
|
*) echo Unsupported platform: ${platform}
|
|
|
|
exit 1 ;;
|
2005-09-02 17:23:51 +04:00
|
|
|
esac
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2012-07-10 22:33:39 +04:00
|
|
|
# check for case-sensitive filesystem
|
|
|
|
mkdir haikuCaseTest 2>/dev/null
|
|
|
|
mkdir haikucasetest 2>/dev/null
|
|
|
|
caseInsensitive=$?
|
2012-07-11 20:41:52 +04:00
|
|
|
rmdir haikuCaseTest haikucasetest 2>/dev/null
|
2012-07-10 22:33:39 +04:00
|
|
|
if [ $caseInsensitive != 0 ]; then
|
|
|
|
echo "You need a case-sensitive file-system to build Haiku."
|
|
|
|
if [ $HOST_PLATFORM = "darwin" ]; then
|
|
|
|
echo "You can create a case-sensitive disk image using Disk Utility and use"
|
|
|
|
echo "it to store the Haiku sources on."
|
2009-05-30 04:38:43 +04:00
|
|
|
fi
|
2012-07-10 22:33:39 +04:00
|
|
|
exit 1
|
2009-05-30 04:38:43 +04:00
|
|
|
fi
|
|
|
|
|
2013-09-29 23:27:47 +04:00
|
|
|
# determine how to invoke sed with extended regexp support for non-GNU sed
|
|
|
|
if [ $HOST_PLATFORM = "darwin" ]; then
|
|
|
|
HOST_EXTENDED_REGEX_SED="sed -E"
|
|
|
|
fi
|
|
|
|
|
2014-08-06 03:05:50 +04:00
|
|
|
# check if nasm can actually output ELF files
|
|
|
|
# (the stock version in OSX can't)
|
|
|
|
# XXX: should probably only test for x86* arch
|
2014-08-22 14:05:32 +04:00
|
|
|
if [ "$("$HAIKU_NASM" -hf | grep -c elf'[36][24] ')" -ne "2" ]; then
|
2014-08-06 03:05:50 +04:00
|
|
|
echo "$HAIKU_NASM cannot generate ELF files. Please install a working version."
|
|
|
|
if [ $HOST_PLATFORM = "darwin" ]; then
|
|
|
|
echo "You can install it from Mac Ports."
|
|
|
|
echo "Mac Ports is available at: http://www.macports.org/"
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# create output directory
|
2006-08-03 21:57:34 +04:00
|
|
|
mkdir -p "$buildOutputDir" || exit 1
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-07-04 01:19:00 +04:00
|
|
|
if [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
|
|
|
|
invalidCommand=$sourceDir/build/scripts/host_build_only
|
|
|
|
HAIKU_AR=$invalidCommand
|
|
|
|
HAIKU_CC=$invalidCommand
|
|
|
|
HAIKU_LD=$invalidCommand
|
|
|
|
HAIKU_OBJCOPY=$invalidCommand
|
|
|
|
HAIKU_RANLIB=$invalidCommand
|
|
|
|
HAIKU_ELFEDIT=$invalidCommand
|
2014-03-29 04:03:51 +04:00
|
|
|
HAIKU_NASM=$invalidCommand
|
2013-07-04 01:19:00 +04:00
|
|
|
HAIKU_STRIP=$invalidCommand
|
|
|
|
else
|
2013-07-26 01:52:11 +04:00
|
|
|
if [ -n "$HAIKU_PACKAGING_ARCHS" ]; then
|
|
|
|
targetArchs="$HAIKU_PACKAGING_ARCHS"
|
2013-07-04 01:19:00 +04:00
|
|
|
fi
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_PACKAGING_ARCHS=
|
|
|
|
|
2013-08-12 19:18:02 +04:00
|
|
|
# On Haiku determine target architectures and tools automatically.
|
2013-07-26 01:52:11 +04:00
|
|
|
if [ -z "$targetArchs" ]; then
|
2013-08-12 19:18:02 +04:00
|
|
|
if [ $HOST_PLATFORM != haiku_host ]; then
|
|
|
|
echo "Please specify the build tools to use or build (via" \
|
2013-10-20 19:13:59 +04:00
|
|
|
"--cross-tools-prefix or --build-cross-tools) or specify a" \
|
2013-08-12 19:18:02 +04:00
|
|
|
"host-only build (--host-only)." >&2
|
2014-08-30 23:39:53 +04:00
|
|
|
echo "For more info, invoke $0 --help"
|
2013-08-12 19:18:02 +04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# determine primary architecture
|
2013-10-12 22:53:52 +04:00
|
|
|
targetArch=`package list -i /system/packages/haiku-*.hpkg \
|
2013-08-12 19:18:02 +04:00
|
|
|
| sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'`
|
|
|
|
is_in_list "$targetArch" "$supportedTargetArchs" || (
|
|
|
|
echo "Unsupported target architecture: \"$targetArch\"" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
2013-07-26 01:52:11 +04:00
|
|
|
targetArchs=$targetArch
|
2013-08-12 19:18:02 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
set_default_value HAIKU_AR_$targetArch ar
|
|
|
|
set_default_value HAIKU_CC_$targetArch gcc
|
|
|
|
set_default_value HAIKU_LD_$targetArch ld
|
|
|
|
set_default_value HAIKU_OBJCOPY_$targetArch objcopy
|
|
|
|
set_default_value HAIKU_RANLIB_$targetArch ranlib
|
|
|
|
set_default_value HAIKU_ELFEDIT_$targetArch elfedit
|
|
|
|
set_default_value HAIKU_STRIP_$targetArch strip
|
2013-08-12 19:18:02 +04:00
|
|
|
|
|
|
|
# determine secondary architectures
|
|
|
|
for targetArch in $supportedTargetArchs; do
|
2013-10-20 21:44:01 +04:00
|
|
|
if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then
|
2013-08-12 19:18:02 +04:00
|
|
|
targetArchs="$targetArchs $targetArch"
|
|
|
|
set_default_value HAIKU_AR_$targetArch ar-$targetArch
|
|
|
|
set_default_value HAIKU_CC_$targetArch gcc-$targetArch
|
|
|
|
set_default_value HAIKU_LD_$targetArch ld-$targetArch
|
|
|
|
set_default_value HAIKU_OBJCOPY_$targetArch objcopy-$targetArch
|
|
|
|
set_default_value HAIKU_RANLIB_$targetArch ranlib-$targetArch
|
|
|
|
set_default_value HAIKU_ELFEDIT_$targetArch elfedit-$targetArch
|
|
|
|
set_default_value HAIKU_STRIP_$targetArch strip-$targetArch
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# The target architectures might have been specified explicitly.
|
|
|
|
if [ -n "$haikuTargetArchs" ]; then
|
|
|
|
for targetArch in $haikuTargetArchs; do
|
|
|
|
is_in_list "$targetArch" "$targetArchs" || (
|
|
|
|
echo "Unsupported target architecture: \"$targetArch\"." \
|
|
|
|
"Only native architectures of the host platform can" \
|
|
|
|
"be specified." >&2
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
done
|
|
|
|
targetArchs="$haikuTargetArchs"
|
|
|
|
fi
|
2013-07-04 01:19:00 +04:00
|
|
|
fi
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-08-04 19:20:56 +04:00
|
|
|
isPrimaryArch=1
|
2013-07-26 01:52:11 +04:00
|
|
|
for targetArch in $targetArchs; do
|
|
|
|
# Note: targetArch is "unknown<n>" at this point, if a cross-tools
|
|
|
|
# prefix was specified. The standard_gcc_settings call below will get
|
|
|
|
# the actual architecture.
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
crossToolsPrefix=`get_variable crossToolsPrefix_$targetArch`
|
|
|
|
|
|
|
|
# build cross tools from sources
|
|
|
|
if [ -n "$buildCrossTools" -a -z "$crossToolsPrefix" ]; then
|
|
|
|
crossToolsDir="$outputDir/cross-tools-$targetArch"
|
|
|
|
targetMachine=`get_variable buildCrossToolsMachine_$targetArch`
|
|
|
|
script="$buildCrossToolsScript"
|
2013-11-23 23:05:13 +04:00
|
|
|
scriptArgs=
|
2013-07-26 01:52:11 +04:00
|
|
|
if [ $targetArch != x86_gcc2 ]; then
|
2013-11-23 23:05:13 +04:00
|
|
|
script="${script}_gcc4"
|
|
|
|
scriptArgs="$targetMachine"
|
2014-01-28 20:50:01 +04:00
|
|
|
set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch \
|
|
|
|
$useGccGraphiteDefault
|
2013-07-26 01:52:11 +04:00
|
|
|
fi
|
2013-08-04 19:20:56 +04:00
|
|
|
secondaryArch=
|
|
|
|
if [ -z "$isPrimaryArch" ]; then
|
|
|
|
secondaryArch=$targetArch
|
|
|
|
fi
|
2013-08-22 14:31:48 +04:00
|
|
|
|
|
|
|
case $HOST_PLATFORM in
|
|
|
|
freebsd|openbsd) MAKE=gmake;;
|
|
|
|
*) MAKE=make;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
MAKE=$MAKE \
|
2013-08-04 19:20:56 +04:00
|
|
|
SECONDARY_ARCH=$secondaryArch \
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_USE_GCC_GRAPHITE=`get_variable \
|
|
|
|
HAIKU_USE_GCC_GRAPHITE_$targetArch` \
|
2014-02-09 13:06:43 +04:00
|
|
|
HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
|
2013-11-23 23:05:13 +04:00
|
|
|
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
|
|
|
|
"$crossToolsDir" $buildCrossToolsJobs || exit 1
|
2013-07-26 01:52:11 +04:00
|
|
|
crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prepare gcc settings and get the actual target architecture
|
|
|
|
gcc="${crossToolsPrefix}gcc"
|
|
|
|
if [ -z "${crossToolsPrefix}" ]; then
|
|
|
|
gcc=`get_variable HAIKU_CC_$targetArch`
|
|
|
|
fi
|
|
|
|
standard_gcc_settings "$gcc"
|
|
|
|
targetArch=$standard_gcc_settings_targetArch
|
|
|
|
|
|
|
|
# set default values for flags
|
|
|
|
set_default_value HAIKU_CPPFLAGS_$targetArch ""
|
|
|
|
set_default_value HAIKU_CCFLAGS_$targetArch ""
|
|
|
|
set_default_value HAIKU_CXXFLAGS_$targetArch ""
|
|
|
|
set_default_value HAIKU_LDFLAGS_$targetArch ""
|
|
|
|
set_default_value HAIKU_ARFLAGS_$targetArch cru
|
|
|
|
set_default_value HAIKU_UNARFLAGS_$targetArch x
|
|
|
|
|
|
|
|
# Override the cross tools variables, if the tools were built or a
|
|
|
|
# prefix was specified.
|
|
|
|
if [ -n "$crossToolsPrefix" ]; then
|
|
|
|
get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
|
|
|
|
get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
|
|
|
|
get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy
|
|
|
|
get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib
|
|
|
|
get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip
|
|
|
|
|
|
|
|
case `get_variable HAIKU_GCC_RAW_VERSION_$targetArch` in
|
|
|
|
4.*)
|
|
|
|
get_build_tool_path ELFEDIT_$targetArch \
|
|
|
|
${crossToolsPrefix}elfedit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check whether the Haiku compiler really targets Haiku
|
|
|
|
targetMachine=`get_variable HAIKU_GCC_MACHINE_$targetArch`
|
|
|
|
case "$targetMachine" in
|
|
|
|
*-*-haiku) ;;
|
|
|
|
*)
|
|
|
|
echo The compiler specified as Haiku target compiler is not a \
|
|
|
|
valid Haiku cross-compiler. Please see ReadMe.cross-compile. >&2
|
|
|
|
echo compiler: $HAIKU_CC
|
|
|
|
echo compiler is configured for target: $targetMachine
|
|
|
|
exit 1 ;;
|
2013-07-04 01:19:00 +04:00
|
|
|
esac
|
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch"
|
2013-08-04 19:20:56 +04:00
|
|
|
isPrimaryArch=
|
2013-07-26 01:52:11 +04:00
|
|
|
done
|
2005-10-29 20:27:43 +04:00
|
|
|
fi
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
# Generate BuildConfig
|
2010-01-04 22:36:58 +03:00
|
|
|
cat << EOF > "$buildConfigFile"
|
2002-07-09 16:24:59 +04:00
|
|
|
# BuildConfig
|
2010-02-04 00:23:52 +03:00
|
|
|
# Note: This file has been automatically generated by configure with the
|
|
|
|
# following arguments:
|
2010-01-03 06:05:12 +03:00
|
|
|
# ${configureArgs}
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
|
|
|
|
HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
|
|
|
|
|
|
|
|
HAIKU_INCLUDE_GPL_ADDONS ?= "${HAIKU_INCLUDE_GPL_ADDONS}" ;
|
|
|
|
HAIKU_INCLUDE_PATENTED_CODE ?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
|
2010-02-25 19:13:22 +03:00
|
|
|
HAIKU_INCLUDE_SOURCES ?= "${HAIKU_INCLUDE_SOURCES}" ;
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_INCLUDE_3RDPARTY ?= "${HAIKU_INCLUDE_3RDPARTY}" ;
|
|
|
|
HAIKU_ENABLE_MULTIUSER ?= "${HAIKU_ENABLE_MULTIUSER}" ;
|
|
|
|
HAIKU_DISTRO_COMPATIBILITY ?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
|
|
|
|
HAIKU_USE_GCC_PIPE ?= "${HAIKU_USE_GCC_PIPE}" ;
|
2010-02-04 00:21:39 +03:00
|
|
|
HAIKU_HOST_USE_32BIT ?= "${HAIKU_HOST_USE_32BIT}" ;
|
|
|
|
HAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ;
|
2013-06-07 04:27:48 +04:00
|
|
|
HAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ;
|
2013-07-04 01:19:00 +04:00
|
|
|
HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ;
|
2010-01-04 22:36:58 +03:00
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ;
|
2012-05-27 00:47:27 +04:00
|
|
|
|
2014-05-01 01:47:55 +04:00
|
|
|
HAIKU_NO_DOWNLOADS ?= "${HAIKU_NO_DOWNLOADS}" ;
|
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2014-03-29 04:03:51 +04:00
|
|
|
HAIKU_NASM ?= ${HAIKU_NASM} ;
|
2014-04-23 00:21:18 +04:00
|
|
|
HAIKU_BOOT_BOARD ?= ${HAIKU_BOOT_BOARD} ;
|
2007-05-20 21:50:11 +04:00
|
|
|
|
2013-09-29 23:27:47 +04:00
|
|
|
HOST_EXTENDED_REGEX_SED ?= ${HOST_EXTENDED_REGEX_SED} ;
|
2010-01-04 22:36:58 +03:00
|
|
|
HOST_GCC_RAW_VERSION ?= ${HOST_GCC_RAW_VERSION} ;
|
|
|
|
HOST_GCC_MACHINE ?= ${HOST_GCC_MACHINE} ;
|
|
|
|
HOST_LD ?= ${HOST_GCC_LD} ;
|
|
|
|
HOST_OBJCOPY ?= ${HOST_GCC_OBJCOPY} ;
|
2013-07-06 04:17:15 +04:00
|
|
|
HOST_SHA256 ?= ${HOST_SHA256} ;
|
2005-11-13 01:58:54 +03:00
|
|
|
|
2013-07-21 06:10:48 +04:00
|
|
|
HOST_HAIKU_PORTER ?= ${HOST_HAIKU_PORTER} ;
|
|
|
|
HAIKU_PORTS ?= ${HAIKU_PORTS} ;
|
|
|
|
HAIKU_PORTS_CROSS ?= ${HAIKU_PORTS_CROSS} ;
|
|
|
|
|
2002-07-16 03:42:06 +04:00
|
|
|
EOF
|
|
|
|
|
2013-07-26 01:52:11 +04:00
|
|
|
for targetArch in $HAIKU_PACKAGING_ARCHS; do
|
|
|
|
variables="
|
|
|
|
HAIKU_GCC_RAW_VERSION HAIKU_GCC_RAW_VERSION
|
|
|
|
HAIKU_GCC_MACHINE HAIKU_GCC_MACHINE
|
|
|
|
HAIKU_GCC_LIB_DIR HAIKU_GCC_LIB_DIR
|
|
|
|
HAIKU_CPU HAIKU_CPU
|
|
|
|
HAIKU_BOOT_LIBGCC HAIKU_BOOT_LIBGCC
|
|
|
|
HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX
|
|
|
|
HAIKU_AR HAIKU_AR
|
|
|
|
HAIKU_CC HAIKU_CC
|
2014-04-03 20:26:29 +04:00
|
|
|
HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG
|
2013-07-26 01:52:11 +04:00
|
|
|
HAIKU_LD HAIKU_LD
|
|
|
|
HAIKU_OBJCOPY HAIKU_OBJCOPY
|
|
|
|
HAIKU_RANLIB HAIKU_RANLIB
|
|
|
|
HAIKU_ELFEDIT HAIKU_ELFEDIT
|
|
|
|
HAIKU_STRIP HAIKU_STRIP
|
|
|
|
HAIKU_CPPFLAGS HAIKU_CPPFLAGS
|
|
|
|
HAIKU_CCFLAGS HAIKU_CCFLAGS
|
|
|
|
HAIKU_C++FLAGS HAIKU_CXXFLAGS
|
|
|
|
HAIKU_LDFLAGS HAIKU_LDFLAGS
|
|
|
|
HAIKU_ARFLAGS HAIKU_ARFLAGS
|
|
|
|
HAIKU_UNARFLAGS HAIKU_UNARFLAGS
|
|
|
|
HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE
|
|
|
|
"
|
|
|
|
set -- $variables
|
|
|
|
while [ $# -ge 2 ]; do
|
|
|
|
value=`get_variable ${2}_$targetArch`
|
|
|
|
echo "${1}_${targetArch} ?= $value ;" >> "$buildConfigFile"
|
|
|
|
shift 2
|
|
|
|
done
|
|
|
|
|
|
|
|
# For variables that may have long values, distribute them over multiple
|
|
|
|
# lines so that jam doesn't hit the maximum line length.
|
|
|
|
variables="
|
2014-01-16 01:41:27 +04:00
|
|
|
HAIKU_BOOT_C++_HEADERS_DIR HAIKU_BOOT_CXX_HEADERS_DIR
|
2013-07-26 01:52:11 +04:00
|
|
|
"
|
|
|
|
set -- $variables
|
|
|
|
while [ $# -ge 2 ]; do
|
|
|
|
echo "${1}_${targetArch} ?= " >> "$buildConfigFile"
|
|
|
|
get_variable ${2}_$targetArch | xargs -n 1 echo " " \
|
|
|
|
>> "$buildConfigFile"
|
|
|
|
echo " ;" >> "$buildConfigFile"
|
|
|
|
shift 2
|
|
|
|
done
|
|
|
|
done
|
2005-01-26 04:34:37 +03:00
|
|
|
|
|
|
|
|
2008-05-18 03:47:39 +04:00
|
|
|
# Generate a boot strap Jamfile in the output directory.
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
cat << EOF > $outputDir/Jamfile
|
|
|
|
# automatically generated Jamfile
|
|
|
|
|
|
|
|
HAIKU_TOP = ${sourceDir} ;
|
|
|
|
HAIKU_OUTPUT_DIR = ${outputDir} ;
|
|
|
|
|
|
|
|
include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
|
|
|
|
|
|
|
|
EOF
|