Files
mercury/tools/build_srcdist
Julien Fischer e6fc62a7ab Update the source distribution build script.
tools/build_srcdist:
	We no longer need to bother with setting the LLDS base grade as the
	C files in the source distribution have been built using the high-level
	C backend for quite a while now.

	Don't build the source distribution with --cross-compiling; that option
	no longer does anything.

	Don't disable smart indexing when building the source distribution;
	the problems that originally caused us to do so have long since been
	fixed.
2015-07-02 00:49:11 +10:00

107 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Copyright (C) 2013 The University of Melbourne
#
# This script builds the Mercury source distribution.
#
set -e
DATE=`date '+%Y-%m-%d'`
ROTD_VERSION=rotd-$DATE
RELEASE_VERSION=$ROTD_VERSION
CC=gcc
RUN=no
PARALLEL=1
USAGE="\
$0 [options]
Options:
-h
Output this help message and exit.
-r
Use a ROTD style version number with today's date (default).
-v VER
Use VER as the version number.
-n
Don't update VERSION file.
-f
Without this option the build_srcdist will not run, it will warn
the user that it is destructive and then exit.
-j N
Run N jobs in parallel.
-c CC
Use CC as the C compiler.
"
while getopts "hrv:nc:fj:" OPT; do
case "$OPT" in
h)
echo "$USAGE"
exit 0
;;
r)
RELEASE_VERSION=$ROTD_VERSION
;;
v)
RELEASE_VERSION=$OPTARG
;;
n)
RELEASE_VERSION=""
;;
c)
CC=$OPTARG
;;
f)
RUN=yes
;;
j)
PARALLEL=$OPTARG
;;
?)
echo "$USAGE"
exit 1
;;
*)
echo "Getopt error \"$OPT\""
echo "$USAGE"
exit 1
;;
esac
done
if [ "$RUN" = "no" ]; then
echo "Warning: This script is destructive, it will 'git clean' your"
echo "workspace. If you're okay with this and want to proceed, then"
echo "add -f to the command line"
exit 2
fi
if [ ! -d .git ]; then
echo "Error: $0 must be called from the root directory of a Mercury"
echo "git workspace."
exit 2
fi
NUM_TAG_BITS=2
BITS_PER_WORD=32
BYTES_PER_WORD=4
UNBOXED_FLOATS=no
# git checkout -- VERSION
git clean -d -f -x
if [ -n "$RELEASE_VERSION" ]; then
sed "s/VERSION=.*/VERSION=$RELEASE_VERSION/" VERSION > VERSION.new
mv VERSION.new VERSION
fi
/bin/rm -f Mmake.params Mmake.stage.params
aclocal -I m4 &&
autoconf &&
mercury_cv_low_tag_bits=$NUM_TAG_BITS \
mercury_cv_bits_per_word=$BITS_PER_WORD \
mercury_cv_bytes_per_word=$BYTES_PER_WORD \
mercury_cv_unboxed_floats=$UNBOXED_FLOATS \
sh configure --with-cc="$CC" &&
mmake GRADE=hlc.gc.pregen MMAKEFLAGS="EXTRA_MCFLAGS='-O5 --opt-space' -j$PARALLEL" tar