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
|
|
|
|
2002-07-15 02:09:44 +04:00
|
|
|
# usage
|
|
|
|
#
|
|
|
|
# Prints usage.
|
|
|
|
#
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
Usage: $0 <options>
|
|
|
|
options:
|
2009-11-23 22:34:55 +03:00
|
|
|
--alternative-gcc-output-dir <dir>
|
|
|
|
Build a Haiku installation that supports running
|
|
|
|
executables built with a gcc version incompatible
|
|
|
|
with the primary gcc (e.g. gcc 2 executables under
|
|
|
|
a gcc 4 Haiku or vice versa). <dir> specifies the
|
|
|
|
output directory of the other gcc. The directory
|
|
|
|
must already be fully configured.
|
|
|
|
Note, that a sub-jam will be executed when
|
|
|
|
building Haiku. When using a jam that is not
|
|
|
|
simply invoked by "jam", the JAM build variable
|
|
|
|
needs to be set accordingly.
|
|
|
|
To disable building the alternative libraries
|
|
|
|
the variable HAIKU_ADD_ALTERNATIVE_GCC_LIBS can be
|
|
|
|
unset in the UserBuildConfig file.
|
2005-10-29 20:27:43 +04:00
|
|
|
--build-cross-tools <build tools dir>
|
|
|
|
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
|
|
|
--build-cross-tools-gcc4 <arch> <build tools dir>
|
2005-11-18 17:17:04 +03:00
|
|
|
Like "--build-cross-tools" just that gcc 4 will
|
2006-10-04 03:41:59 +04:00
|
|
|
be used for cross-compilation. Note, that the
|
|
|
|
resulting Haiku installation built with gcc 4
|
|
|
|
will not be binary compatible with BeOS R5.
|
2005-12-07 01:45:11 +03:00
|
|
|
<arch> specifies the target architecture, either
|
2009-04-18 22:37:07 +04:00
|
|
|
"x86", "ppc", "m68k", "arm" or "mipsel".
|
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.
|
|
|
|
--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.
|
2009-11-23 22:34:55 +03:00
|
|
|
-j<n> Only relevant for --build-cross-tools and
|
|
|
|
--build-cross-tools-gcc4. Is passed on to the
|
|
|
|
make building the build tools.
|
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
|
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!]
|
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.
|
2007-08-23 02:07:03 +04:00
|
|
|
--use-32bit Use -m32 flag on 64bit host gcc compiler.
|
2007-04-08 06:19:01 +04:00
|
|
|
--use-xattr Use Linux xattr 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).
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
environment variables:
|
|
|
|
HAIKU_AR The static library archiver. Defaults to "ar".
|
|
|
|
HAIKU_CC The compiler. Defaults to "gcc".
|
|
|
|
HAIKU_LD The linker. Defaults to "ld".
|
|
|
|
HAIKU_OBJCOPY The objcopy to be used. Defaults to "objcopy".
|
|
|
|
HAIKU_RANLIB The static library indexer. Defaults to "ranlib".
|
2009-04-13 14:50:17 +04:00
|
|
|
HAIKU_YASM The yasm assembler (x86 only).
|
2005-10-29 20:27:43 +04:00
|
|
|
HAIKU_CPPFLAGS The preprocessor flags. Defaults to "".
|
|
|
|
HAIKU_CCFLAGS The C flags. Defaults to "".
|
|
|
|
HAIKU_CXXFLAGS The C++ flags. Defaults to "".
|
|
|
|
HAIKU_LDFLAGS The linker flags. Defaults to "".
|
|
|
|
HAIKU_ARFLAGS The flags passed to HAIKU_AR for archiving.
|
2009-06-29 15:01:46 +04:00
|
|
|
Defaults to "cru".
|
2005-10-29 20:27:43 +04:00
|
|
|
HAIKU_UNARFLAGS The flags passed to HAIKU_AR for unarchiving.
|
|
|
|
Defaults to "x".
|
2009-02-24 17:20:24 +03:00
|
|
|
|
2009-02-03 04:08:40 +03:00
|
|
|
Non-standard 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
|
|
|
|
}
|
|
|
|
|
2003-05-06 02:07:33 +04:00
|
|
|
# standard_gcc_settings
|
|
|
|
#
|
|
|
|
# Sets the variables for a GCC platform.
|
|
|
|
#
|
|
|
|
standard_gcc_settings()
|
|
|
|
{
|
|
|
|
# PLATFORM_LINKLIBS
|
2005-10-29 20:27:43 +04:00
|
|
|
gcclib=`$HAIKU_CC -print-libgcc-file-name`
|
2003-05-06 02:07:33 +04:00
|
|
|
gccdir=`dirname ${gcclib}`
|
2006-09-03 21:22:48 +04:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_GCC_RAW_VERSION=`$HAIKU_CC -dumpversion`
|
|
|
|
HAIKU_GCC_MACHINE=`$HAIKU_CC -dumpmachine`
|
2007-08-23 02:07:03 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
HAIKU_GCC_LIB_DIR=${gccdir}
|
|
|
|
HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
|
|
|
|
HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
|
2009-01-28 05:08:39 +03:00
|
|
|
HAIKU_GCC_HEADERS_DIR="${gccdir}/include
|
|
|
|
${gccdir}/include-fixed"
|
2005-12-09 17:08:20 +03:00
|
|
|
HAIKU_GCC_LIBGCC_OBJECTS=`$HAIKU_AR t ${HAIKU_GCC_LIBGCC} | grep -v eabi.o`
|
|
|
|
# Note: We filter out eabi.o. It's present in gcc's libgcc for PPC and
|
|
|
|
# neither needed nor wanted.
|
2005-11-13 01:58:54 +03:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
case $HAIKU_GCC_RAW_VERSION in
|
2005-11-13 01:58:54 +03:00
|
|
|
4.*)
|
2006-09-03 21:22:48 +04:00
|
|
|
# for gcc 4 we use the libstdc++ and libsupc++ that come with the
|
|
|
|
# compiler
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_STATIC_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.a`
|
|
|
|
HAIKU_SHARED_LIBSTDCXX=`$HAIKU_CC -print-file-name=libstdc++.so`
|
|
|
|
HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
|
|
|
|
HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
|
2009-01-29 01:24:13 +03:00
|
|
|
|
|
|
|
local headers
|
2010-01-04 22:36:58 +03:00
|
|
|
if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
|
|
|
|
headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
|
2009-01-29 01:24:13 +03:00
|
|
|
else
|
2010-01-04 22:36:58 +03:00
|
|
|
headers=$gccdir/../../../../include/c++/$HAIKU_GCC_RAW_VERSION
|
2009-01-29 01:24:13 +03:00
|
|
|
fi
|
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_CXX_HEADERS_DIR=$headers
|
|
|
|
for d in $HAIKU_GCC_MACHINE backward ext; do
|
2006-09-17 02:25:49 +04:00
|
|
|
# Note: We need the line break, otherwise the line might become
|
|
|
|
# too long for jam (512 bytes max).
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_CXX_HEADERS_DIR="$HAIKU_CXX_HEADERS_DIR
|
2006-09-17 02:25:49 +04:00
|
|
|
$headers/$d"
|
|
|
|
done
|
|
|
|
|
2007-08-23 02:07:03 +04:00
|
|
|
# when not building the crosscompiler, to use cpp headers from
|
2006-09-17 17:32:53 +04:00
|
|
|
# tree first, but fallback to local C++ system headers (like <new>)
|
|
|
|
# if [ "$buildCrossTools" = "" ]; then
|
2010-01-04 22:36:58 +03:00
|
|
|
# HAIKU_CXX_HEADERS_DIR="headers/cpp $HAIKU_CXX_HEADERS_DIR"
|
2006-09-17 17:32:53 +04:00
|
|
|
# fi
|
2006-09-17 02:25:49 +04:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
if [ $HAIKU_STATIC_LIBSTDCXX = libstdc++.a ]; then
|
|
|
|
HAIKU_STATIC_LIBSTDCXX=
|
2005-11-13 01:58:54 +03:00
|
|
|
fi
|
2010-02-03 23:37:23 +03:00
|
|
|
if [ $HAIKU_SHARED_LIBSTDCXX = libstdc++.so ]; then
|
|
|
|
HAIKU_SHARED_LIBSTDCXX=
|
|
|
|
fi
|
2010-01-04 22:36:58 +03:00
|
|
|
if [ $HAIKU_STATIC_LIBSUPCXX = libsupc++.a ]; then
|
|
|
|
HAIKU_STATIC_LIBSUPCXX=
|
2005-11-14 16:47:52 +03:00
|
|
|
fi
|
2010-02-03 23:37:23 +03:00
|
|
|
if [ $HAIKU_SHARED_LIBSUPCXX = libsupc++.so ]; then
|
|
|
|
HAIKU_SHARED_LIBSUPCXX=
|
|
|
|
fi
|
2005-11-13 01:58:54 +03:00
|
|
|
;;
|
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
|
2010-01-04 22:36:58 +03:00
|
|
|
if [ $HAIKU_GCC_RAW_VERSION != $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
|
|
|
|
;;
|
2005-11-13 01:58:54 +03:00
|
|
|
esac
|
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"
|
|
|
|
local tool=$2
|
|
|
|
local path="${crossToolsPrefix}$tool"
|
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
|
|
|
|
which "$path" &> /dev/null || {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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`
|
2009-04-13 14:50:17 +04:00
|
|
|
targetArch=x86
|
2005-10-29 20:27:43 +04:00
|
|
|
crossToolsPrefix=
|
|
|
|
buildCrossTools=
|
2005-11-18 17:17:04 +03:00
|
|
|
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
2005-12-07 01:45:11 +03:00
|
|
|
buildCrossToolsMachine=
|
2009-11-23 22:34:55 +03:00
|
|
|
buildCrossToolsJobs=
|
2010-01-04 22:36:58 +03:00
|
|
|
|
|
|
|
# exported (BuildSetup) default parameter values
|
|
|
|
#
|
|
|
|
HAIKU_GCC_RAW_VERSION=
|
|
|
|
HAIKU_GCC_MACHINE=i586-pc-haiku
|
|
|
|
HAIKU_STATIC_LIBSTDCXX=
|
|
|
|
HAIKU_SHARED_LIBSTDCXX=
|
|
|
|
HAIKU_STATIC_LIBSUPCXX=
|
|
|
|
HAIKU_SHARED_LIBSUPCXX=
|
|
|
|
HAIKU_CXX_HEADERS_DIR=
|
|
|
|
HOST_GCC_RAW_VERSION=`gcc -dumpversion`
|
|
|
|
HOST_GCC_MACHINE=`gcc -dumpmachine`
|
|
|
|
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
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR=
|
|
|
|
HAIKU_ADD_ALTERNATIVE_GCC_LIBS=
|
|
|
|
HOST_GCC_LD=`gcc -print-prog-name=ld`
|
|
|
|
HOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
|
2010-01-08 01:08:12 +03:00
|
|
|
SFDISK_BINARY=sfdisk
|
|
|
|
HOST_SFDISK=$SFDISK_BINARY
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2009-07-07 14:30:09 +04:00
|
|
|
haikuRequiredLegacyGCCVersion="2.95.3-haiku-090629"
|
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
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
set_default_value HAIKU_AR ar
|
|
|
|
set_default_value HAIKU_CC gcc
|
|
|
|
set_default_value HAIKU_LD ld
|
|
|
|
set_default_value HAIKU_OBJCOPY objcopy
|
|
|
|
set_default_value HAIKU_RANLIB ranlib
|
2009-04-13 14:50:17 +04:00
|
|
|
set_default_value HAIKU_YASM yasm
|
2005-10-29 20:27:43 +04:00
|
|
|
set_default_value HAIKU_CPPFLAGS ""
|
|
|
|
set_default_value HAIKU_CCFLAGS ""
|
|
|
|
set_default_value HAIKU_CXXFLAGS ""
|
|
|
|
set_default_value HAIKU_LDFLAGS ""
|
2009-06-29 15:01:46 +04:00
|
|
|
set_default_value HAIKU_ARFLAGS cru
|
2005-10-29 20:27:43 +04:00
|
|
|
set_default_value HAIKU_UNARFLAGS x
|
2005-06-01 18:33:46 +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
|
2009-11-23 22:34:55 +03:00
|
|
|
--alternative-gcc-output-dir)
|
|
|
|
assertparam "$1" $#
|
|
|
|
cd $2 || exit 1
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR=`pwd`
|
|
|
|
HAIKU_ADD_ALTERNATIVE_GCC_LIBS=1
|
2009-11-23 22:34:55 +03:00
|
|
|
cd $currentDir
|
|
|
|
shift 2
|
|
|
|
;;
|
2006-10-04 03:41:59 +04:00
|
|
|
--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
|
2008-05-18 03:47:39 +04:00
|
|
|
--build-cross-tools-gcc4)
|
|
|
|
assertparams "$1" 2 $#
|
|
|
|
buildCrossTools=$3
|
|
|
|
buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
|
|
|
|
case "$2" in
|
2010-01-04 22:36:58 +03:00
|
|
|
x86) HAIKU_GCC_MACHINE=i586-pc-haiku;;
|
|
|
|
ppc) HAIKU_GCC_MACHINE=powerpc-apple-haiku; targetArch=ppc;;
|
|
|
|
m68k) HAIKU_GCC_MACHINE=m68k-unknown-haiku; targetArch=m86k;;
|
|
|
|
arm) HAIKU_GCC_MACHINE=arm-unknown-haiku; targetArch=arm;;
|
|
|
|
mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku; targetArch=mips;;
|
2008-05-18 03:47:39 +04:00
|
|
|
*) echo "Unsupported target architecture: $2"
|
|
|
|
exit 1;;
|
|
|
|
esac
|
2010-01-04 22:36:58 +03:00
|
|
|
buildCrossToolsMachine=$HAIKU_GCC_MACHINE
|
2008-05-18 03:47:39 +04:00
|
|
|
shift 3
|
|
|
|
;;
|
|
|
|
--cross-tools-prefix)
|
|
|
|
assertparam "$1" $#
|
|
|
|
crossToolsPrefix=$2
|
|
|
|
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;;
|
2009-11-23 22:34:55 +03:00
|
|
|
--help | -h) usage; exit 0;;
|
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;;
|
2010-01-04 22:36:58 +03:00
|
|
|
--target=*) TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
|
|
|
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=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;;
|
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
|
2005-10-31 03:00:27 +03:00
|
|
|
BeOS) revision=`uname -r`
|
|
|
|
case "$revision" in
|
2010-01-04 22:36:58 +03:00
|
|
|
6.*) HOST_PLATFORM=dano ;;
|
|
|
|
5.1) HOST_PLATFORM=dano ;;
|
|
|
|
5.0.4) HOST_PLATFORM=bone ;;
|
|
|
|
5.0*) HOST_PLATFORM=r5 ;;
|
2005-10-31 03:00:27 +03:00
|
|
|
*) echo Unknown BeOS version: $revision
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
;;
|
2010-01-04 22:36:58 +03:00
|
|
|
Darwin) HOST_PLATFORM=darwin ;;
|
|
|
|
FreeBSD) HOST_PLATFORM=freebsd
|
2010-01-08 01:08:12 +03:00
|
|
|
SFDISK_BINARY=sfdisk-linux
|
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
|
|
|
|
2009-04-13 14:50:17 +04:00
|
|
|
# check yasm version
|
|
|
|
if [ $targetArch = "x86" ]; then
|
|
|
|
$HAIKU_YASM --version > /dev/null || {
|
2009-04-14 04:07:31 +04:00
|
|
|
echo "The yasm assembler version 0.7.0 or later must be installed."
|
2009-04-13 14:50:17 +04:00
|
|
|
echo "Download from: http://www.tortall.net/projects/yasm/wiki/Download"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
set -- $($HAIKU_YASM --version | head -n 1)
|
|
|
|
versionOK=0
|
|
|
|
case $2 in
|
2009-04-14 04:07:31 +04:00
|
|
|
0.[0-6].*) ;;
|
2009-04-13 14:50:17 +04:00
|
|
|
*) versionOK=1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ $versionOK = 0 ]; then
|
2009-04-14 04:07:31 +04:00
|
|
|
echo "The yasm assembler version 0.7.0 or later must be installed."
|
2009-04-13 14:50:17 +04:00
|
|
|
echo "The installed version is $2."
|
|
|
|
echo "Download from: http://www.tortall.net/projects/yasm/wiki/Download"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-01-08 01:08:12 +03:00
|
|
|
# check common locations for sfdisk
|
|
|
|
for sfdiskDir in /sbin /usr/sbin /usr/local/sbin ; do
|
|
|
|
if [ -e ${sfdiskDir}/${SFDISK_BINARY} ]; then
|
|
|
|
HOST_SFDISK=${sfdiskDir}/${SFDISK_BINARY}
|
|
|
|
fi
|
2010-01-11 05:55:41 +03:00
|
|
|
done
|
2010-01-08 01:08:12 +03:00
|
|
|
|
2009-05-30 04:38:43 +04:00
|
|
|
# check for case-sensitive filesystem if on darwin
|
2010-01-04 22:36:58 +03:00
|
|
|
if [ $HOST_PLATFORM = "darwin" ]; then
|
2009-09-03 20:25:23 +04:00
|
|
|
diskutil info $(pwd) | grep -i "case-sensitive" > /dev/null
|
2009-05-30 04:38:43 +04:00
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo "You need a case-sensitive file-system to build Haiku."
|
|
|
|
echo "Please see the following guide on how to set one up:"
|
|
|
|
echo "http://haiku-os.org/documents/dev/how_to_build_haiku_on_mac_os_x"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
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
|
|
|
|
|
|
|
# build cross tools from sources
|
|
|
|
if [ -n "$buildCrossTools" ]; then
|
2005-12-07 01:45:11 +03:00
|
|
|
"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
|
2009-11-23 22:34:55 +03:00
|
|
|
"$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1
|
2010-01-04 22:36:58 +03:00
|
|
|
crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-"
|
2005-10-29 20:27:43 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# cross tools
|
|
|
|
if [ -n "$crossToolsPrefix" ]; then
|
|
|
|
get_build_tool_path AR ar
|
|
|
|
get_build_tool_path CC gcc
|
|
|
|
get_build_tool_path LD ld
|
|
|
|
get_build_tool_path OBJCOPY objcopy
|
|
|
|
get_build_tool_path RANLIB ranlib
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prepare gcc settings
|
|
|
|
standard_gcc_settings
|
|
|
|
|
2007-02-21 17:08:08 +03:00
|
|
|
# check whether the Haiku compiler really targets Haiku or BeOS
|
2010-01-04 22:36:58 +03:00
|
|
|
case "$HAIKU_GCC_MACHINE" in
|
2007-02-21 17:08:08 +03:00
|
|
|
*-*-haiku) ;;
|
|
|
|
*-*-beos) ;;
|
|
|
|
*) 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
|
2010-01-04 22:36:58 +03:00
|
|
|
echo compiler is configured for target: $HAIKU_GCC_MACHINE
|
2007-02-21 17:08:08 +03:00
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
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}" ;
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR ?= ${HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR} ;
|
|
|
|
HAIKU_ADD_ALTERNATIVE_GCC_LIBS ?= ${HAIKU_ADD_ALTERNATIVE_GCC_LIBS} ;
|
|
|
|
|
|
|
|
HAIKU_GCC_RAW_VERSION ?= ${HAIKU_GCC_RAW_VERSION} ;
|
|
|
|
HAIKU_GCC_MACHINE ?= ${HAIKU_GCC_MACHINE} ;
|
2007-05-20 21:50:11 +04:00
|
|
|
HAIKU_GCC_LIB_DIR ?= ${HAIKU_GCC_LIB_DIR} ;
|
|
|
|
HAIKU_GCC_HEADERS_DIR ?= ${HAIKU_GCC_HEADERS_DIR} ;
|
|
|
|
HAIKU_GCC_LIBGCC ?= ${HAIKU_GCC_LIBGCC} ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_STATIC_LIBSTDC++ ?= ${HAIKU_STATIC_LIBSTDCXX} ;
|
|
|
|
HAIKU_SHARED_LIBSTDC++ ?= ${HAIKU_SHARED_LIBSTDCXX} ;
|
|
|
|
HAIKU_STATIC_LIBSUPC++ ?= ${HAIKU_STATIC_LIBSUPCXX} ;
|
|
|
|
HAIKU_SHARED_LIBSUPC++ ?= ${HAIKU_SHARED_LIBSUPCXX} ;
|
|
|
|
HAIKU_C++_HEADERS_DIR ?= ${HAIKU_CXX_HEADERS_DIR} ;
|
2005-11-13 01:58:54 +03:00
|
|
|
|
2010-01-04 22:36:58 +03:00
|
|
|
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-05-20 21:50:11 +04:00
|
|
|
HAIKU_AR ?= ${HAIKU_AR} ;
|
|
|
|
HAIKU_CC ?= ${HAIKU_CC} ;
|
|
|
|
HAIKU_LD ?= ${HAIKU_LD} ;
|
|
|
|
HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ;
|
|
|
|
HAIKU_RANLIB ?= ${HAIKU_RANLIB} ;
|
2009-04-13 14:50:17 +04:00
|
|
|
HAIKU_YASM ?= ${HAIKU_YASM} ;
|
2007-05-20 21:50:11 +04:00
|
|
|
HAIKU_CPPFLAGS ?= ${HAIKU_CPPFLAGS} ;
|
|
|
|
HAIKU_CCFLAGS ?= ${HAIKU_CCFLAGS} ;
|
|
|
|
HAIKU_CXXFLAGS ?= ${HAIKU_CXXFLAGS} ;
|
|
|
|
HAIKU_LDFLAGS ?= ${HAIKU_LDFLAGS} ;
|
|
|
|
HAIKU_ARFLAGS ?= ${HAIKU_ARFLAGS} ;
|
|
|
|
HAIKU_UNARFLAGS ?= ${HAIKU_UNARFLAGS} ;
|
|
|
|
|
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} ;
|
2010-01-08 01:08:12 +03:00
|
|
|
HOST_SFDISK ?= ${HOST_SFDISK} ;
|
2005-11-13 01:58:54 +03:00
|
|
|
|
2002-07-16 03:42:06 +04:00
|
|
|
EOF
|
|
|
|
|
2005-01-26 04:34:37 +03:00
|
|
|
# Libgcc.a objects
|
|
|
|
|
2006-08-03 21:57:34 +04:00
|
|
|
cat << EOF > "$buildOutputDir/libgccObjects"
|
2005-01-26 04:34:37 +03:00
|
|
|
# libgcc.a objects to be linked against libroot.so
|
|
|
|
# Note: This file has been automatically generated by configure.
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
HAIKU_GCC_LIBGCC_OBJECTS ?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
|
2005-01-26 04:34:37 +03:00
|
|
|
EOF
|
|
|
|
|
2004-11-19 22:24:10 +03:00
|
|
|
# Generate Timezones binaries bindings
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
timezoneSources="africa antarctica asia australasia europe northamerica
|
|
|
|
southamerica pacificnew etcetera factory backward"
|
|
|
|
|
2006-08-03 21:57:34 +04:00
|
|
|
cat << EOF > "$buildOutputDir/Timezones"
|
2005-01-26 04:34:37 +03:00
|
|
|
# Timezones used for the build
|
|
|
|
# Note: This file has been automatically generated by configure.
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
HAIKU_TIME_ZONE_SOURCES = ${timezoneSources} ;
|
|
|
|
|
2005-01-26 04:34:37 +03:00
|
|
|
EOF
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
for source in ${timezoneSources}; do
|
2009-11-10 16:48:56 +03:00
|
|
|
f=$sourceDir/src/data/timezones/$source
|
2004-11-19 22:24:10 +03:00
|
|
|
|
2006-08-03 21:57:34 +04:00
|
|
|
TZOBJECTS=`gawk '/^Zone/ { print $2 } /^Link/ { print $3 } ' "$f" `
|
2004-11-19 22:24:10 +03:00
|
|
|
|
2006-08-03 21:57:34 +04:00
|
|
|
cat << EOF >> "$buildOutputDir/Timezones"
|
2005-10-29 20:27:43 +04:00
|
|
|
TZ_OBJECTS on <timezone-source>${source} ?= $TZOBJECTS ;
|
2004-11-19 22:24:10 +03:00
|
|
|
EOF
|
|
|
|
done
|
2005-10-29 20:27:43 +04: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
|