2002-07-09 14:24:59 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2005-10-29 18:27:43 +02:00
|
|
|
# configure [ <options> ]
|
2004-10-18 03:59:54 +02:00
|
|
|
|
2002-07-15 00:09:44 +02:00
|
|
|
# usage
|
|
|
|
#
|
|
|
|
# Prints usage.
|
|
|
|
#
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
Usage: $0 <options>
|
|
|
|
options:
|
2017-12-05 02:14:18 +01:00
|
|
|
--help Prints out this help.
|
|
|
|
--update Re-runs last configure invocation [must be given
|
|
|
|
as first option!]
|
2013-07-21 04:10:48 +02: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.
|
2020-09-12 03:30:38 +02:00
|
|
|
--build-cross-tools <arch>
|
|
|
|
Assume cross compilation.
|
|
|
|
Toolchain will be compiled and placed in the
|
|
|
|
output directory under "cross-tools". The
|
|
|
|
HAIKU_* tools variables will be set accordingly.
|
2005-12-06 23:45:11 +01:00
|
|
|
<arch> specifies the target architecture, either
|
2018-11-04 20:37:09 +01:00
|
|
|
"x86_gcc2", "x86", "x86_64", "ppc", "m68k",
|
2019-04-04 05:50:47 +02:00
|
|
|
"arm", "arm64", "riscv64", "sparc"
|
2013-07-25 23:52:11 +02: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).
|
2007-02-04 15:03:21 +01: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 00:06:23 +01:00
|
|
|
prefix, e.g. "/path/to/tools/i586-pc-haiku-".
|
2007-02-04 15:03:21 +01:00
|
|
|
This overrides the HAIKU_* tool variables.
|
2020-09-12 03:30:38 +02:00
|
|
|
--cross-tools-source <buildtools dir>
|
|
|
|
Toolchain sources for cross compilation.
|
|
|
|
<buildtools dir> defines the location of the
|
|
|
|
buildtools sources.
|
2007-05-20 19:50:11 +02: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).
|
2013-07-03 23:19:00 +02:00
|
|
|
--host-only Configure for building tools for the build host
|
|
|
|
only. Haiku cannot be built when configured like
|
|
|
|
this.
|
2010-02-25 17:13:22 +01: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 15:48:51 +01:00
|
|
|
--include-3rdparty Include 3rdparty/ in the build system.
|
2014-05-12 07:33:31 +02:00
|
|
|
-j<n> Only relevant for --build-cross-tools. Is passed
|
|
|
|
on to the make building the build tools.
|
2014-04-30 23:47:55 +02:00
|
|
|
--no-downloads Do not download anything. Useful when trying to
|
|
|
|
bootstrap and build Haiku from source only.
|
2021-07-21 03:28:04 +02:00
|
|
|
--sysroot The location of the cross-compiler sysroot,
|
|
|
|
primarily for CI environments or cross-compilers
|
|
|
|
used outside of the Haiku build system.
|
2013-08-12 17:18:02 +02: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.
|
2017-11-23 17:29:15 +01:00
|
|
|
--use-clang <arch> Build with host Clang instead of GCC cross
|
|
|
|
compiler, targeting <arch>
|
2007-02-04 15:03:21 +01:00
|
|
|
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
|
2007-02-15 10:10:31 +01:00
|
|
|
process, but uses more memory.
|
2013-04-06 14:07:24 +02:00
|
|
|
--use-gcc-graphite Build with GCC Graphite engine for loop
|
2017-12-05 22:18:57 +01:00
|
|
|
optimizations. (Only for GCC 4+.)
|
2007-08-23 00:07:03 +02:00
|
|
|
--use-32bit Use -m32 flag on 64bit host gcc compiler.
|
2017-12-05 22:58:11 +01:00
|
|
|
--no-full-xattr Do not use Linux/*BSD/Darwin's native extended file
|
|
|
|
attributes as Haiku attributes. If they are still
|
|
|
|
available, they will be used to store hashes for
|
|
|
|
the attribute emulation layer.
|
|
|
|
--no-xattr Do not use Linux/*BSD/Darwin's native extended file
|
|
|
|
attributes for Haiku extended attributes at all,
|
|
|
|
even if they are available.
|
2016-10-20 02:35:23 +02:00
|
|
|
--with-gdb <gdb sources dir>
|
|
|
|
specify the path to a GDB source dir, to build
|
|
|
|
GDB for each arch we build the cross-tools for.
|
2021-05-01 15:24:28 +02:00
|
|
|
--use-stack-protector Build with stack protection enabled
|
2022-02-06 23:24:02 +01:00
|
|
|
--efi-signing-key Private keyfile to sign any EFI bootloaders
|
2024-09-13 05:57:15 +02:00
|
|
|
--with-python <python> Specify python to use, instead of system
|
|
|
|
default.
|
2005-10-29 18:27:43 +02:00
|
|
|
|
|
|
|
environment variables:
|
2014-07-26 11:21:51 +02:00
|
|
|
CC The host compiler. Defaults to "gcc".
|
2017-12-01 20:23:57 +01:00
|
|
|
HAIKU_AR_<arch> The static library archiver for <arch>.
|
2013-07-25 23:52:11 +02:00
|
|
|
Defaults to "ar".
|
2017-12-01 20:23:57 +01:00
|
|
|
HAIKU_CC_<arch> The compiler for <arch>. Defaults to "gcc".
|
|
|
|
HAIKU_LD_<arch> The <arch> linker. Defaults to "ld".
|
|
|
|
HAIKU_OBJCOPY_<arch> The <arch> objcopy to be used. Defaults to
|
2013-07-25 23:52:11 +02:00
|
|
|
"objcopy".
|
2017-12-01 20:23:57 +01:00
|
|
|
HAIKU_RANLIB_<arch> The static library indexer for <arch>. Defaults
|
2013-07-25 23:52:11 +02:00
|
|
|
to "ranlib".
|
2017-12-01 20:23:57 +01:00
|
|
|
HAIKU_STRIP_<arch> The <arch> strip command. Defaults to "strip".
|
2014-03-28 23:07:04 +01:00
|
|
|
HAIKU_NASM The nasm assembler (x86 and x86_64 only).
|
2013-07-25 23:52:11 +02: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 "".
|
2018-08-15 20:19:30 +02:00
|
|
|
HAIKU_LINKFLAGS_<arch> The flags passed to the compiler when linking for
|
|
|
|
target architecture <arch>. Defaults to "".
|
2013-07-25 23:52:11 +02:00
|
|
|
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
|
2018-11-22 03:16:40 +01:00
|
|
|
"cru".
|
2013-07-25 23:52:11 +02:00
|
|
|
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 15:20:24 +01:00
|
|
|
By default all objects, build configuration, and other related files are
|
2009-02-03 02:08:40 +01:00
|
|
|
stored in /path/to/haiku_source/generated. To store objects in a non-default
|
2009-02-24 15:20:24 +01: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 02:08:40 +01:00
|
|
|
non-default location and running jam.
|
|
|
|
|
|
|
|
|
2002-07-15 00:09:44 +02:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
# assertparam
|
|
|
|
#
|
|
|
|
# Checks whether at least one parameter is left.
|
|
|
|
#
|
|
|
|
assertparam()
|
|
|
|
{
|
2005-12-06 23:45:11 +01:00
|
|
|
if [ $2 -lt 2 ]; then
|
2002-07-15 00:09:44 +02:00
|
|
|
echo $0: \`$1\': Parameter expected.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2005-12-06 23:45:11 +01: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 04:10:48 +02:00
|
|
|
# absolute_path
|
|
|
|
#
|
|
|
|
# returns the absolute path of a given path.
|
|
|
|
#
|
|
|
|
absolute_path()
|
|
|
|
{
|
2013-09-28 23:58:12 +02:00
|
|
|
if [ "x$1" != "x${1#/}" ]; then
|
2013-07-21 04:10:48 +02:00
|
|
|
echo "$1"
|
|
|
|
else
|
|
|
|
echo "`pwd`/$1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-26 17:25:25 +02: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 07:18:29 +02: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 18:17:36 +02:00
|
|
|
# real_path
|
|
|
|
#
|
|
|
|
# returns the realpath of a symbolic link.
|
|
|
|
#
|
|
|
|
real_path()
|
|
|
|
{
|
|
|
|
perl -MCwd=realpath -e'print realpath($ARGV[0]), "\n"' "$1"
|
|
|
|
}
|
|
|
|
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
# relative_to
|
|
|
|
#
|
|
|
|
# returns $1 relative to $2
|
|
|
|
#
|
|
|
|
relative_to()
|
|
|
|
{
|
|
|
|
perl -e 'use File::Spec; print File::Spec->abs2rel(@ARGV) . "\n"' \
|
2019-01-10 00:52:02 +01:00
|
|
|
"$1" "$2"
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
}
|
|
|
|
|
2018-03-01 16:37:57 +01:00
|
|
|
# valid_toolchain
|
|
|
|
#
|
2018-05-23 02:43:11 +02:00
|
|
|
# check if a toolchain is valid
|
2018-03-01 16:37:57 +01:00
|
|
|
#
|
|
|
|
valid_toolchain()
|
|
|
|
{
|
|
|
|
TRIPLET="$1"
|
|
|
|
BASE="$2"
|
2018-05-23 02:43:11 +02:00
|
|
|
SOURCE="$3"
|
2018-03-01 16:37:57 +01:00
|
|
|
if [ ! -d "$BASE" ]; then
|
2018-05-23 02:43:11 +02:00
|
|
|
return 1
|
2018-03-01 16:37:57 +01:00
|
|
|
fi
|
|
|
|
if [ -f "$BASE/bin/$TRIPLET-gcc" ]; then
|
2018-05-23 02:43:11 +02:00
|
|
|
[ "$BASE/bin/$TRIPLET-gcc" -nt "$SOURCE/legacy/gcc/configure" ] && \
|
|
|
|
[ "$BASE/bin/$TRIPLET-gcc" -nt "$SOURCE/gcc/gcc/configure" ]
|
|
|
|
return $?
|
2018-03-01 16:37:57 +01:00
|
|
|
fi
|
2018-05-23 02:43:11 +02:00
|
|
|
return 1
|
2018-03-01 16:37:57 +01:00
|
|
|
}
|
|
|
|
|
2020-10-07 05:46:18 +02:00
|
|
|
# is_legacy_gcc
|
|
|
|
#
|
|
|
|
# Determines if the specified GCC version is a "legacy" (i.e. GCC < 4) one.
|
|
|
|
#
|
|
|
|
is_legacy_gcc()
|
|
|
|
{
|
|
|
|
if [ `echo $1 | cut -d'.' -f1` -lt 4 ]; then
|
|
|
|
echo 1
|
|
|
|
else
|
|
|
|
echo 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2003-05-06 00:07:33 +02:00
|
|
|
# standard_gcc_settings
|
|
|
|
#
|
|
|
|
# Sets the variables for a GCC platform.
|
|
|
|
#
|
|
|
|
standard_gcc_settings()
|
|
|
|
{
|
2017-12-01 20:23:57 +01:00
|
|
|
local gcc="$1"
|
2013-07-25 23:52:11 +02:00
|
|
|
|
2010-04-20 21:01:53 +02:00
|
|
|
if which greadlink > /dev/null 2>&1; then
|
2010-04-20 05:16:36 +02:00
|
|
|
readlink="greadlink -e"
|
2010-04-20 21:01:53 +02:00
|
|
|
elif which realpath > /dev/null 2>&1; then
|
2010-04-20 05:16:36 +02:00
|
|
|
readlink=realpath
|
2010-08-30 18:17:36 +02:00
|
|
|
elif readlink -e / > /dev/null 2>&1; then
|
2010-04-20 05:16:36 +02:00
|
|
|
readlink="readlink -e"
|
2010-08-30 18:17:36 +02:00
|
|
|
else
|
|
|
|
readlink=real_path
|
2010-04-20 04:36:56 +02:00
|
|
|
fi
|
2010-04-20 21:01:53 +02:00
|
|
|
|
2003-05-06 00:07:33 +02:00
|
|
|
# PLATFORM_LINKLIBS
|
2013-07-25 23:52:11 +02:00
|
|
|
local gcclib=`$gcc -print-libgcc-file-name`
|
|
|
|
local gccdir=`dirname ${gcclib}`
|
2006-09-03 19:22:48 +02:00
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
local gccRawVersion=`$gcc -dumpversion`
|
|
|
|
local gccMachine=`$gcc -dumpmachine`
|
2007-08-23 00:07:03 +02:00
|
|
|
|
2013-07-20 01:01:21 +02:00
|
|
|
# determine architecture from machine triple
|
2013-07-25 23:52:11 +02:00
|
|
|
case $gccMachine in
|
|
|
|
arm-*) targetCpu=arm;;
|
2019-08-30 20:10:12 +02:00
|
|
|
aarch64-*) targetCpu=arm64;;
|
2013-07-25 23:52:11 +02:00
|
|
|
i?86-*) targetCpu=x86;;
|
|
|
|
m68k-*) targetCpu=m68k;;
|
|
|
|
powerpc-*) targetCpu=ppc;;
|
2018-11-04 20:37:09 +01:00
|
|
|
riscv64-*) targetCpu=riscv64;;
|
2019-02-17 13:42:25 +01:00
|
|
|
sparc64-*) targetCpu=sparc;;
|
2013-07-25 23:52:11 +02:00
|
|
|
x86_64-*) targetCpu=x86_64;;
|
2013-07-20 01:01:21 +02:00
|
|
|
*)
|
2013-07-25 23:52:11 +02:00
|
|
|
echo "Unsupported gcc target machine: $gccMachine" >&2
|
2013-07-20 01:01:21 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
local targetArch=$targetCpu
|
2013-07-20 01:01:21 +02:00
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
case $gccRawVersion in
|
2006-11-16 20:52:27 +01:00
|
|
|
2.9*)
|
2006-09-03 19:22:48 +02:00
|
|
|
# check for correct (most up-to-date) legacy compiler and complain
|
|
|
|
# if an older one is installed
|
2013-07-25 23:52:11 +02:00
|
|
|
if [ $gccRawVersion != $haikuRequiredLegacyGCCVersion ]; then
|
2006-09-03 19:22:48 +02:00
|
|
|
echo "GCC version $haikuRequiredLegacyGCCVersion is required!";
|
|
|
|
echo "Please download it from www.haiku-os.org...";
|
|
|
|
exit 1;
|
|
|
|
fi
|
2012-08-16 18:38:01 +02:00
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
targetArch=x86_gcc2
|
2013-07-20 01:01:21 +02:00
|
|
|
;;
|
2005-11-12 23:58:54 +01:00
|
|
|
esac
|
2012-05-26 22:47:27 +02:00
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
local bootLibgcc
|
|
|
|
local bootLibSupCxx
|
2014-01-15 22:41:27 +01:00
|
|
|
local bootCxxHeaders
|
2022-03-23 13:08:47 +01:00
|
|
|
local boot32Libgcc
|
|
|
|
local boot32LibSupCxx
|
|
|
|
local boot32CxxHeaders
|
2013-07-25 23:52:11 +02:00
|
|
|
case $gccMachine in
|
2012-08-18 20:48:55 +02:00
|
|
|
x86_64-*)
|
2014-01-15 22:41:27 +01:00
|
|
|
# Boot loader is 32-bit, need the 32-bit libs and c++ config
|
2022-03-23 13:08:47 +01:00
|
|
|
boot32Libgcc=`$gcc -m32 -print-file-name=libgcc.a`
|
|
|
|
boot32LibSupCxx=`$gcc -m32 -print-file-name=libsupc++.a`
|
|
|
|
bootLibgcc=`$gcc -print-file-name=libgcc.a`
|
|
|
|
bootLibSupCxx=`$gcc -print-file-name=libsupc++.a`
|
2014-01-15 22:41:27 +01:00
|
|
|
|
|
|
|
local headersBase=$gccdir/../../../..
|
|
|
|
local headers=$headersBase/$gccMachine/include/c++/$gccRawVersion
|
|
|
|
if [ ! -d $headers ]; then
|
|
|
|
headers=$headersBase/include/c++/$gccRawVersion
|
|
|
|
fi
|
2022-03-23 13:08:47 +01:00
|
|
|
boot32CxxHeaders="$headers/$gccMachine/32"
|
|
|
|
bootCxxHeaders="$headers/$gccMachine"
|
2013-07-20 01:01:21 +02:00
|
|
|
;;
|
2005-11-12 23:58:54 +01:00
|
|
|
esac
|
2013-07-25 23:52:11 +02: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"
|
2020-10-07 05:46:18 +02:00
|
|
|
set_variable HAIKU_CC_IS_LEGACY_GCC_$targetArch \
|
|
|
|
`is_legacy_gcc $gccRawVersion`
|
2015-11-08 15:58:56 +01:00
|
|
|
set_variable HAIKU_CC_IS_CLANG_$targetArch $useClang
|
2013-07-25 23:52:11 +02:00
|
|
|
set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine
|
|
|
|
set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir
|
2014-08-01 14:53:45 +02:00
|
|
|
set_variable HAIKU_BOOT_CXX_HEADERS_DIR_$targetArch "$bootCxxHeaders"
|
2013-07-25 23:52:11 +02:00
|
|
|
set_variable HAIKU_BOOT_LIBSUPCXX_$targetArch "$bootLibSupCxx"
|
|
|
|
set_variable HAIKU_BOOT_LIBGCC_$targetArch $bootLibgcc
|
2022-03-23 13:08:47 +01:00
|
|
|
set_variable HAIKU_BOOT_32_CXX_HEADERS_DIR_$targetArch "$boot32CxxHeaders"
|
|
|
|
set_variable HAIKU_BOOT_32_LIBSUPCXX_$targetArch "$boot32LibSupCxx"
|
|
|
|
set_variable HAIKU_BOOT_32_LIBGCC_$targetArch $boot32Libgcc
|
2013-07-25 23:52:11 +02:00
|
|
|
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 18:27:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# set_default_value
|
|
|
|
#
|
|
|
|
# Set the value for a variable, if no value is set yet.
|
|
|
|
#
|
|
|
|
set_default_value()
|
|
|
|
{
|
2006-01-11 09:36:21 +01:00
|
|
|
eval "$1=\${$1-$2}"
|
2005-10-29 18:27:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# get_build_tool_path
|
|
|
|
#
|
|
|
|
# Gets a usable absolute path of a build tool.
|
|
|
|
#
|
|
|
|
get_build_tool_path()
|
|
|
|
{
|
|
|
|
local var="HAIKU_$1"
|
2017-12-01 20:23:57 +01:00
|
|
|
local varval="`get_variable $var`"
|
|
|
|
local cmd="$2"
|
2017-11-23 17:29:15 +01:00
|
|
|
|
2017-11-23 20:21:38 +01:00
|
|
|
if [ ! -z "$varval" ]; then
|
2017-11-23 17:29:15 +01:00
|
|
|
# this variable is already set (probably by user) so grab its contents
|
2017-11-23 20:21:38 +01:00
|
|
|
cmd=$varval
|
2017-11-23 17:29:15 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
local path=${cmd%% *}
|
2007-08-23 00:07:03 +02:00
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
if [ -f "$path" ]; then
|
2017-12-01 20:23:57 +01:00
|
|
|
# get absolute path from relative path
|
2008-04-12 04:40:10 +02:00
|
|
|
local oldPwd="`pwd`"
|
|
|
|
cd "`dirname "$path"`"
|
|
|
|
path="`pwd`/`basename "$path"`"
|
2005-10-29 18:27:43 +02:00
|
|
|
cd $oldPwd
|
|
|
|
else
|
2010-04-20 04:18:54 +02:00
|
|
|
which "$path" > /dev/null 2>&1 || {
|
2017-11-23 17:29:15 +01:00
|
|
|
echo "Build tool \"$path\" not found (maybe specify it in $var?)" >&2
|
2005-10-29 18:27:43 +02:00
|
|
|
exit 1
|
|
|
|
}
|
2004-07-05 20:35:35 +02:00
|
|
|
fi
|
2007-08-23 00:07:03 +02:00
|
|
|
|
2017-12-01 20:23:57 +01:00
|
|
|
if test "${cmd#* }" != "$cmd"; then
|
|
|
|
# $cmd contains arguments, so preserve them (and only them)
|
|
|
|
cmd=${cmd#* }
|
|
|
|
else
|
|
|
|
# $cmd does not contain arguments, so unset it
|
|
|
|
cmd=
|
|
|
|
fi
|
|
|
|
eval "$var=\"$path $cmd\""
|
2003-05-06 00:07:33 +02:00
|
|
|
}
|
|
|
|
|
2017-12-05 22:18:57 +01:00
|
|
|
# check_native_xattrs
|
|
|
|
#
|
|
|
|
# Checks the host platform's support for extended attributes.
|
|
|
|
# 0: no support, 1: only enough for xattr-ref, 2: full support
|
|
|
|
#
|
|
|
|
check_native_xattrs()
|
|
|
|
{
|
|
|
|
local xattr_set=
|
|
|
|
local xattr_set_args=
|
|
|
|
local xattr_get=
|
|
|
|
local xattr_get_args=
|
|
|
|
case $HOST_PLATFORM in
|
2017-12-15 01:36:14 +01:00
|
|
|
haiku_host)
|
|
|
|
xattr_set="addattr"; xattr_set_args="\$NAME \"\$VALUE\""
|
|
|
|
xattr_get="catattr"; xattr_get_args="\$NAME"
|
|
|
|
;;
|
2017-12-05 22:18:57 +01:00
|
|
|
darwin)
|
|
|
|
xattr_set="xattr"; xattr_set_args="-w \$NAME \"\$VALUE\""
|
|
|
|
xattr_get="xattr"; xattr_get_args="-p \$NAME"
|
|
|
|
;;
|
|
|
|
freebsd)
|
|
|
|
xattr_set="setextattr"; xattr_set_args="user \$NAME \"\$VALUE\""
|
|
|
|
xattr_get="getextattr"; xattr_get_args="user \$NAME"
|
|
|
|
;;
|
2021-10-22 23:03:16 +02:00
|
|
|
linux)
|
2017-12-05 22:18:57 +01:00
|
|
|
xattr_set="setfattr"; xattr_set_args="-n user.\$NAME -v \"\$VALUE\""
|
|
|
|
xattr_get="getfattr"; xattr_get_args="-n user.\$NAME"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if ! type $xattr_set >/dev/null 2>&1; then
|
|
|
|
echo "$0: could not find $xattr_set, assuming host has no extended attributes"
|
|
|
|
return 0
|
|
|
|
elif ! type $xattr_get >/dev/null 2>&1; then
|
|
|
|
echo "$0: could not find $xattr_get, assuming host has no extended attributes"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2018-04-15 02:30:05 +02:00
|
|
|
mkdir -p "$outputDir"
|
2017-12-05 22:18:57 +01:00
|
|
|
echo "xattr test file" >"$outputDir/xattrtest"
|
|
|
|
local i=0
|
|
|
|
# on round 0, we test if we can set 3 attrs of 1K each (enough for xattr-ref)
|
|
|
|
# on round 1, we test if we can set 3 attrs of 45K each (enough for full xattr)
|
|
|
|
while [ $i -lt 2 ]; do
|
|
|
|
local j=0
|
|
|
|
while [ $j -lt 3 ]; do
|
|
|
|
NAME=attr$j
|
|
|
|
VALUE=`printf '%*s' $((1024 + $i * 45056)) "" | tr ' ' x`
|
|
|
|
if [ `echo -n $VALUE | wc -c` -lt $((1024 + $i * 45056)) ]; then
|
|
|
|
echo "$0: warning: could not generate test data for extended attributes"
|
|
|
|
rm "$outputDir/xattrtest"
|
|
|
|
return $i
|
|
|
|
elif ! $xattr_set `eval echo \"$xattr_set_args\"` \
|
|
|
|
"$outputDir/xattrtest" >/dev/null 2>&1 ; then
|
|
|
|
rm "$outputDir/xattrtest"
|
|
|
|
return $i
|
|
|
|
fi
|
|
|
|
j=$((j+1))
|
|
|
|
done
|
|
|
|
i=$((i+1))
|
|
|
|
done
|
|
|
|
rm "$outputDir/xattrtest"
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
|
2013-08-12 17:18:02 +02:00
|
|
|
is_in_list()
|
|
|
|
{
|
|
|
|
local element
|
|
|
|
for element in $2; do
|
|
|
|
if [ "$1" = "$element" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2014-08-30 21:39:53 +02:00
|
|
|
# check for --help or -h and show usage immediately
|
|
|
|
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
2014-07-26 11:39:30 +02:00
|
|
|
usage; exit 0;
|
|
|
|
fi
|
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
# get cwd and the source directory
|
|
|
|
currentDir=`pwd`
|
2006-08-03 19:57:34 +02:00
|
|
|
cd `dirname "$0"`
|
2005-10-29 18:27:43 +02:00
|
|
|
sourceDir=`pwd`
|
2006-08-03 19:57:34 +02:00
|
|
|
cd "$currentDir"
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2018-08-02 01:23:18 +02: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
|
|
|
|
# get last configure invocation and flags from BuildConfig and call ourselves with it
|
|
|
|
lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-`
|
|
|
|
lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-`
|
|
|
|
lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-`
|
|
|
|
lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-`
|
|
|
|
if [ -z "$lastConfig" ]; then
|
|
|
|
echo "$0 --update: The previous configure invocation was not properly" \
|
|
|
|
"encoded into '$buildConfigFile' - updating not possible."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-01-10 00:52:02 +01:00
|
|
|
cd "$lastPwd"
|
2018-08-02 01:23:18 +02:00
|
|
|
if [ -n "$lastEnv" ]; then
|
|
|
|
export $lastEnv
|
|
|
|
fi
|
|
|
|
$lastConfig $lastArgs
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2010-01-03 04:05:12 +01:00
|
|
|
# backup the passed arguments
|
|
|
|
configureArgs="$@"
|
2017-12-05 02:14:18 +01:00
|
|
|
configurePath=$0
|
2023-10-29 07:35:02 +01:00
|
|
|
configureDir=`dirname $configurePath`
|
2017-12-05 02:14:18 +01:00
|
|
|
|
|
|
|
# backup relevant environs
|
|
|
|
configureEnvirons=
|
|
|
|
for var in `env`; do
|
|
|
|
case "$var" in
|
2020-05-30 05:10:28 +02:00
|
|
|
CC\=*|HAIKU*\=*|JAMSHELL\=*)
|
2017-12-05 02:14:18 +01:00
|
|
|
configureEnvirons="$configureEnvirons $var"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2010-01-03 04:05:12 +01:00
|
|
|
|
2018-08-02 01:23:18 +02:00
|
|
|
# ensure umask is not too restrictive
|
2018-10-21 01:03:14 +02:00
|
|
|
if [ `umask` -gt 22 ]; then
|
|
|
|
echo Your umask is too restrictive "(should be <= 0022;" is actually `umask`")"
|
|
|
|
echo
|
|
|
|
echo Additionally, if the source tree was cloned with a too-restrictive umask,
|
|
|
|
echo you will need to run \"git checkout\" again to fix this.
|
2018-08-02 01:23:18 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-01-04 20:36:58 +01:00
|
|
|
# internal default parameter values
|
2002-07-15 00:09:44 +02:00
|
|
|
#
|
2002-07-09 14:24:59 +02:00
|
|
|
platform=`uname`
|
2009-02-24 15:20:24 +01:00
|
|
|
platformMachine=`uname -m`
|
2013-07-25 23:52:11 +02:00
|
|
|
targetArchs=
|
2005-10-29 18:27:43 +02:00
|
|
|
buildCrossTools=
|
2005-11-18 15:17:04 +01:00
|
|
|
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
2009-11-23 20:34:55 +01:00
|
|
|
buildCrossToolsJobs=
|
2014-04-03 18:26:29 +02:00
|
|
|
useClang=0
|
2013-07-25 23:52:11 +02:00
|
|
|
useGccGraphiteDefault=0
|
|
|
|
unknownArchIndex=1
|
2013-08-12 17:18:02 +02:00
|
|
|
haikuTargetArchs=
|
2016-10-20 02:35:23 +02:00
|
|
|
gdbSources=
|
2010-01-04 20:36:58 +01:00
|
|
|
|
2014-07-26 11:21:51 +02:00
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
CC=gcc
|
|
|
|
fi
|
2024-07-25 03:33:34 +02:00
|
|
|
if [ $(is_legacy_gcc $($CC -dumpversion)) -ne 0 ]; then
|
|
|
|
echo The host tools cannot be built with a legacy version of GCC.
|
|
|
|
echo Please specify a more modern compiler in the "CC" environ.
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-07-26 11:21:51 +02:00
|
|
|
|
2019-06-28 00:53:47 +02:00
|
|
|
# detect the build platform
|
|
|
|
case "${platform}" in
|
|
|
|
Darwin) HOST_PLATFORM=darwin ;;
|
|
|
|
FreeBSD) HOST_PLATFORM=freebsd
|
|
|
|
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 ;;
|
|
|
|
*) echo Unsupported platform: ${platform}
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $HOST_PLATFORM in
|
|
|
|
darwin|freebsd|openbsd) statCmd='stat -f' ;;
|
|
|
|
*) statCmd='stat -c' ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# ensure git checkout was not done with a restrictive umask
|
|
|
|
if [ `$statCmd '%a' "$sourceDir/data/system/boot/SetupEnvironment"` -lt 644 ]; then
|
|
|
|
echo "The source tree was cloned with a umask > 0022. It seems you"
|
|
|
|
echo have already corrected your umask, but not re-checked-out the
|
|
|
|
echo source tree. Try running:
|
|
|
|
echo " git checkout --force"
|
|
|
|
echo to fix this problem.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-01-04 20:36:58 +01:00
|
|
|
# exported (BuildSetup) default parameter values
|
|
|
|
#
|
2023-10-29 07:35:02 +01:00
|
|
|
GIT_DIR=`git -C "$configureDir" rev-parse --git-dir | sed 's/^gitdir: //'`
|
2014-07-26 11:21:51 +02:00
|
|
|
HOST_GCC_MACHINE=`$CC -dumpmachine`
|
2010-02-25 17:13:22 +01:00
|
|
|
HAIKU_INCLUDE_SOURCES=0
|
2010-01-04 20:36:58 +01:00
|
|
|
HAIKU_INCLUDE_3RDPARTY=0
|
|
|
|
HAIKU_DISTRO_COMPATIBILITY=default
|
|
|
|
TARGET_PLATFORM=haiku
|
|
|
|
HAIKU_USE_GCC_PIPE=0
|
2010-02-03 22:21:39 +01:00
|
|
|
HAIKU_HOST_USE_32BIT=0
|
2017-12-05 22:58:11 +01:00
|
|
|
HAIKU_HOST_USE_XATTR=
|
|
|
|
HAIKU_HOST_USE_XATTR_REF=
|
2013-07-03 23:19:00 +02:00
|
|
|
HAIKU_HOST_BUILD_ONLY=0
|
2013-09-29 21:27:47 +02:00
|
|
|
HOST_EXTENDED_REGEX_SED="sed -r"
|
2014-07-26 11:21:51 +02:00
|
|
|
HOST_GCC_LD=`$CC -print-prog-name=ld`
|
|
|
|
HOST_GCC_OBJCOPY=`$CC -print-prog-name=objcopy`
|
2013-07-06 02:17:15 +02:00
|
|
|
HOST_SHA256=
|
2013-07-21 04:10:48 +02:00
|
|
|
HOST_HAIKU_PORTER=
|
|
|
|
HAIKU_PORTS=
|
|
|
|
HAIKU_PORTS_CROSS=
|
2014-10-26 21:07:01 +01:00
|
|
|
HAIKU_IS_BOOTSTRAP=0
|
2014-04-30 23:47:55 +02:00
|
|
|
HAIKU_NO_DOWNLOADS=0
|
2013-07-06 02:17:15 +02:00
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_PACKAGING_ARCHS=
|
|
|
|
|
2014-03-28 23:07:04 +01:00
|
|
|
set_default_value HAIKU_NASM nasm
|
2013-07-25 23:52:11 +02:00
|
|
|
|
2013-07-06 12:19:46 +02:00
|
|
|
if sha256sum < /dev/null > /dev/null 2>&1; then
|
2013-07-06 02:17:15 +02:00
|
|
|
HOST_SHA256=sha256sum
|
2013-07-06 12:19:46 +02:00
|
|
|
elif sha256 < /dev/null > /dev/null 2>&1; then
|
2013-07-06 02:17:15 +02:00
|
|
|
HOST_SHA256="sha256 -q"
|
2013-09-29 10:21:06 +02:00
|
|
|
elif shasum < /dev/null > /dev/null 2>&1; then
|
|
|
|
HOST_SHA256="shasum -a 256"
|
2013-07-06 02:17:15 +02:00
|
|
|
else
|
|
|
|
echo "Error: Neither sha256sum nor sha256 seem to be available!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2017-07-20 10:01:20 +02:00
|
|
|
haikuRequiredLegacyGCCVersion="2.95.3-haiku-2017_07_20"
|
2008-04-12 04:40:10 +02:00
|
|
|
export haikuRequiredLegacyGCCVersion
|
2006-09-16 17:40:36 +02:00
|
|
|
# version of legacy gcc required to build haiku
|
2013-08-12 17:18:02 +02:00
|
|
|
supportedTargetArchs="
|
|
|
|
arm
|
2018-08-03 01:48:29 +02:00
|
|
|
arm64
|
2013-08-12 17:18:02 +02:00
|
|
|
m68k
|
|
|
|
ppc
|
2018-11-04 20:37:09 +01:00
|
|
|
riscv64
|
2019-03-25 19:43:08 +01:00
|
|
|
sparc
|
2013-08-12 17:18:02 +02:00
|
|
|
x86
|
|
|
|
x86_64
|
|
|
|
x86_gcc2
|
|
|
|
"
|
2006-09-16 17:40:36 +02:00
|
|
|
|
2002-07-15 00:09:44 +02:00
|
|
|
# parse parameters
|
|
|
|
#
|
2005-12-06 23:45:11 +01:00
|
|
|
while [ $# -gt 0 ] ; do
|
2002-07-15 00:09:44 +02:00
|
|
|
case "$1" in
|
2021-07-21 03:28:04 +02:00
|
|
|
--sysroot)
|
|
|
|
assertparam "$1" $#
|
|
|
|
crossToolsSysroot=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
2013-07-21 04:10:48 +02:00
|
|
|
--bootstrap)
|
|
|
|
assertparams "$1" 3 $#
|
|
|
|
HOST_HAIKU_PORTER="`absolute_path $2`"
|
|
|
|
HAIKU_PORTS_CROSS="`absolute_path $3`"
|
|
|
|
HAIKU_PORTS="`absolute_path $4`"
|
2014-10-26 21:07:01 +01:00
|
|
|
HAIKU_IS_BOOTSTRAP=1
|
|
|
|
HAIKU_NO_DOWNLOADS=1
|
2014-04-27 07:18:29 +02:00
|
|
|
check_file_exists "$HOST_HAIKU_PORTER" || (
|
|
|
|
echo "Invalid path to haikuporter: $HOST_HAIKU_PORTER" >&2
|
2014-04-26 17:25:25 +02: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 04:10:48 +02:00
|
|
|
shift 4
|
|
|
|
;;
|
2020-09-12 03:30:38 +02:00
|
|
|
--cross-tools-source)
|
|
|
|
assertparam "$1" $#
|
|
|
|
buildCrossTools=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
2013-07-25 23:52:11 +02:00
|
|
|
--build-cross-tools)
|
2020-09-12 03:30:38 +02:00
|
|
|
assertparam "$1" $#
|
|
|
|
targetArch=$2
|
|
|
|
shift 2
|
2013-07-25 23:52:11 +02:00
|
|
|
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;;
|
2019-08-30 20:10:12 +02:00
|
|
|
arm64) targetMachine=aarch64-unknown-haiku;;
|
2018-11-04 20:37:09 +01:00
|
|
|
riscv64) targetMachine=riscv64-unknown-haiku;;
|
2019-02-17 13:42:25 +01:00
|
|
|
sparc) targetMachine=sparc64-unknown-haiku;;
|
2013-07-25 23:52:11 +02:00
|
|
|
*)
|
2018-07-04 01:04:53 +02:00
|
|
|
echo "Unsupported target architecture: $targetArch" >&2
|
2013-07-25 23:52:11 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
2008-05-18 01:47:39 +02:00
|
|
|
esac
|
2013-07-25 23:52:11 +02:00
|
|
|
set_variable buildCrossToolsMachine_$targetArch $targetMachine
|
|
|
|
targetArchs="$targetArchs $targetArch"
|
2008-05-18 01:47:39 +02:00
|
|
|
;;
|
|
|
|
--cross-tools-prefix)
|
|
|
|
assertparam "$1" $#
|
2013-07-25 23:52:11 +02:00
|
|
|
targetArch=unknown${unknownArchIndex}
|
|
|
|
set_variable crossToolsPrefix_$targetArch "$2"
|
|
|
|
targetArchs="$targetArchs $targetArch"
|
2013-09-22 19:57:53 +02:00
|
|
|
unknownArchIndex=$(($unknownArchIndex + 1))
|
2008-05-18 01:47:39 +02:00
|
|
|
shift 2
|
|
|
|
;;
|
2007-05-20 19:50:11 +02:00
|
|
|
--distro-compatibility)
|
2008-05-18 01:47:39 +02:00
|
|
|
assertparam "$1" $#
|
2010-01-04 20:36:58 +01:00
|
|
|
HAIKU_DISTRO_COMPATIBILITY=$2
|
|
|
|
case "$HAIKU_DISTRO_COMPATIBILITY" in
|
2008-05-18 01:47:39 +02:00
|
|
|
official) ;;
|
|
|
|
compatible) ;;
|
|
|
|
default) ;;
|
|
|
|
*) echo "Invalid distro compatibility" \
|
2010-01-04 20:36:58 +01:00
|
|
|
"level: $HAIKU_DISTRO_COMPATIBILITY"
|
2008-05-18 01:47:39 +02:00
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
shift 2
|
|
|
|
;;
|
2013-07-03 23:19:00 +02:00
|
|
|
--host-only) HAIKU_HOST_BUILD_ONLY=1; shift 1;;
|
2010-02-25 17:13:22 +01:00
|
|
|
--include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;;
|
2010-01-04 20:36:58 +01:00
|
|
|
--include-3rdparty) HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
|
2009-11-23 20:34:55 +01:00
|
|
|
-j*) buildCrossToolsJobs="$1"; shift 1;;
|
2014-04-30 23:47:55 +02:00
|
|
|
--no-downloads) HAIKU_NO_DOWNLOADS=1; shift 1;;
|
2013-08-12 17:18:02 +02: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"
|
|
|
|
;;
|
2017-11-23 17:29:15 +01:00
|
|
|
--use-clang)
|
|
|
|
assertparam "$1" $#
|
|
|
|
targetArch=$2
|
|
|
|
useClang=1
|
|
|
|
case "$targetArch" in
|
|
|
|
x86) targetMachine=i586-pc-haiku;;
|
|
|
|
x86_64) targetMachine=x86_64-unknown-haiku;;
|
2018-08-02 02:11:10 +02:00
|
|
|
ppc) targetMachine=powerpc-apple-haiku;;
|
2018-08-02 01:31:01 +02:00
|
|
|
arm) targetMachine=arm-unknown-haiku;;
|
2019-08-30 20:10:12 +02:00
|
|
|
arm64) targetMachine=aarch64-unknown-haiku;;
|
2018-11-04 20:37:09 +01:00
|
|
|
riscv64) targetMachine=riscv64-unknown-haiku;;
|
2019-02-17 13:42:25 +01:00
|
|
|
sparc) targetMachine=sparc64-unknown-haiku;;
|
2017-11-23 17:29:15 +01:00
|
|
|
*)
|
|
|
|
echo "Unsupported target architecture: $2" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2017-12-01 20:23:57 +01:00
|
|
|
get_build_tool_path clang clang
|
2017-12-13 02:07:38 +01:00
|
|
|
if [ -z `get_variable "crossToolsPrefix_$targetArch"` ] \
|
|
|
|
&& [ -z `get_variable buildCrossToolsMachine_$targetArch` ]; then
|
2017-12-01 20:23:57 +01:00
|
|
|
set_variable crossToolsPrefix_$targetArch llvm-
|
|
|
|
fi
|
2018-08-13 18:33:14 +02:00
|
|
|
clangVersion=`$HAIKU_clang -v 2>&1 | head -1 | cut -d " " -f3`
|
2020-07-08 21:38:47 +02:00
|
|
|
if [ `echo $clangVersion | cut -d'.' -f1` -lt 7 ]; then
|
2018-08-13 18:33:14 +02:00
|
|
|
echo "Haiku requires Clang 7 or better to build, but you have $clangVersion."
|
|
|
|
echo "Please install a newer version."
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-06-19 00:53:47 +02:00
|
|
|
targetArchs="$targetArchs $targetArch"
|
2017-11-23 17:29:15 +01:00
|
|
|
shift 2
|
|
|
|
;;
|
2010-01-04 20:36:58 +01:00
|
|
|
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
|
2013-07-25 23:52:11 +02:00
|
|
|
--use-gcc-graphite) useGccGraphiteDefault=1; shift 1;;
|
2010-02-03 22:21:39 +01:00
|
|
|
--use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;;
|
2017-12-05 22:58:11 +01:00
|
|
|
--no-full-xattr)HAIKU_HOST_USE_XATTR=0; shift 1;;
|
|
|
|
--no-xattr) HAIKU_HOST_USE_XATTR_REF=0; shift 1;;
|
2016-10-20 02:35:23 +02:00
|
|
|
--with-gdb) gdbSources=$2; shift 2;;
|
2021-05-01 15:24:28 +02:00
|
|
|
--use-stack-protector) HAIKU_USE_STACK_PROTECTOR=1; shift 1;;
|
2022-02-06 23:24:02 +01:00
|
|
|
--efi-signing-key)
|
|
|
|
assertparam "$1" $#
|
|
|
|
HAIKU_EFI_SIGNING_KEY="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
2024-09-13 05:57:15 +02:00
|
|
|
--with-python) pythonPath=$2; shift 2;;
|
2002-07-15 00:09:44 +02:00
|
|
|
*) echo Invalid argument: \`$1\'; exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2012-07-10 20:33:39 +02:00
|
|
|
# check for case-sensitive filesystem
|
|
|
|
mkdir haikuCaseTest 2>/dev/null
|
|
|
|
mkdir haikucasetest 2>/dev/null
|
|
|
|
caseInsensitive=$?
|
2012-07-11 18:41:52 +02:00
|
|
|
rmdir haikuCaseTest haikucasetest 2>/dev/null
|
2012-07-10 20:33:39 +02:00
|
|
|
if [ $caseInsensitive != 0 ]; then
|
|
|
|
echo "You need a case-sensitive file-system to build Haiku."
|
|
|
|
if [ $HOST_PLATFORM = "darwin" ]; then
|
2015-11-03 00:55:41 +01:00
|
|
|
echo "You can create a case-sensitive disk image using Disk Utility."
|
2009-05-30 02:38:43 +02:00
|
|
|
fi
|
2012-07-10 20:33:39 +02:00
|
|
|
exit 1
|
2009-05-30 02:38:43 +02:00
|
|
|
fi
|
|
|
|
|
2017-12-05 22:18:57 +01:00
|
|
|
# check xattr support
|
2017-12-15 01:36:14 +01:00
|
|
|
if [ -z $HAIKU_HOST_USE_XATTR_REF ]; then
|
2017-12-05 22:18:57 +01:00
|
|
|
check_native_xattrs
|
|
|
|
attrSupport=$?
|
2017-12-05 22:58:11 +01:00
|
|
|
if [ $attrSupport = 2 ] && [ -z $HAIKU_HOST_USE_XATTR ]; then
|
|
|
|
HAIKU_HOST_USE_XATTR=1
|
2017-12-05 22:18:57 +01:00
|
|
|
elif [ $attrSupport = 1 ]; then
|
2017-12-05 22:58:11 +01:00
|
|
|
HAIKU_HOST_USE_XATTR_REF=1
|
2017-12-05 22:18:57 +01:00
|
|
|
fi
|
|
|
|
fi
|
2017-12-05 22:58:11 +01:00
|
|
|
if [ -z $HAIKU_HOST_USE_XATTR ]; then HAIKU_HOST_USE_XATTR=0; fi
|
|
|
|
if [ -z $HAIKU_HOST_USE_XATTR_REF ]; then HAIKU_HOST_USE_XATTR_REF=0; fi
|
2017-12-05 22:18:57 +01:00
|
|
|
|
2013-09-29 21:27:47 +02: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
|
|
|
|
|
2020-05-30 05:10:28 +02:00
|
|
|
# pick a JAMSHELL
|
|
|
|
if [ "$JAMSHELL" = "" ]; then
|
|
|
|
if check_file_exists /bin/dash; then
|
|
|
|
JAMSHELL=/bin/dash
|
|
|
|
else
|
|
|
|
JAMSHELL=/bin/sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if ! $JAMSHELL -c true; then
|
|
|
|
echo "$JAMSHELL does not work! Please specify a working JAMSHELL."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-03-03 22:50:29 +01:00
|
|
|
# locate python
|
2024-09-13 05:57:15 +02:00
|
|
|
if [ -n "$pythonPath" ] && "$pythonPath" --version < /dev/null > /dev/null 2>&1; then
|
|
|
|
HOST_PYTHON="$pythonPath"
|
|
|
|
elif python3 --version < /dev/null > /dev/null 2>&1; then
|
2019-03-02 20:23:12 +01:00
|
|
|
HOST_PYTHON="python3"
|
2019-03-03 22:50:29 +01:00
|
|
|
elif python --version < /dev/null > /dev/null 2>&1; then
|
2019-03-02 20:23:12 +01:00
|
|
|
HOST_PYTHON="python"
|
|
|
|
else
|
|
|
|
echo "a python interpreter is required"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-09-12 14:21:22 +02:00
|
|
|
# check is python is new enough
|
|
|
|
# usage of python by HDS requires at least 3.9
|
|
|
|
PYTHON_VERSION=$("$HOST_PYTHON" --version | sed -e 's/Python //')
|
|
|
|
|
|
|
|
case $PYTHON_VERSION in
|
|
|
|
2.* | 3.[1-8].*)
|
|
|
|
echo "Python $PYTHON_VERSION is too old, need at least Python 3.9"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2014-08-06 01:05:50 +02: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 12:05:32 +02:00
|
|
|
if [ "$("$HAIKU_NASM" -hf | grep -c elf'[36][24] ')" -ne "2" ]; then
|
2014-08-06 01:05:50 +02: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 18:27:43 +02:00
|
|
|
# create output directory
|
2006-08-03 19:57:34 +02:00
|
|
|
mkdir -p "$buildOutputDir" || exit 1
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2013-07-03 23:19:00 +02: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 01:03:51 +01:00
|
|
|
HAIKU_NASM=$invalidCommand
|
2013-07-03 23:19:00 +02:00
|
|
|
HAIKU_STRIP=$invalidCommand
|
|
|
|
else
|
2013-08-12 17:18:02 +02:00
|
|
|
# On Haiku determine target architectures and tools automatically.
|
2013-07-25 23:52:11 +02:00
|
|
|
if [ -z "$targetArchs" ]; then
|
2013-08-12 17:18:02 +02:00
|
|
|
if [ $HOST_PLATFORM != haiku_host ]; then
|
|
|
|
echo "Please specify the build tools to use or build (via" \
|
2013-10-20 17:13:59 +02:00
|
|
|
"--cross-tools-prefix or --build-cross-tools) or specify a" \
|
2013-08-12 17:18:02 +02:00
|
|
|
"host-only build (--host-only)." >&2
|
2014-08-30 21:39:53 +02:00
|
|
|
echo "For more info, invoke $0 --help"
|
2013-08-12 17:18:02 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# determine primary architecture
|
2013-10-12 20:53:52 +02:00
|
|
|
targetArch=`package list -i /system/packages/haiku-*.hpkg \
|
2013-08-12 17:18:02 +02:00
|
|
|
| sed '/^\s*architecture:/!d; s,^\s*architecture:\s*,,'`
|
|
|
|
is_in_list "$targetArch" "$supportedTargetArchs" || (
|
|
|
|
echo "Unsupported target architecture: \"$targetArch\"" >&2
|
|
|
|
exit 1
|
|
|
|
)
|
2013-07-25 23:52:11 +02:00
|
|
|
targetArchs=$targetArch
|
2013-08-12 17:18:02 +02:00
|
|
|
|
2013-07-25 23:52:11 +02: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 17:18:02 +02:00
|
|
|
|
|
|
|
# determine secondary architectures
|
|
|
|
for targetArch in $supportedTargetArchs; do
|
2013-10-20 19:44:01 +02:00
|
|
|
if [ -e /system/packages/haiku_$targetArch-*.hpkg ]; then
|
2013-08-12 17:18:02 +02: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-03 23:19:00 +02:00
|
|
|
fi
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2020-02-08 19:25:23 +01:00
|
|
|
if [ "$targetArchs" = " x86_gcc2" ]; then
|
|
|
|
echo "Building a GCC2-only Haiku is no longer supported."
|
|
|
|
echo "Please configure the secondary architecture."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-08-04 17:20:56 +02:00
|
|
|
isPrimaryArch=1
|
2013-07-25 23:52:11 +02:00
|
|
|
for targetArch in $targetArchs; do
|
2018-06-19 00:53:47 +02:00
|
|
|
# Note: targetArch is "unknown<n>" at this point if a cross-tools
|
2013-07-25 23:52:11 +02:00
|
|
|
# prefix was specified. The standard_gcc_settings call below will get
|
|
|
|
# the actual architecture.
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2024-08-24 07:42:55 +02:00
|
|
|
for existingArch in $HAIKU_PACKAGING_ARCHS; do
|
|
|
|
if [ $existingArch = $targetArch ]; then
|
|
|
|
# somehow we wound up with a duplicate arch; skip this one
|
|
|
|
targetArch=
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$targetArch" ]; then
|
2018-06-19 00:53:47 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2013-07-25 23:52:11 +02: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 20:05:13 +01:00
|
|
|
scriptArgs=
|
2013-07-25 23:52:11 +02:00
|
|
|
if [ $targetArch != x86_gcc2 ]; then
|
2013-11-23 20:05:13 +01:00
|
|
|
script="${script}_gcc4"
|
|
|
|
scriptArgs="$targetMachine"
|
2014-01-28 17:50:01 +01:00
|
|
|
set_default_value HAIKU_USE_GCC_GRAPHITE_$targetArch \
|
|
|
|
$useGccGraphiteDefault
|
2013-07-25 23:52:11 +02:00
|
|
|
fi
|
2013-08-04 17:20:56 +02:00
|
|
|
secondaryArch=
|
|
|
|
if [ -z "$isPrimaryArch" ]; then
|
|
|
|
secondaryArch=$targetArch
|
|
|
|
fi
|
2013-08-22 12:31:48 +02:00
|
|
|
|
|
|
|
case $HOST_PLATFORM in
|
|
|
|
freebsd|openbsd) MAKE=gmake;;
|
|
|
|
*) MAKE=make;;
|
|
|
|
esac
|
|
|
|
|
2018-05-23 02:43:11 +02:00
|
|
|
if ! valid_toolchain "${targetMachine}" "${crossToolsDir}" "${buildCrossTools}"; then
|
2017-12-05 02:14:18 +01:00
|
|
|
MAKE=$MAKE \
|
|
|
|
SECONDARY_ARCH=$secondaryArch \
|
|
|
|
HAIKU_USE_GCC_GRAPHITE=`get_variable \
|
|
|
|
HAIKU_USE_GCC_GRAPHITE_$targetArch` \
|
|
|
|
HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
|
|
|
|
HAIKU_USE_GDB="$gdbSources" \
|
2021-07-21 03:28:04 +02:00
|
|
|
HAIKU_USE_SYSROOT="$crossToolsSysroot" \
|
2017-12-05 02:14:18 +01:00
|
|
|
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
|
|
|
|
"$crossToolsDir" $buildCrossToolsJobs || exit 1
|
|
|
|
else
|
|
|
|
echo "$targetArch crosstools already exist in $crossToolsDir; skipping build"
|
|
|
|
fi
|
2013-07-25 23:52:11 +02:00
|
|
|
crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prepare gcc settings and get the actual target architecture
|
2015-11-08 15:58:56 +01:00
|
|
|
if [ $useClang = 1 ]; then
|
2018-08-02 01:09:22 +02:00
|
|
|
gcc="$HAIKU_clang -target ${targetMachine}"
|
2018-06-18 23:45:47 +02:00
|
|
|
if [ ! -z "${crossToolsPrefix}" ]; then
|
|
|
|
gcc="$gcc -B ${crossToolsPrefix}"
|
|
|
|
fi
|
2017-12-02 03:16:13 +01:00
|
|
|
|
|
|
|
# Clang's compiler intrinsics are not compatible with GCC's or even
|
|
|
|
# across versions of Clang, so we must collect them for use in the build.
|
|
|
|
mkdir -p "$outputDir/clang_headers" || exit 1
|
2018-08-13 21:58:01 +02:00
|
|
|
clangHeadersDir=`$gcc -print-resource-dir`/include/
|
|
|
|
case $targetArch in
|
|
|
|
x86*) cp $clangHeadersDir/*intrin* $clangHeadersDir/mm3* "$outputDir/clang_headers" || exit 1 ;;
|
|
|
|
ppc*) cp $clangHeadersDir/*altivec* "$outputDir/clang_headers" || exit 1 ;;
|
|
|
|
arm*) cp $clangHeadersDir/*arm* "$outputDir/clang_headers" || exit 1 ;;
|
|
|
|
esac
|
2017-11-23 17:29:15 +01:00
|
|
|
elif [ -z "${crossToolsPrefix}" ]; then
|
|
|
|
gcc=`get_variable HAIKU_CC_$targetArch`
|
2015-11-08 15:58:56 +01:00
|
|
|
else
|
|
|
|
gcc="${crossToolsPrefix}gcc"
|
|
|
|
fi
|
2024-09-12 14:20:46 +02:00
|
|
|
|
|
|
|
if [ -z "$gcc" ]; then
|
|
|
|
echo "Please specify the build tools to use or build (via" \
|
|
|
|
"--cross-tools-prefix or --build-cross-tools)." >&2
|
|
|
|
echo "For more info, invoke $0 --help"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-07-25 23:52:11 +02:00
|
|
|
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 ""
|
2018-08-15 20:19:30 +02:00
|
|
|
set_default_value HAIKU_LINKFLAGS_$targetArch ""
|
2013-07-25 23:52:11 +02:00
|
|
|
set_default_value HAIKU_LDFLAGS_$targetArch ""
|
2018-11-22 03:16:40 +01:00
|
|
|
set_default_value HAIKU_ARFLAGS_$targetArch cru
|
2013-07-25 23:52:11 +02:00
|
|
|
set_default_value HAIKU_UNARFLAGS_$targetArch x
|
|
|
|
|
|
|
|
# Override the cross tools variables, if the tools were built or a
|
|
|
|
# prefix was specified.
|
2018-08-02 01:17:53 +02:00
|
|
|
if [ -n "$crossToolsPrefix" ]; then
|
|
|
|
get_build_tool_path AR_$targetArch ${crossToolsPrefix}ar
|
|
|
|
get_build_tool_path OBJCOPY_$targetArch ${crossToolsPrefix}objcopy
|
|
|
|
get_build_tool_path RANLIB_$targetArch ${crossToolsPrefix}ranlib
|
|
|
|
get_build_tool_path STRIP_$targetArch ${crossToolsPrefix}strip
|
2024-08-24 07:44:09 +02:00
|
|
|
|
|
|
|
get_build_tool_path LD_$targetArch ${crossToolsPrefix}ld
|
|
|
|
if [ `get_variable HAIKU_CC_IS_LEGACY_GCC_$targetArch` -eq 0 ]; then
|
|
|
|
get_build_tool_path ELFEDIT_$targetArch ${crossToolsPrefix}elfedit
|
|
|
|
fi
|
2018-08-02 01:17:53 +02:00
|
|
|
fi
|
2013-07-25 23:52:11 +02:00
|
|
|
|
|
|
|
# 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-03 23:19:00 +02:00
|
|
|
esac
|
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_PACKAGING_ARCHS="$HAIKU_PACKAGING_ARCHS $targetArch"
|
2013-08-04 17:20:56 +02:00
|
|
|
isPrimaryArch=
|
2013-07-25 23:52:11 +02:00
|
|
|
done
|
2005-10-29 18:27:43 +02:00
|
|
|
fi
|
|
|
|
|
2002-07-09 14:24:59 +02:00
|
|
|
# Generate BuildConfig
|
2010-01-04 20:36:58 +01:00
|
|
|
cat << EOF > "$buildConfigFile"
|
2017-12-05 02:14:18 +01:00
|
|
|
# -- WARNING --
|
|
|
|
# This file was AUTOMATICALLY GENERATED by configure, and will be completely
|
|
|
|
# overwritten the next time configure is run.
|
|
|
|
#
|
|
|
|
#d ${currentDir}
|
|
|
|
#c ${configurePath}
|
|
|
|
#e ${configureEnvirons}
|
|
|
|
#a ${configureArgs}
|
2002-07-09 14:24:59 +02:00
|
|
|
|
2023-10-29 07:35:02 +01:00
|
|
|
GIT_DIR ?= "${GIT_DIR}" ;
|
|
|
|
|
2010-01-04 20:36:58 +01:00
|
|
|
HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
|
2018-08-15 20:40:03 +02:00
|
|
|
TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ;
|
2012-05-26 22:47:27 +02:00
|
|
|
|
2014-04-30 23:47:55 +02:00
|
|
|
HAIKU_NO_DOWNLOADS ?= "${HAIKU_NO_DOWNLOADS}" ;
|
2018-08-15 20:40:03 +02:00
|
|
|
HAIKU_INCLUDE_SOURCES ?= "${HAIKU_INCLUDE_SOURCES}" ;
|
|
|
|
HAIKU_INCLUDE_3RDPARTY ?= "${HAIKU_INCLUDE_3RDPARTY}" ;
|
|
|
|
HAIKU_DISTRO_COMPATIBILITY ?= "${HAIKU_DISTRO_COMPATIBILITY}" ;
|
2014-04-30 23:47:55 +02:00
|
|
|
|
2018-08-15 20:40:03 +02:00
|
|
|
HAIKU_USE_GCC_PIPE ?= "${HAIKU_USE_GCC_PIPE}" ;
|
|
|
|
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}" ;
|
2007-05-20 19:50:11 +02:00
|
|
|
|
2021-09-06 22:02:17 +02:00
|
|
|
JAMSHELL ?= ${JAMSHELL} -e -c ;
|
2020-05-30 05:10:28 +02:00
|
|
|
|
2018-08-15 20:40:03 +02:00
|
|
|
HOST_CC ?= ${CC} ;
|
2010-01-04 20:36:58 +01:00
|
|
|
HOST_GCC_MACHINE ?= ${HOST_GCC_MACHINE} ;
|
|
|
|
HOST_LD ?= ${HOST_GCC_LD} ;
|
|
|
|
HOST_OBJCOPY ?= ${HOST_GCC_OBJCOPY} ;
|
2018-08-15 20:40:03 +02:00
|
|
|
HOST_EXTENDED_REGEX_SED ?= ${HOST_EXTENDED_REGEX_SED} ;
|
2013-07-06 02:17:15 +02:00
|
|
|
HOST_SHA256 ?= ${HOST_SHA256} ;
|
2019-03-02 20:23:12 +01:00
|
|
|
HOST_PYTHON ?= ${HOST_PYTHON} ;
|
2018-08-15 20:40:03 +02:00
|
|
|
HAIKU_NASM ?= ${HAIKU_NASM} ;
|
|
|
|
|
2019-01-10 00:52:02 +01:00
|
|
|
HAIKU_BUILD_ATTRIBUTES_DIR ?= "${HAIKU_BUILD_ATTRIBUTES_DIR}" ;
|
2005-11-12 23:58:54 +01:00
|
|
|
|
2013-07-21 04:10:48 +02:00
|
|
|
HOST_HAIKU_PORTER ?= ${HOST_HAIKU_PORTER} ;
|
|
|
|
HAIKU_PORTS ?= ${HAIKU_PORTS} ;
|
|
|
|
HAIKU_PORTS_CROSS ?= ${HAIKU_PORTS_CROSS} ;
|
2014-10-26 21:07:01 +01:00
|
|
|
HAIKU_IS_BOOTSTRAP ?= ${HAIKU_IS_BOOTSTRAP} ;
|
2013-07-21 04:10:48 +02:00
|
|
|
|
2022-02-06 23:24:02 +01:00
|
|
|
HAIKU_BOOT_EFI_PRIVATE_KEYFILE ?= ${HAIKU_EFI_SIGNING_KEY} ;
|
2002-07-16 01:42:06 +02:00
|
|
|
EOF
|
|
|
|
|
2013-07-25 23:52:11 +02:00
|
|
|
for targetArch in $HAIKU_PACKAGING_ARCHS; do
|
|
|
|
variables="
|
2018-06-19 00:59:55 +02:00
|
|
|
HAIKU_CC HAIKU_CC
|
2020-10-07 05:46:18 +02:00
|
|
|
HAIKU_CC_IS_LEGACY_GCC HAIKU_CC_IS_LEGACY_GCC
|
2018-06-19 00:59:55 +02:00
|
|
|
HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG
|
|
|
|
HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE
|
|
|
|
HAIKU_CPU HAIKU_CPU
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_GCC_MACHINE HAIKU_GCC_MACHINE
|
|
|
|
HAIKU_GCC_LIB_DIR HAIKU_GCC_LIB_DIR
|
|
|
|
HAIKU_BOOT_LIBGCC HAIKU_BOOT_LIBGCC
|
|
|
|
HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX
|
2022-03-23 13:08:47 +01:00
|
|
|
HAIKU_BOOT_32_LIBGCC HAIKU_BOOT_32_LIBGCC
|
|
|
|
HAIKU_BOOT_32_LIBSUPC++ HAIKU_BOOT_32_LIBSUPCXX
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_AR HAIKU_AR
|
|
|
|
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
|
2018-08-15 20:19:30 +02:00
|
|
|
HAIKU_LINKFLAGS HAIKU_LINKFLAGS
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_LDFLAGS HAIKU_LDFLAGS
|
|
|
|
HAIKU_ARFLAGS HAIKU_ARFLAGS
|
|
|
|
HAIKU_UNARFLAGS HAIKU_UNARFLAGS
|
|
|
|
"
|
|
|
|
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-15 22:41:27 +01:00
|
|
|
HAIKU_BOOT_C++_HEADERS_DIR HAIKU_BOOT_CXX_HEADERS_DIR
|
2022-03-23 13:08:47 +01:00
|
|
|
HAIKU_BOOT_32_C++_HEADERS_DIR HAIKU_BOOT_32_CXX_HEADERS_DIR
|
2013-07-25 23:52:11 +02: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 02:34:37 +01:00
|
|
|
|
|
|
|
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
# Generate a Jamfile in the output directory.
|
2005-10-29 18:27:43 +02:00
|
|
|
|
|
|
|
cat << EOF > $outputDir/Jamfile
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
# -- WARNING --
|
|
|
|
# This file was AUTOMATICALLY GENERATED by configure, and will be completely
|
|
|
|
# overwritten the next time configure is run.
|
2005-10-29 18:27:43 +02:00
|
|
|
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
HAIKU_TOP = $(relative_to "${sourceDir}" "${outputDir}") ;
|
|
|
|
HAIKU_OUTPUT_DIR = . ;
|
2005-10-29 18:27:43 +02:00
|
|
|
|
|
|
|
include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
|
|
|
|
|
|
|
|
EOF
|
2017-11-23 17:29:15 +01:00
|
|
|
|
|
|
|
echo "Configured successfully!"
|