configure: Rewrite implementation of --update.
Previously --update was kind of a hack, as it just dumped all the variables from BuildConfig back into ./configure and attempted to rerun from there. Instead, now we store all of the variables and environs configure was invoked with in the top of BuildConfig and re-call it using them. This is much more robust, as configure will actually recompute all of the values from the BuildConfig. As a side effect, if configure was originally invoked to build crosstools, it would have done so again, so instead add a check to see if they exist, and skip them if they do. It's easy enough to delete the directory if you want to force a crosstools rebuild. Briefly discussed with mmlr on IRC.
This commit is contained in:
parent
bf1a86c199
commit
825700d34a
@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use warnings;
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
=head1 convert_build_config_to_shell_format
|
|
||||||
|
|
||||||
This simple script converts its standard input from the jam-specific format
|
|
||||||
that is being used in BuildSetup into a format that's understood by sh.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
my $data;
|
|
||||||
while (my $line = <>) {
|
|
||||||
$data .= $line;
|
|
||||||
if ($data =~ m{\s*([+\w]+)\s*\?=\s*\"?([^;]*?)\"?\s*;}gms) {
|
|
||||||
my ($variable, $value) = ($1, $2);
|
|
||||||
$variable =~ tr{+}{X}; # '+' is illegal as part of shell variable
|
|
||||||
print "$variable='$value'\n";
|
|
||||||
$data = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
56
configure
vendored
56
configure
vendored
@ -12,6 +12,9 @@ usage()
|
|||||||
|
|
||||||
Usage: $0 <options>
|
Usage: $0 <options>
|
||||||
options:
|
options:
|
||||||
|
--help Prints out this help.
|
||||||
|
--update Re-runs last configure invocation [must be given
|
||||||
|
as first option!]
|
||||||
--bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
|
--bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
|
||||||
Prepare for a bootstrap build. No pre-built
|
Prepare for a bootstrap build. No pre-built
|
||||||
packages will be used, instead they will be built
|
packages will be used, instead they will be built
|
||||||
@ -51,7 +54,6 @@ options:
|
|||||||
official -- the official Haiku distribution.
|
official -- the official Haiku distribution.
|
||||||
compatible -- a Haiku Compatible (tm) distro.
|
compatible -- a Haiku Compatible (tm) distro.
|
||||||
default -- any other distro (default value).
|
default -- any other distro (default value).
|
||||||
--help Prints out this help.
|
|
||||||
--host-only Configure for building tools for the build host
|
--host-only Configure for building tools for the build host
|
||||||
only. Haiku cannot be built when configured like
|
only. Haiku cannot be built when configured like
|
||||||
this.
|
this.
|
||||||
@ -59,7 +61,7 @@ options:
|
|||||||
ideas and techniques. If this option is not
|
ideas and techniques. If this option is not
|
||||||
specified, the resulting distribution may still
|
specified, the resulting distribution may still
|
||||||
implement patented ideas and techniques. This
|
implement patented ideas and techniques. This
|
||||||
option only disables code that is currently known
|
option only enables code that is currently known
|
||||||
to be problematic.
|
to be problematic.
|
||||||
--include-sources Includes the source code of projects that require
|
--include-sources Includes the source code of projects that require
|
||||||
either an offer of source code or a copy of the
|
either an offer of source code or a copy of the
|
||||||
@ -81,8 +83,6 @@ options:
|
|||||||
first occurrence specifies the primary
|
first occurrence specifies the primary
|
||||||
architecture of the Haiku to build, subsequent
|
architecture of the Haiku to build, subsequent
|
||||||
ones the secondary architectures.
|
ones the secondary architectures.
|
||||||
--update re-runs last configure invocation [must be given
|
|
||||||
as first option!]
|
|
||||||
--use-clang <arch> Build with host Clang instead of GCC cross
|
--use-clang <arch> Build with host Clang instead of GCC cross
|
||||||
compiler, targeting <arch>
|
compiler, targeting <arch>
|
||||||
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
|
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build
|
||||||
@ -415,6 +415,17 @@ cd "$currentDir"
|
|||||||
|
|
||||||
# backup the passed arguments
|
# backup the passed arguments
|
||||||
configureArgs="$@"
|
configureArgs="$@"
|
||||||
|
configurePath=$0
|
||||||
|
|
||||||
|
# backup relevant environs
|
||||||
|
configureEnvirons=
|
||||||
|
for var in `env`; do
|
||||||
|
case "$var" in
|
||||||
|
CC\=*|HAIKU*\=*)
|
||||||
|
configureEnvirons="$configureEnvirons $var"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# internal default parameter values
|
# internal default parameter values
|
||||||
#
|
#
|
||||||
@ -502,17 +513,20 @@ if [ "$1" = "--update" ]; then
|
|||||||
echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
|
echo $0 --update: \'$buildConfigFile\' not found - updating not possible.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! type perl >/dev/null 2>&1; then
|
# get last configure invocation and flags from BuildConfig and call ourselves with it
|
||||||
echo $0 --update: \'perl\' not found - updating not possible.
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
# convert BuildConfig from jam format to shell format and evaluate it
|
cd $lastPwd
|
||||||
shellConfigFile="${buildConfigFile}.shell"
|
export $lastEnv
|
||||||
perl "$sourceDir/build/scripts/convert_build_config_to_shell_format.pl" \
|
$lastConfig $lastArgs
|
||||||
<"$buildConfigFile" >"$shellConfigFile"
|
exit $?
|
||||||
. "$shellConfigFile"
|
|
||||||
rm "$shellConfigFile"
|
|
||||||
shift
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parse parameters
|
# parse parameters
|
||||||
@ -791,6 +805,7 @@ else
|
|||||||
*) MAKE=make;;
|
*) MAKE=make;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ ! -d "$crossToolsDir" ]; then
|
||||||
MAKE=$MAKE \
|
MAKE=$MAKE \
|
||||||
SECONDARY_ARCH=$secondaryArch \
|
SECONDARY_ARCH=$secondaryArch \
|
||||||
HAIKU_USE_GCC_GRAPHITE=`get_variable \
|
HAIKU_USE_GCC_GRAPHITE=`get_variable \
|
||||||
@ -799,6 +814,9 @@ else
|
|||||||
HAIKU_USE_GDB="$gdbSources" \
|
HAIKU_USE_GDB="$gdbSources" \
|
||||||
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
|
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
|
||||||
"$crossToolsDir" $buildCrossToolsJobs || exit 1
|
"$crossToolsDir" $buildCrossToolsJobs || exit 1
|
||||||
|
else
|
||||||
|
echo "$targetArch crosstools already exist in $crossToolsDir; skipping build"
|
||||||
|
fi
|
||||||
crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
|
crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -863,10 +881,14 @@ fi
|
|||||||
|
|
||||||
# Generate BuildConfig
|
# Generate BuildConfig
|
||||||
cat << EOF > "$buildConfigFile"
|
cat << EOF > "$buildConfigFile"
|
||||||
# BuildConfig
|
# -- WARNING --
|
||||||
# Note: This file has been automatically generated by configure with the
|
# This file was AUTOMATICALLY GENERATED by configure, and will be completely
|
||||||
# following arguments:
|
# overwritten the next time configure is run.
|
||||||
# ${configureArgs}
|
#
|
||||||
|
#d ${currentDir}
|
||||||
|
#c ${configurePath}
|
||||||
|
#e ${configureEnvirons}
|
||||||
|
#a ${configureArgs}
|
||||||
|
|
||||||
TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
|
TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ;
|
||||||
HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
|
HOST_PLATFORM ?= "${HOST_PLATFORM}" ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user