Skip to content

Commit

Permalink
add universal CI build script
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14796 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
Damien Doligez committed May 12, 2014
1 parent 77cf8b9 commit 4736382
Showing 1 changed file with 132 additions and 0 deletions.
132 changes: 132 additions & 0 deletions tools/ci-build
@@ -0,0 +1,132 @@
#!/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
# 2. which branch to build (trunk, 4.02, etc)
# 3. options:
# -conf configure-option

error () {
echo "$1" >&2
exit 3
}

#########################################################################
# If we are called from a Windows batch script, we must set up the
# Unix environment variables (e.g. PATH).

case "$1" in
bsd|macos|linux) ;;
cygwin|mingw|msvc)
. /etc/profile
. ~/.profile
;;
*) error "unknown architecture: $1";;
esac

#########################################################################

# be verbose and stop on error
set -ex

# parse command line
# Configure options are not allowed to have spaces or special characters
# for the moment. We'll fix that when needed.
arch="$1"
branch="$2"
confoptions=""
shift 2
while [ $# -gt 0 ]; do
case $1 in
-conf) confoptions="$confoptions $2"; shift 2;;
*) error "unknown option $1";;
esac
done

#########################################################################
# set up variables

# default values
make=make
instdir="$HOME/ocaml-tmp-install"
workdir="$HOME/workspace/$branch"
checkout=false
nt=

case "$arch" in
bsd)
make=gmake
;;
macos) ;; # FIXME to be checked
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

#########################################################################

cd "$workdir"

$make -f Makefile$nt clean distclean || :

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

0 comments on commit 4736382

Please sign in to comment.