[m-rev.] for review: Add build_src_dist script for building the source distribution

Paul Bone paul at bone.id.au
Wed Oct 16 13:48:03 AEDT 2013


Branches: master

For review by Julien as he wrote the original script.


Add build_src_dist script for building the source distribution

This new script can build source distributions.  It is derived from the
script Julien had been using.

tools/build_src_dist:
    As above
---
 tools/build_src_dist | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100755 tools/build_src_dist

diff --git a/tools/build_src_dist b/tools/build_src_dist
new file mode 100755
index 0000000..f866ead
--- /dev/null
+++ b/tools/build_src_dist
@@ -0,0 +1,92 @@
+#!/bin/sh
+# 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
+CC=gcc
+RUN=no
+PARALLEL=1
+
+USAGE="$0 < -r | -v VER | -n > [-j PAR] [-f] [-c CC]
+
+\t-r     Use a ROTD style version number with today's date.
+\t-v VER Use VER as the version number.
+\t-n     Don't update VERSION file (default).
+\t-f     Without this option the build_src_dist will not run, it will
+\t       warn the user that it is distructive and then exit.
+\t-j PAR Run this many jobs in parallel.
+\t-c CC  Use CC as the C compiler.
+"
+
+while : ; do
+    case "$1" in
+        -h | --help)
+            echo "$USAGE"
+            exit 0
+            ;;
+        -r)
+            RELEASE_VERSION=$ROTD_VERSION
+            ;;
+        -v)
+            shift
+            RELEASE_VERSION=$1
+            ;;
+        -n)
+            RELEASE_VERSION=""
+            ;;
+        -c)
+            shift
+            CC=$1
+            ;;
+        -f)
+            RUN=yes
+            ;;
+        -j)
+            shift
+            PARALLEL=$1
+            ;;
+        *)
+            if [ -z "$1" ]; then
+                break
+            else
+                echo "Unknown option \"$1\""
+                echo "$USAGE"
+                exit 1
+            fi
+            ;;
+    esac
+    shift
+done
+
+if [ "$RUN" = "no" ]; then
+    echo "Warning: Thie script is disruptive, 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
+
+NUM_TAG_BITS=2
+BITS_PER_WORD=32
+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_unboxed_floats=$UNBOXED_FLOATS \
+sh configure --with-llds-base-grade=none --with-cc="$CC" &&
+mmake GRADE=hlc.gc.pregen MMAKEFLAGS="EXTRA_MCFLAGS='-O5 --opt-space --cross-compiling --no-smart-indexing' -j$PARALLEL" tar
+
+
-- 
1.8.4.rc3




More information about the reviews mailing list