root/tags/releases/0.99.8/lib/build-gdc-x.sh
| Revision 4431, 1.3 kB (checked in by larsivi, 3 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | die() { |
| 4 | echo "$1" |
| 5 | exit $2 |
| 6 | } |
| 7 | |
| 8 | cd "`dirname $0`" |
| 9 | |
| 10 | if [ ! "$1" ] |
| 11 | then |
| 12 | echo 'Use: build-gdc-x.sh <target> [phobos-fragments-directory]' |
| 13 | exit 1 |
| 14 | fi |
| 15 | HOST="$1" |
| 16 | BUILD="`./compiler/gdc/config.guess`" |
| 17 | CONFIGURE_FLAGS="" |
| 18 | if [ "$2" ] |
| 19 | then |
| 20 | CONFIGURE_FLAGS="--enable-phobos-config-dir=$2" |
| 21 | fi |
| 22 | |
| 23 | $HOST-gdc --help >& /dev/null || die "$HOST-gdc not found on your \$PATH!" 1 |
| 24 | |
| 25 | HOST_ARCH="`echo $HOST | sed 's/-.*//'`" |
| 26 | #ADD_CFLAGS= |
| 27 | if [ "$HOST_ARCH" = "powerpc" -a ! "`echo $HOST | grep darwin`" ] |
| 28 | then |
| 29 | ADD_CFLAGS="-mregnames" |
| 30 | fi |
| 31 | #ADD_DFLAGS= |
| 32 | |
| 33 | GDC_VER="`$HOST-gdc --version | grep 'gdc' | sed 's/^.*gdc \(pre\-\{0,1\}release \)*\([0-9]*\.[0-9]*\).*$/\2/'`" |
| 34 | GDC_MAJOR="`echo $GDC_VER | sed 's/\..*//'`" |
| 35 | GDC_MINOR="`echo $GDC_VER | sed 's/.*\.//'`" |
| 36 | |
| 37 | if [ "$GDC_MAJOR" = "0" -a \ |
| 38 | "$GDC_MINOR" -lt "23" ] |
| 39 | then |
| 40 | echo 'This version of Tango requires GDC 0.23 or newer.' |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | cd ./compiler/gdc |
| 45 | ./configure --host="$HOST" --build="$BUILD" $CONFIGURE_FLAGS || exit 1 |
| 46 | cd ../.. |
| 47 | |
| 48 | OLDHOME=$HOME |
| 49 | export HOME=`pwd` |
| 50 | make clean -fgdc-posix.mak CC=$HOST-gcc DC=$HOST-gdmd || exit 1 |
| 51 | make lib doc install -fgdc-posix.mak CC=$HOST-gcc DC=$HOST-gdmd \ |
| 52 | ADD_CFLAGS="$ADD_CFLAGS" ADD_DFLAGS="$ADD_DFLAGS" SYSTEM_VERSION="-version=Posix" || exit 1 |
| 53 | make clean -fgdc-posix.mak CC=$HOST-gcc DC=$HOST-gdmd || exit 1 |
| 54 | export HOME=$OLDHOME |
Note: See TracBrowser for help on using the browser.












