Admin/polyml/build
changeset 64544 d23b7c9b9dd4
parent 64543 6b13586ef1a2
child 64545 25045094d7bb
     1.1 --- a/Admin/polyml/build	Thu Dec 08 17:22:51 2016 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,117 +0,0 @@
     1.4 -#!/usr/bin/env bash
     1.5 -#
     1.6 -# Multi-platform build script for Poly/ML
     1.7 -
     1.8 -THIS="$(cd "$(dirname "$0")"; pwd)"
     1.9 -PRG="$(basename "$0")"
    1.10 -
    1.11 -
    1.12 -# diagnostics
    1.13 -
    1.14 -function usage()
    1.15 -{
    1.16 -  echo
    1.17 -  echo "Usage: $PRG SOURCE TARGET [OPTIONS]"
    1.18 -  echo
    1.19 -  echo "  Build Poly/ML in SOURCE directory for given platform in TARGET,"
    1.20 -  echo "  using the usual Isabelle platform identifiers."
    1.21 -  echo
    1.22 -  echo "  Additional options for ./configure may be given, e.g. --with-gmp"
    1.23 -  echo
    1.24 -  exit 1
    1.25 -}
    1.26 -
    1.27 -function fail()
    1.28 -{
    1.29 -  echo "$1" >&2
    1.30 -  exit 2
    1.31 -}
    1.32 -
    1.33 -
    1.34 -# command line args
    1.35 -
    1.36 -[ "$#" -eq 0 ] && usage
    1.37 -SOURCE="$1"; shift
    1.38 -
    1.39 -[ "$#" -eq 0 ] && usage
    1.40 -TARGET="$1"; shift
    1.41 -
    1.42 -USER_OPTIONS=("$@")
    1.43 -
    1.44 -
    1.45 -# main
    1.46 -
    1.47 -[ -d "$SOURCE" ] || fail "Bad source directory: \"$SOURCE\""
    1.48 -
    1.49 -case "$TARGET" in
    1.50 -  x86-linux)
    1.51 -    OPTIONS=()
    1.52 -    ;;
    1.53 -  x86_64-linux)
    1.54 -    OPTIONS=()
    1.55 -    ;;
    1.56 -  x86-darwin)
    1.57 -    OPTIONS=(--build=i686-darwin CFLAGS='-arch i686 -O3 -I../libffi/include'
    1.58 -      CXXFLAGS='-arch i686 -O3 -I../libffi/include' CCASFLAGS='-arch i686 -O3'
    1.59 -      LDFLAGS='-segprot POLY rwx rwx')
    1.60 -    ;;
    1.61 -  x86_64-darwin)
    1.62 -   OPTIONS=(--build=x86_64-darwin CFLAGS='-arch x86_64 -O3 -I../libffi/include'
    1.63 -     CXXFLAGS='-arch x86_64 -O3 -I../libffi/include' CCASFLAGS='-arch x86_64'
    1.64 -     LDFLAGS='-segprot POLY rwx rwx')
    1.65 -    ;;
    1.66 -  x86-cygwin)
    1.67 -    OPTIONS=()
    1.68 -    ;;
    1.69 -  x86-windows)
    1.70 -    OPTIONS=(--host=i686-w32-mingw32 CPPFLAGS='-I/mingw32/include' --disable-windows-gui)
    1.71 -    PATH="/mingw32/bin:$PATH"
    1.72 -    ;;
    1.73 -  x86_64-windows)
    1.74 -    OPTIONS=(--host=x86_64-w64-mingw32 CPPFLAGS='-I/mingw64/include' --disable-windows-gui)
    1.75 -    PATH="/mingw64/bin:$PATH"
    1.76 -    ;;
    1.77 -  *)
    1.78 -    fail "Bad platform identifier: \"$TARGET\""
    1.79 -    ;;
    1.80 -esac
    1.81 -
    1.82 -(
    1.83 -  cd "$SOURCE"
    1.84 -  make distclean
    1.85 -
    1.86 -  { ./configure --prefix="$PWD/$TARGET" "${OPTIONS[@]}" --enable-intinf-as-int "${USER_OPTIONS[@]}" && \
    1.87 -    make compiler && \
    1.88 -    make compiler && \
    1.89 -    make install; } || fail "Build failed"
    1.90 -)
    1.91 -
    1.92 -mkdir -p "$TARGET"
    1.93 -for X in "$TARGET"/*
    1.94 -do
    1.95 -  [ -d "$X" ] && rm -rf "$X"
    1.96 -done
    1.97 -rm -rf "$TARGET/polyml"
    1.98 -cp -a "$THIS/polyi" "$TARGET/"
    1.99 -mv "$SOURCE/$TARGET/bin/"* "$TARGET/"
   1.100 -mv "$SOURCE/$TARGET/lib/"* "$TARGET/"
   1.101 -rmdir "$SOURCE/$TARGET/bin" "$SOURCE/$TARGET/lib"
   1.102 -rm -rf "$SOURCE/$TARGET/share"
   1.103 -
   1.104 -case "$TARGET" in
   1.105 -  x86-cygwin)
   1.106 -    peflags -x8192000 -z500 "$TARGET/poly.exe"
   1.107 -    ;;
   1.108 -  x86-windows)
   1.109 -    for X in libgcc_s_dw2-1.dll libgmp-10.dll libstdc++-6.dll
   1.110 -    do
   1.111 -      cp "/mingw32/bin/$X" "$TARGET/."
   1.112 -    done
   1.113 -    ;;
   1.114 -  x86_64-windows)
   1.115 -    for X in libgcc_s_seh-1.dll libgmp-10.dll libstdc++-6.dll
   1.116 -    do
   1.117 -      cp "/mingw64/bin/$X" "$TARGET/."
   1.118 -    done
   1.119 -    ;;
   1.120 -esac