2014-05-12 05:19:20 -07:00
|
|
|
#!/bin/sh
|
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# OCaml #
|
|
|
|
# #
|
|
|
|
# Damien Doligez, projet Gallium, INRIA Rocquencourt #
|
|
|
|
# #
|
|
|
|
# Copyright 2014 Institut National de Recherche en Informatique et #
|
|
|
|
# en Automatique. All rights reserved. This file is distributed #
|
|
|
|
# under the terms of the Q Public License version 1.0. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# This script is run on our continuous-integration servers to recompile
|
|
|
|
# from scratch and run the test suite.
|
|
|
|
|
|
|
|
# arguments:
|
|
|
|
# 1. architecture: bsd, macos, linux, cygwin, mingw, mingw64, msvc, msvc64
|
2014-06-02 04:30:11 -07:00
|
|
|
# 2. directory in which to build (trunk, 4.02, etc)
|
|
|
|
# for windows, this is relative to $HOME/jenkins-workspace
|
|
|
|
# for bsd, macos, linux, this is "." or an absolute directory
|
2014-05-12 05:19:20 -07:00
|
|
|
# 3. options:
|
|
|
|
# -conf configure-option
|
2014-06-02 04:27:24 -07:00
|
|
|
# -patch1 file-name apply patch with -p1
|
2014-05-12 05:19:20 -07:00
|
|
|
|
|
|
|
error () {
|
|
|
|
echo "$1" >&2
|
|
|
|
exit 3
|
|
|
|
}
|
|
|
|
|
2014-06-05 02:19:17 -07:00
|
|
|
#########################################################################
|
2014-06-05 02:37:57 -07:00
|
|
|
# be verbose
|
|
|
|
set -x
|
2014-06-05 02:19:17 -07:00
|
|
|
|
2014-06-05 02:57:20 -07:00
|
|
|
#########################################################################
|
|
|
|
# "Parse" mandatory command-line arguments.
|
|
|
|
|
|
|
|
arch="$1"
|
|
|
|
branch="$2"
|
|
|
|
shift 2
|
|
|
|
|
2014-05-12 05:19:20 -07:00
|
|
|
#########################################################################
|
|
|
|
# If we are called from a Windows batch script, we must set up the
|
|
|
|
# Unix environment variables (e.g. PATH).
|
|
|
|
|
2014-06-05 02:57:20 -07:00
|
|
|
case "$arch" in
|
2014-05-12 05:19:20 -07:00
|
|
|
bsd|macos|linux) ;;
|
2014-05-12 07:26:25 -07:00
|
|
|
cygwin|mingw|mingw64)
|
2014-05-12 05:19:20 -07:00
|
|
|
. /etc/profile
|
2014-05-12 07:26:25 -07:00
|
|
|
. "$HOME/.profile"
|
|
|
|
;;
|
|
|
|
msvc)
|
|
|
|
. /etc/profile
|
|
|
|
. "$HOME/.profile"
|
|
|
|
. "$HOME/.msenv32"
|
|
|
|
;;
|
|
|
|
msvc64)
|
|
|
|
. /etc/profile
|
|
|
|
. "$HOME/.profile"
|
|
|
|
. "$HOME/.msenv64"
|
2014-05-12 05:19:20 -07:00
|
|
|
;;
|
2014-06-05 02:57:20 -07:00
|
|
|
*) error "unknown architecture: $arch";;
|
2014-05-12 05:19:20 -07:00
|
|
|
esac
|
|
|
|
|
2014-06-05 02:37:57 -07:00
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# be verbose and stop on error
|
|
|
|
set -ex
|
|
|
|
|
2014-05-12 05:19:20 -07:00
|
|
|
#########################################################################
|
|
|
|
# set up variables
|
|
|
|
|
|
|
|
# default values
|
|
|
|
make=make
|
|
|
|
instdir="$HOME/ocaml-tmp-install"
|
2014-06-02 04:30:11 -07:00
|
|
|
workdir="$branch"
|
2014-05-12 11:56:14 -07:00
|
|
|
docheckout=false
|
2014-05-12 05:19:20 -07:00
|
|
|
nt=
|
|
|
|
|
|
|
|
case "$arch" in
|
|
|
|
bsd)
|
|
|
|
make=gmake
|
|
|
|
;;
|
2014-06-02 04:30:11 -07:00
|
|
|
macos) ;;
|
2014-05-12 05:19:20 -07:00
|
|
|
linux) ;;
|
|
|
|
cygwin)
|
|
|
|
workdir="$HOME/jenkins-workspace/$branch"
|
|
|
|
docheckout=true
|
|
|
|
;;
|
|
|
|
mingw)
|
|
|
|
instdir=/cygdrive/c/ocamlmgw
|
|
|
|
workdir="$HOME/jenkins-workspace/$branch"
|
|
|
|
docheckout=true
|
|
|
|
nt=.nt
|
|
|
|
;;
|
|
|
|
mingw64)
|
|
|
|
instdir=/cygdrive/c/ocamlmgw64
|
|
|
|
workdir="$HOME/jenkins-workspace/$branch"
|
|
|
|
docheckout=true
|
|
|
|
nt=.nt
|
|
|
|
;;
|
|
|
|
msvc)
|
|
|
|
instdir=/cygdrive/c/ocamlms
|
|
|
|
workdir="$HOME/jenkins-workspace/$branch"
|
|
|
|
docheckout=true
|
|
|
|
nt=.nt
|
|
|
|
;;
|
|
|
|
msvc64)
|
|
|
|
instdir=/cygdrive/c/ocamlms64
|
|
|
|
workdir="$HOME/jenkins-workspace/$branch"
|
|
|
|
docheckout=true
|
|
|
|
nt=.nt
|
|
|
|
;;
|
|
|
|
*) error "unknown architecture: $arch";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#########################################################################
|
2014-06-02 13:52:44 -07:00
|
|
|
# Go to the right directory
|
2014-05-12 05:19:20 -07:00
|
|
|
|
|
|
|
cd "$workdir"
|
|
|
|
|
2014-06-02 13:52:44 -07:00
|
|
|
#########################################################################
|
2014-06-05 02:57:20 -07:00
|
|
|
# parse optional command-line arguments (has to be done after the "cd")
|
2014-06-02 13:52:44 -07:00
|
|
|
# Configure options are not allowed to have spaces or special characters
|
|
|
|
# for the moment. We'll fix that when needed.
|
|
|
|
confoptions=""
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-conf) confoptions="$confoptions $2"; shift 2;;
|
|
|
|
-patch1) patch -f -p1 <"$2"; shift 2;;
|
|
|
|
*) error "unknown option $1";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
# Do the work
|
|
|
|
|
2015-07-22 06:22:33 -07:00
|
|
|
# Tell gcc to use only ASCII in its diagnostic outputs.
|
|
|
|
export LC_ALL=C
|
|
|
|
|
2014-05-12 07:03:04 -07:00
|
|
|
$make -f Makefile$nt distclean || :
|
2014-05-12 05:19:20 -07:00
|
|
|
|
|
|
|
if $docheckout; then
|
|
|
|
svn update --accept theirs-full
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $nt in
|
|
|
|
"") ./configure -prefix "$instdir" $confoptions;;
|
|
|
|
.nt)
|
|
|
|
cp config/m-nt.h config/m.h
|
|
|
|
cp config/s-nt.h config/s.h
|
|
|
|
cp config/Makefile.$arch config/Makefile
|
|
|
|
;;
|
|
|
|
*) error "internal error";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
$make -f Makefile$nt world.opt
|
|
|
|
$make -f Makefile$nt install
|
|
|
|
|
|
|
|
rm -rf "$instdir"
|
|
|
|
cd testsuite
|
|
|
|
$make all
|