e173a1ec1c
* Add configure option --bootstrap which allows specifying the haikuporter and HaikuPorts repository paths. * Add rules for supporting a second repository type. The PackageRepository rule is now private and RemotePackageRepository is used for remote repositories. The new BootstrapPackageRepository rule is for defining a bootstrap repository (there will probably be only the HaikuPorts cross repository) whose packages can be built as needed via haikuporter. * Rename DownloadPackage to FetchPackage. * Define repository HaikuPortsCross. * HaikuCrossDevel package(s): There are now two sets of packages: A "stage1" set with the same content as before and a final set additionally containing the libraries libbe, libnetwork, libpackage. Those are needed for building the libsolv bootstrap package while for building them we need other bootstrap packages (ICU, libz). This is basically all that's required to build a bootstrap Haiku completely from sources, with a few caveats: * There's no ICU bootstrap recipe yet (so one has to cheat and use the prebuilt package ATM). * Probably doesn't work on Haiku yet (tested on Linux only). * A 32 bit environment must be used (otherwise building the gcc 2 bootstrap package fails). * Building with multiple jobs doesn't work yet, since haikuporter uses common directories for building different packages and there's no explicit serialization yet. * Haven't tested the resulting image save for booting it. So it probably needs a bit more work before it can actually build the final HaikuPorts packages.
726 lines
24 KiB
Bash
Executable File
726 lines
24 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# configure [ <options> ]
|
|
|
|
# usage
|
|
#
|
|
# Prints usage.
|
|
#
|
|
usage()
|
|
{
|
|
cat << EOF
|
|
|
|
Usage: $0 <options>
|
|
options:
|
|
--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.
|
|
--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
|
|
directory under "cross-tools". The HAIKU_* tools
|
|
variables will be set accordingly.
|
|
--build-cross-tools-gcc4 <arch> <build tools dir>
|
|
Like "--build-cross-tools" just that gcc 4 will
|
|
be used for cross-compilation. Note, that the
|
|
resulting Haiku installation built with gcc 4
|
|
will not be binary compatible with BeOS R5.
|
|
<arch> specifies the target architecture, either
|
|
"x86", "x86_64", "ppc", "m68k", "arm" or "mipsel".
|
|
--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
|
|
prefix, e.g. "/path/to/tools/i586-pc-haiku-".
|
|
This overrides the HAIKU_* tool variables.
|
|
--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).
|
|
--enable-multiuser Enable experimental multiuser support.
|
|
--help Prints out this help.
|
|
--host-only Configure for building tools for the build host
|
|
only. Haiku cannot be built when configured like
|
|
this.
|
|
--include-gpl-addons Include GPL licensed add-ons.
|
|
--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.
|
|
--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.
|
|
--include-3rdparty Include 3rdparty/ in the build system.
|
|
-j<n> Only relevant for --build-cross-tools and
|
|
--build-cross-tools-gcc4. Is passed on to the
|
|
make building the build tools.
|
|
--target=TARGET Select build target platform.
|
|
[default=${TARGET_PLATFORM}]
|
|
valid targets=r5,bone,dano,haiku
|
|
--update re-runs last configure invocation [must be given
|
|
as first option!]
|
|
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
|
|
process, but uses more memory.
|
|
--use-gcc-graphite Build with GCC Graphite engine for loop
|
|
optimizations. Only for gcc 4.
|
|
--use-32bit Use -m32 flag on 64bit host gcc compiler.
|
|
--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).
|
|
|
|
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".
|
|
HAIKU_YASM The yasm assembler (x86 only).
|
|
HAIKU_STRIP The strip command. Defaults to "strip".
|
|
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.
|
|
Defaults to "cru".
|
|
HAIKU_UNARFLAGS The flags passed to HAIKU_AR for unarchiving.
|
|
Defaults to "x".
|
|
|
|
Non-standard output directories:
|
|
By default all objects, build configuration, and other related files are
|
|
stored in /path/to/haiku_source/generated. To store objects in a non-default
|
|
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
|
|
non-default location and running jam.
|
|
|
|
|
|
EOF
|
|
}
|
|
|
|
# assertparam
|
|
#
|
|
# Checks whether at least one parameter is left.
|
|
#
|
|
assertparam()
|
|
{
|
|
if [ $2 -lt 2 ]; then
|
|
echo $0: \`$1\': Parameter expected.
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# 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
|
|
}
|
|
|
|
# absolute_path
|
|
#
|
|
# returns the absolute path of a given path.
|
|
#
|
|
absolute_path()
|
|
{
|
|
if [[ "$1" == /* ]]; then
|
|
echo "$1"
|
|
else
|
|
echo "`pwd`/$1"
|
|
fi
|
|
}
|
|
|
|
# real_path
|
|
#
|
|
# returns the realpath of a symbolic link.
|
|
#
|
|
real_path()
|
|
{
|
|
perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
|
|
}
|
|
|
|
# standard_gcc_settings
|
|
#
|
|
# Sets the variables for a GCC platform.
|
|
#
|
|
standard_gcc_settings()
|
|
{
|
|
if which greadlink > /dev/null 2>&1; then
|
|
readlink="greadlink -e"
|
|
elif which realpath > /dev/null 2>&1; then
|
|
readlink=realpath
|
|
elif readlink -e / > /dev/null 2>&1; then
|
|
readlink="readlink -e"
|
|
else
|
|
readlink=real_path
|
|
fi
|
|
|
|
# PLATFORM_LINKLIBS
|
|
gcclib=`$HAIKU_CC -print-libgcc-file-name`
|
|
gccdir=`dirname ${gcclib}`
|
|
|
|
HAIKU_GCC_RAW_VERSION=`$HAIKU_CC -dumpversion`
|
|
HAIKU_GCC_MACHINE=`$HAIKU_CC -dumpmachine`
|
|
if [ "$HAIKU_USE_GCC_GRAPHITE" != 0 ]; then
|
|
UNUSED=`echo "int main() {}" | $HAIKU_CC -xc -c -floop-block - 2>&1`
|
|
if [ $? != 0 ]; then
|
|
echo "GCC Graphite loop optimizations cannot be used"
|
|
HAIKU_USE_GCC_GRAPHITE=0
|
|
fi
|
|
fi
|
|
|
|
HAIKU_GCC_LIB_DIR=${gccdir}
|
|
HAIKU_GCC_LIBGCC=${gccdir}/libgcc.a
|
|
HAIKU_GCC_GLUE_CODE="crtbegin.o crtend.o"
|
|
HAIKU_GCC_HEADERS_DIR="${gccdir}/include
|
|
${gccdir}/include-fixed"
|
|
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.
|
|
|
|
# determine architecture from machine triple
|
|
case $HAIKU_GCC_MACHINE in
|
|
arm-*) HAIKU_CPU=arm;;
|
|
i?86-*) HAIKU_CPU=x86;;
|
|
m68k-*) HAIKU_CPU=m68k;;
|
|
mipsel-*) HAIKU_CPU=mipsel;;
|
|
powerpc-*) HAIKU_CPU=ppc;;
|
|
x86_64-*) HAIKU_CPU=x86_64;;
|
|
*)
|
|
echo "Unsupported gcc target machine: $HAIKU_GCC_MACHINE" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
HAIKU_PACKAGING_ARCH=$HAIKU_CPU
|
|
|
|
case $HAIKU_GCC_RAW_VERSION in
|
|
4.*)
|
|
# for gcc 4 we use the libstdc++ and libsupc++ that come with the
|
|
# compiler
|
|
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`
|
|
|
|
# If the architecture has separate runtime libraries for the
|
|
# kernel, use them.
|
|
HAIKU_KERNEL_LIBGCC=`$HAIKU_CC -print-file-name=libgcc-kernel.a`
|
|
if [ $HAIKU_KERNEL_LIBGCC = libgcc-kernel.a ]; then
|
|
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
|
fi
|
|
HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
|
|
if [ $HAIKU_KERNEL_LIBSUPCXX = libsupc++-kernel.a ]; then
|
|
HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
|
fi
|
|
|
|
local headers
|
|
if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
|
|
headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
|
|
else
|
|
headers=$gccdir/../../../../include/c++/$HAIKU_GCC_RAW_VERSION
|
|
fi
|
|
|
|
HAIKU_CXX_HEADERS_DIR=$headers
|
|
for d in $HAIKU_GCC_MACHINE backward ext; do
|
|
# Note: We need the line break, otherwise the line might become
|
|
# too long for jam (512 bytes max).
|
|
HAIKU_CXX_HEADERS_DIR="$HAIKU_CXX_HEADERS_DIR
|
|
$headers/$d"
|
|
done
|
|
|
|
# Unset the HAIKU_{SHARED,STATIC}_LIB{STD,SUP}CXX variables, if the
|
|
# compiler didn't give us actual file names. Otherwise resolve
|
|
# symlinks to avoid problems when copying the libraries to the
|
|
# image.
|
|
|
|
if [ $HAIKU_STATIC_LIBSTDCXX = libstdc++.a ]; then
|
|
HAIKU_STATIC_LIBSTDCXX=
|
|
else
|
|
HAIKU_STATIC_LIBSTDCXX=`$readlink $HAIKU_STATIC_LIBSTDCXX`
|
|
fi
|
|
|
|
if [ $HAIKU_SHARED_LIBSTDCXX = libstdc++.so ]; then
|
|
HAIKU_SHARED_LIBSTDCXX=
|
|
else
|
|
HAIKU_SHARED_LIBSTDCXX=`$readlink $HAIKU_SHARED_LIBSTDCXX`
|
|
fi
|
|
|
|
if [ $HAIKU_STATIC_LIBSUPCXX = libsupc++.a ]; then
|
|
HAIKU_STATIC_LIBSUPCXX=
|
|
else
|
|
HAIKU_STATIC_LIBSUPCXX=`$readlink $HAIKU_STATIC_LIBSUPCXX`
|
|
fi
|
|
|
|
if [ $HAIKU_SHARED_LIBSUPCXX = libsupc++.so ]; then
|
|
HAIKU_SHARED_LIBSUPCXX=
|
|
else
|
|
HAIKU_SHARED_LIBSUPCXX=`$readlink $HAIKU_SHARED_LIBSUPCXX`
|
|
fi
|
|
;;
|
|
2.9*)
|
|
# check for correct (most up-to-date) legacy compiler and complain
|
|
# if an older one is installed
|
|
if [ $HAIKU_GCC_RAW_VERSION != $haikuRequiredLegacyGCCVersion ]; then
|
|
echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
|
|
echo "Please download it from www.haiku-os.org...";
|
|
exit 1;
|
|
fi
|
|
|
|
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
|
HAIKU_KERNEL_LIBSUPCXX=
|
|
HAIKU_PACKAGING_ARCH=x86_gcc2
|
|
;;
|
|
esac
|
|
|
|
case $HAIKU_GCC_MACHINE in
|
|
x86_64-*)
|
|
# Boot loader is 32-bit, need the 32-bit libs.
|
|
HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
|
|
HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
|
|
;;
|
|
*)
|
|
HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
|
|
HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# set_default_value
|
|
#
|
|
# Set the value for a variable, if no value is set yet.
|
|
#
|
|
set_default_value()
|
|
{
|
|
eval "$1=\${$1-$2}"
|
|
}
|
|
|
|
# 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"
|
|
|
|
if [ -f "$path" ]; then
|
|
# get absolute path
|
|
local oldPwd="`pwd`"
|
|
cd "`dirname "$path"`"
|
|
path="`pwd`/`basename "$path"`"
|
|
cd $oldPwd
|
|
else
|
|
which "$path" > /dev/null 2>&1 || {
|
|
echo "Build tool \"$path\" not found." >&2
|
|
exit 1
|
|
}
|
|
fi
|
|
|
|
eval "$var=$path"
|
|
}
|
|
|
|
# get cwd and the source directory
|
|
currentDir=`pwd`
|
|
cd `dirname "$0"`
|
|
sourceDir=`pwd`
|
|
cd "$currentDir"
|
|
|
|
# backup the passed arguments
|
|
configureArgs="$@"
|
|
|
|
# internal default parameter values
|
|
#
|
|
platform=`uname`
|
|
platformMachine=`uname -m`
|
|
crossToolsPrefix=
|
|
buildCrossTools=
|
|
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
|
buildCrossToolsMachine=
|
|
buildCrossToolsJobs=
|
|
|
|
# exported (BuildSetup) default parameter values
|
|
#
|
|
HAIKU_GCC_RAW_VERSION=
|
|
HAIKU_CPU=x86
|
|
HAIKU_PACKAGING_ARCH=x86_gcc2
|
|
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
|
|
HAIKU_INCLUDE_SOURCES=0
|
|
HAIKU_INCLUDE_3RDPARTY=0
|
|
HAIKU_ENABLE_MULTIUSER=0
|
|
HAIKU_DISTRO_COMPATIBILITY=default
|
|
TARGET_PLATFORM=haiku
|
|
HAIKU_USE_GCC_PIPE=0
|
|
HAIKU_USE_GCC_GRAPHITE=0
|
|
HAIKU_HOST_USE_32BIT=0
|
|
HAIKU_HOST_USE_XATTR=0
|
|
HAIKU_HOST_USE_XATTR_REF=0
|
|
HAIKU_HOST_BUILD_ONLY=0
|
|
HOST_GCC_LD=`gcc -print-prog-name=ld`
|
|
HOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
|
|
SFDISK_BINARY=sfdisk
|
|
HOST_SFDISK=$SFDISK_BINARY
|
|
HOST_SHA256=
|
|
HOST_HAIKU_PORTER=
|
|
HAIKU_PORTS=
|
|
HAIKU_PORTS_CROSS=
|
|
|
|
if sha256sum < /dev/null > /dev/null 2>&1; then
|
|
HOST_SHA256=sha256sum
|
|
elif sha256 < /dev/null > /dev/null 2>&1; then
|
|
HOST_SHA256="sha256 -q"
|
|
else
|
|
echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
haikuRequiredLegacyGCCVersion="2.95.3-haiku-2013_07_15"
|
|
export haikuRequiredLegacyGCCVersion
|
|
# version of legacy gcc required to build haiku
|
|
|
|
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
|
|
set_default_value HAIKU_ELFEDIT elfedit
|
|
set_default_value HAIKU_YASM yasm
|
|
set_default_value HAIKU_STRIP strip
|
|
set_default_value HAIKU_CPPFLAGS ""
|
|
set_default_value HAIKU_CCFLAGS ""
|
|
set_default_value HAIKU_CXXFLAGS ""
|
|
set_default_value HAIKU_LDFLAGS ""
|
|
set_default_value HAIKU_ARFLAGS cru
|
|
set_default_value HAIKU_UNARFLAGS x
|
|
|
|
# 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
|
|
|
|
# parse parameters
|
|
#
|
|
while [ $# -gt 0 ] ; do
|
|
case "$1" in
|
|
--bootstrap)
|
|
assertparams "$1" 3 $#
|
|
HOST_HAIKU_PORTER="`absolute_path $2`"
|
|
HAIKU_PORTS_CROSS="`absolute_path $3`"
|
|
HAIKU_PORTS="`absolute_path $4`"
|
|
shift 4
|
|
;;
|
|
--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
|
|
--build-cross-tools-gcc4)
|
|
assertparams "$1" 2 $#
|
|
buildCrossTools=$3
|
|
buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
|
|
case "$2" in
|
|
x86) HAIKU_GCC_MACHINE=i586-pc-haiku;;
|
|
x86_64) HAIKU_GCC_MACHINE=x86_64-unknown-haiku;;
|
|
ppc) HAIKU_GCC_MACHINE=powerpc-apple-haiku;;
|
|
m68k) HAIKU_GCC_MACHINE=m68k-unknown-haiku;;
|
|
arm) HAIKU_GCC_MACHINE=arm-unknown-haiku;;
|
|
mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku;;
|
|
*) echo "Unsupported target architecture: $2"
|
|
exit 1;;
|
|
esac
|
|
buildCrossToolsMachine=$HAIKU_GCC_MACHINE
|
|
shift 3
|
|
;;
|
|
--cross-tools-prefix)
|
|
assertparam "$1" $#
|
|
crossToolsPrefix=$2
|
|
shift 2
|
|
;;
|
|
--distro-compatibility)
|
|
assertparam "$1" $#
|
|
HAIKU_DISTRO_COMPATIBILITY=$2
|
|
case "$HAIKU_DISTRO_COMPATIBILITY" in
|
|
official) ;;
|
|
compatible) ;;
|
|
default) ;;
|
|
*) echo "Invalid distro compatibility" \
|
|
"level: $HAIKU_DISTRO_COMPATIBILITY"
|
|
exit 1;;
|
|
esac
|
|
shift 2
|
|
;;
|
|
--enable-multiuser) HAIKU_ENABLE_MULTIUSER=1; shift 1;;
|
|
--help | -h) usage; exit 0;;
|
|
--host-only) HAIKU_HOST_BUILD_ONLY=1; shift 1;;
|
|
--include-gpl-addons) HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;;
|
|
--include-patented-code) HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;;
|
|
--include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;;
|
|
--include-3rdparty) HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
|
|
-j*) buildCrossToolsJobs="$1"; shift 1;;
|
|
--target=*) TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
|
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
|
|
--use-gcc-graphite) HAIKU_USE_GCC_GRAPHITE=1; shift 1;;
|
|
--use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;;
|
|
--use-xattr) HAIKU_HOST_USE_XATTR=1; shift 1;;
|
|
--use-xattr-ref) HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
|
|
*) echo Invalid argument: \`$1\'; exit 1;;
|
|
esac
|
|
done
|
|
|
|
# detect the build platform
|
|
case "${platform}" in
|
|
BeOS) revision=`uname -r`
|
|
case "$revision" in
|
|
6.*) HOST_PLATFORM=dano ;;
|
|
5.1) HOST_PLATFORM=dano ;;
|
|
5.0.4) HOST_PLATFORM=bone ;;
|
|
5.0*) HOST_PLATFORM=r5 ;;
|
|
*) echo Unknown BeOS version: $revision
|
|
exit 1 ;;
|
|
esac
|
|
;;
|
|
Darwin) HOST_PLATFORM=darwin ;;
|
|
FreeBSD) HOST_PLATFORM=freebsd
|
|
SFDISK_BINARY=sfdisk-linux
|
|
if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
|
|
echo Unsupported platform: FreeBSD ${platformMachine}
|
|
exit 1
|
|
fi ;;
|
|
Haiku) HOST_PLATFORM=haiku_host ;;
|
|
Linux) HOST_PLATFORM=linux ;;
|
|
OpenBSD) HOST_PLATFORM=openbsd ;;
|
|
SunOS) HOST_PLATFORM=sunos ;;
|
|
CYGWIN_NT-*) HOST_PLATFORM=cygwin ;;
|
|
*) echo Unsupported platform: ${platform}
|
|
exit 1 ;;
|
|
esac
|
|
|
|
# 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
|
|
done
|
|
|
|
# check for case-sensitive filesystem
|
|
mkdir haikuCaseTest 2>/dev/null
|
|
mkdir haikucasetest 2>/dev/null
|
|
caseInsensitive=$?
|
|
rmdir haikuCaseTest haikucasetest 2>/dev/null
|
|
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."
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
# create output directory
|
|
mkdir -p "$buildOutputDir" || exit 1
|
|
|
|
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
|
|
HAIKU_YASM=$invalidCommand
|
|
HAIKU_STRIP=$invalidCommand
|
|
else
|
|
# build cross tools from sources
|
|
if [ -n "$buildCrossTools" ]; then
|
|
export HAIKU_USE_GCC_GRAPHITE
|
|
"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
|
|
"$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1
|
|
crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-"
|
|
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
|
|
get_build_tool_path STRIP strip
|
|
fi
|
|
|
|
# prepare gcc settings
|
|
standard_gcc_settings
|
|
|
|
# cross tools for gcc4 builds
|
|
if [ -n "$crossToolsPrefix" ]; then
|
|
case $HAIKU_GCC_RAW_VERSION in
|
|
4.*)
|
|
get_build_tool_path ELFEDIT elfedit
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# check whether the Haiku compiler really targets Haiku or BeOS
|
|
case "$HAIKU_GCC_MACHINE" in
|
|
*-*-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
|
|
echo compiler is configured for target: $HAIKU_GCC_MACHINE
|
|
exit 1 ;;
|
|
esac
|
|
fi
|
|
|
|
# Generate BuildConfig
|
|
cat << EOF > "$buildConfigFile"
|
|
# BuildConfig
|
|
# Note: This file has been automatically generated by configure with the
|
|
# following arguments:
|
|
# ${configureArgs}
|
|
|
|
TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
|
|
HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
|
|
|
|
HAIKU_INCLUDE_GPL_ADDONS ?= "${HAIKU_INCLUDE_GPL_ADDONS}" ;
|
|
HAIKU_INCLUDE_PATENTED_CODE ?= "${HAIKU_INCLUDE_PATENTED_CODE}" ;
|
|
HAIKU_INCLUDE_SOURCES ?= "${HAIKU_INCLUDE_SOURCES}" ;
|
|
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}" ;
|
|
HAIKU_USE_GCC_GRAPHITE ?= "${HAIKU_USE_GCC_GRAPHITE}" ;
|
|
HAIKU_HOST_USE_32BIT ?= "${HAIKU_HOST_USE_32BIT}" ;
|
|
HAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ;
|
|
HAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ;
|
|
HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ;
|
|
|
|
HAIKU_GCC_RAW_VERSION ?= ${HAIKU_GCC_RAW_VERSION} ;
|
|
HAIKU_GCC_MACHINE ?= ${HAIKU_GCC_MACHINE} ;
|
|
HAIKU_GCC_LIB_DIR ?= ${HAIKU_GCC_LIB_DIR} ;
|
|
HAIKU_GCC_HEADERS_DIR ?= ${HAIKU_GCC_HEADERS_DIR} ;
|
|
HAIKU_GCC_LIBGCC ?= ${HAIKU_GCC_LIBGCC} ;
|
|
|
|
HAIKU_CPU ?= ${HAIKU_CPU} ;
|
|
HAIKU_PACKAGING_ARCH ?= ${HAIKU_PACKAGING_ARCH} ;
|
|
|
|
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} ;
|
|
|
|
HAIKU_KERNEL_LIBGCC ?= ${HAIKU_KERNEL_LIBGCC} ;
|
|
HAIKU_KERNEL_LIBSUPC++ ?= ${HAIKU_KERNEL_LIBSUPCXX} ;
|
|
HAIKU_BOOT_LIBGCC ?= ${HAIKU_BOOT_LIBGCC} ;
|
|
HAIKU_BOOT_LIBSUPC++ ?= ${HAIKU_BOOT_LIBSUPCXX} ;
|
|
|
|
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
|
|
|
|
HAIKU_AR ?= ${HAIKU_AR} ;
|
|
HAIKU_CC ?= ${HAIKU_CC} ;
|
|
HAIKU_LD ?= ${HAIKU_LD} ;
|
|
HAIKU_OBJCOPY ?= ${HAIKU_OBJCOPY} ;
|
|
HAIKU_RANLIB ?= ${HAIKU_RANLIB} ;
|
|
HAIKU_ELFEDIT ?= ${HAIKU_ELFEDIT} ;
|
|
HAIKU_YASM ?= ${HAIKU_YASM} ;
|
|
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} ;
|
|
|
|
HOST_GCC_RAW_VERSION ?= ${HOST_GCC_RAW_VERSION} ;
|
|
HOST_GCC_MACHINE ?= ${HOST_GCC_MACHINE} ;
|
|
HOST_LD ?= ${HOST_GCC_LD} ;
|
|
HOST_OBJCOPY ?= ${HOST_GCC_OBJCOPY} ;
|
|
HOST_SFDISK ?= ${HOST_SFDISK} ;
|
|
HOST_SHA256 ?= ${HOST_SHA256} ;
|
|
|
|
HOST_HAIKU_PORTER ?= ${HOST_HAIKU_PORTER} ;
|
|
HAIKU_PORTS ?= ${HAIKU_PORTS} ;
|
|
HAIKU_PORTS_CROSS ?= ${HAIKU_PORTS_CROSS} ;
|
|
|
|
EOF
|
|
|
|
# Libgcc.a objects
|
|
|
|
cat << EOF > "$buildOutputDir/libgccObjects"
|
|
# libgcc.a objects to be linked against libroot.so
|
|
# Note: This file has been automatically generated by configure.
|
|
|
|
HAIKU_GCC_LIBGCC_OBJECTS ?= ${HAIKU_GCC_LIBGCC_OBJECTS} ;
|
|
EOF
|
|
|
|
# Generate a boot strap Jamfile in the output directory.
|
|
|
|
cat << EOF > $outputDir/Jamfile
|
|
# automatically generated Jamfile
|
|
|
|
HAIKU_TOP = ${sourceDir} ;
|
|
HAIKU_OUTPUT_DIR = ${outputDir} ;
|
|
|
|
include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
|
|
|
|
EOF
|