2015-11-29 03:23:22 -08:00
|
|
|
#!/bin/bash
|
2016-05-17 02:13:00 -07:00
|
|
|
#**************************************************************************
|
|
|
|
#* *
|
|
|
|
#* OCaml *
|
|
|
|
#* *
|
|
|
|
#* Christophe Troestler *
|
|
|
|
#* *
|
|
|
|
#* Copyright 2015 Christophe Troestler *
|
|
|
|
#* *
|
|
|
|
#* All rights reserved. This file is distributed under the terms of *
|
|
|
|
#* the GNU Lesser General Public License version 2.1, with the *
|
|
|
|
#* special exception on linking described in the file LICENSE. *
|
|
|
|
#* *
|
|
|
|
#**************************************************************************
|
2015-11-29 03:23:22 -08:00
|
|
|
|
2017-09-30 06:23:32 -07:00
|
|
|
BUILD_PID=0
|
|
|
|
|
2015-11-29 03:23:22 -08:00
|
|
|
function run {
|
|
|
|
NAME=$1
|
|
|
|
shift
|
|
|
|
echo "-=-=- $NAME -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
|
|
|
$@
|
|
|
|
CODE=$?
|
|
|
|
if [ $CODE -ne 0 ]; then
|
|
|
|
echo "-=-=- $NAME failed! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
2017-09-30 06:23:32 -07:00
|
|
|
if [ $BUILD_PID -ne 0 ] ; then
|
|
|
|
kill -KILL $BUILD_PID 2>/dev/null
|
|
|
|
wait $BUILD_PID 2>/dev/null
|
|
|
|
fi
|
2015-11-29 03:23:22 -08:00
|
|
|
exit $CODE
|
|
|
|
else
|
|
|
|
echo "-=-=- End of $NAME -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-08-12 13:21:58 -07:00
|
|
|
function set_configuration {
|
2018-06-20 08:43:29 -07:00
|
|
|
cp config/m-nt.h runtime/caml/m.h
|
|
|
|
cp config/s-nt.h runtime/caml/s.h
|
2017-08-12 13:21:58 -07:00
|
|
|
|
|
|
|
FILE=$(pwd | cygpath -f - -m)/config/Makefile
|
|
|
|
echo "Edit $FILE to set PREFIX=$2"
|
|
|
|
sed -e "/PREFIX=/s|=.*|=$2|" \
|
2018-04-12 07:11:24 -07:00
|
|
|
-e "/RUNTIMED=/s|=.*|=true|" \
|
2018-06-20 04:39:09 -07:00
|
|
|
-e "/^ *OC_CFLAGS *=/s/\r\?$/ $3\0/" \
|
2017-08-12 13:21:58 -07:00
|
|
|
config/Makefile.$1 > config/Makefile
|
|
|
|
# run "Content of $FILE" cat config/Makefile
|
|
|
|
}
|
|
|
|
|
2017-09-29 07:02:42 -07:00
|
|
|
APPVEYOR_BUILD_FOLDER=$(echo $APPVEYOR_BUILD_FOLDER| cygpath -f -)
|
2017-10-20 06:12:06 -07:00
|
|
|
# These directory names are specified here, because getting UTF-8 correctly
|
|
|
|
# through appveyor.yml -> Command Script -> Bash is quite painful...
|
|
|
|
OCAMLROOT=$(echo $PROGRAMFILES/Бактріан🐫| cygpath -f - -m)
|
|
|
|
|
|
|
|
# This must be kept in sync with appveyor_build.cmd
|
|
|
|
BUILD_PREFIX=🐫реализация
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-24 13:13:35 -07:00
|
|
|
export PATH=$(echo $OCAMLROOT| cygpath -f -)/bin/flexdll:$PATH
|
|
|
|
|
2017-09-29 07:02:42 -07:00
|
|
|
case "$1" in
|
|
|
|
install)
|
2017-10-20 06:12:06 -07:00
|
|
|
mkdir -p "$OCAMLROOT/bin/flexdll"
|
2017-09-29 07:02:42 -07:00
|
|
|
cd $APPVEYOR_BUILD_FOLDER/../flexdll
|
2017-10-21 02:14:24 -07:00
|
|
|
# msvc64 objects need to be compiled with VS2015, so are copied later from
|
|
|
|
# a source build.
|
|
|
|
for f in flexdll.h flexlink.exe flexdll*_msvc.obj default*.manifest ; do
|
2017-10-20 06:12:06 -07:00
|
|
|
cp $f "$OCAMLROOT/bin/flexdll/"
|
2017-09-29 07:02:42 -07:00
|
|
|
done
|
2017-08-12 13:24:41 -07:00
|
|
|
echo 'eval $($APPVEYOR_BUILD_FOLDER/tools/msvs-promote-path)' \
|
|
|
|
>> ~/.bash_profile
|
2017-09-29 07:02:42 -07:00
|
|
|
;;
|
|
|
|
msvc32-only)
|
2017-10-20 06:12:06 -07:00
|
|
|
cd $APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX-msvc32
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-20 06:12:06 -07:00
|
|
|
set_configuration msvc "$OCAMLROOT-msvc32" -WX
|
2017-09-29 07:02:42 -07:00
|
|
|
|
|
|
|
run "make world" make world
|
|
|
|
run "make runtimeopt" make runtimeopt
|
2017-08-12 13:21:58 -07:00
|
|
|
run "make -C otherlibs/systhreads libthreadsnat.lib" \
|
|
|
|
make -C otherlibs/systhreads libthreadsnat.lib
|
2017-09-29 07:02:42 -07:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
test)
|
2017-10-20 06:12:06 -07:00
|
|
|
FULL_BUILD_PREFIX=$APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX
|
|
|
|
run "ocamlc.opt -version" $FULL_BUILD_PREFIX-msvc64/ocamlc.opt -version
|
|
|
|
run "test msvc64" make -C $FULL_BUILD_PREFIX-msvc64 tests
|
2018-04-12 07:11:24 -07:00
|
|
|
run "test mingw32" make -C $FULL_BUILD_PREFIX-mingw32/testsuite \
|
|
|
|
USE_RUNTIME="d" all
|
2017-10-20 06:12:06 -07:00
|
|
|
run "install msvc64" make -C $FULL_BUILD_PREFIX-msvc64 install
|
|
|
|
run "install mingw32" make -C $FULL_BUILD_PREFIX-mingw32 install
|
2018-06-07 05:28:08 -07:00
|
|
|
run "check_all_arches" make -C $FULL_BUILD_PREFIX-msvc64 check_all_arches
|
2017-09-29 07:02:42 -07:00
|
|
|
;;
|
|
|
|
*)
|
2017-10-20 06:12:06 -07:00
|
|
|
cd $APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX-msvc64
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-21 02:14:24 -07:00
|
|
|
tar -xzf $APPVEYOR_BUILD_FOLDER/flexdll.tar.gz
|
|
|
|
cd flexdll-$FLEXDLL_VERSION
|
|
|
|
make MSVC_DETECT=0 CHAINS=msvc64 support
|
2017-10-20 06:12:06 -07:00
|
|
|
cp flexdll*_msvc64.obj "$OCAMLROOT/bin/flexdll/"
|
2017-10-21 02:14:24 -07:00
|
|
|
cd ..
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-20 06:12:06 -07:00
|
|
|
set_configuration msvc64 "$OCAMLROOT" -WX
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-20 06:12:06 -07:00
|
|
|
cd ../$BUILD_PREFIX-mingw32
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-20 06:12:06 -07:00
|
|
|
set_configuration mingw "$OCAMLROOT-mingw32" -Werror
|
2017-09-29 07:02:42 -07:00
|
|
|
|
2017-10-20 06:12:06 -07:00
|
|
|
cd $APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX-msvc64
|
2017-09-30 06:23:32 -07:00
|
|
|
|
|
|
|
export TERM=ansi
|
2017-08-12 13:24:41 -07:00
|
|
|
script --quiet --return --command \
|
|
|
|
"make -C ../$BUILD_PREFIX-mingw32 flexdll world.opt" \
|
|
|
|
../$BUILD_PREFIX-mingw32/build.log >/dev/null 2>/dev/null &
|
2017-09-30 06:23:32 -07:00
|
|
|
BUILD_PID=$!
|
|
|
|
|
|
|
|
run "make world" make world
|
|
|
|
run "make bootstrap" make bootstrap
|
|
|
|
run "make opt" make opt
|
|
|
|
run "make opt.opt" make opt.opt
|
|
|
|
|
2017-10-05 04:16:49 -07:00
|
|
|
set +e
|
|
|
|
|
2017-08-12 13:24:41 -07:00
|
|
|
# For an explanation of the sed command, see
|
|
|
|
# https://github.com/appveyor/ci/issues/1824
|
|
|
|
tail --pid=$BUILD_PID -n +1 -f ../$BUILD_PREFIX-mingw32/build.log | \
|
|
|
|
sed -e 's/\d027\[K//g' \
|
|
|
|
-e 's/\d027\[m/\d027[0m/g' \
|
|
|
|
-e 's/\d027\[01\([m;]\)/\d027[1\1/g' &
|
2017-10-05 04:16:49 -07:00
|
|
|
TAIL_PID=$!
|
2017-09-30 06:23:32 -07:00
|
|
|
wait $BUILD_PID
|
|
|
|
STATUS=$?
|
2017-10-05 04:16:49 -07:00
|
|
|
wait $TAIL_PID
|
2017-09-30 06:23:32 -07:00
|
|
|
exit $STATUS
|
2017-09-29 07:02:42 -07:00
|
|
|
;;
|
|
|
|
esac
|