Skip to content

Commit

Permalink
AppVeyor Test Scripts
Browse files Browse the repository at this point in the history
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
  • Loading branch information
dra27 committed Jul 27, 2017
1 parent f4841cc commit 4a90774
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
configure eol=lf
*.sh eol=lf
*.patch eol=lf
104 changes: 104 additions & 0 deletions appveyor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash

MODE=$1
PORT=$2

OCAML_VERSION=4.04.2
# Increment whenever the OCaml version or a package is updated to invalidate the caches
SERIAL=1

ROOT=C:/OCaml
ROOT_CYG=$(echo $ROOT | cygpath -f -)
APPVEYOR_BUILD_FOLDER=$(echo $APPVEYOR_BUILD_FOLDER | cygpath -f -)

case $MODE in
prepare)
if [[ ! -e $ROOT_CYG/src/version || $(cat $ROOT_CYG/src/version) -ne $SERIAL ]] ; then
rm -rf $ROOT_CYG
mkdir -p $ROOT_CYG/src
cd $ROOT_CYG/src
git clone https://github.com/ocaml/ocaml.git
cd ocaml
git checkout $OCAML_VERSION
for i in mingw mingw64 msvc msvc64 ; do
git worktree add ../../$i/src/ocaml -b build-$i
pushd ../../$i/src/ocaml
git submodule update --init
popd
done
cd ..
appveyor DownloadFile "https://github.com/mjambon/biniou/archive/v1.2.0.tar.gz" -FileName biniou-1.2.0.tar.gz
appveyor DownloadFile "https://github.com/mjambon/cppo/archive/v1.5.0.tar.gz" -FileName cppo-1.5.0.tar.gz
appveyor DownloadFile "https://github.com/mjambon/easy-format/archive/v1.2.0.tar.gz" -FileName easy-format-1.2.0.tar.gz
appveyor DownloadFile "http://download.camlcity.org/download/findlib-1.7.3.tar.gz" -FileName findlib-1.7.3.tar.gz
appveyor DownloadFile "https://github.com/janestreet/jbuilder/archive/1.0+beta11.tar.gz" -FileName jbuilder-1.0-beta11.tar.gz
appveyor DownloadFile "https://github.com/ocaml/ocamlbuild/archive/0.11.0.tar.gz" -FileName ocamlbuild-0.11.0.tar.gz
appveyor DownloadFile "https://github.com/mjambon/yojson/archive/v1.4.0.tar.gz" -FileName yojson-1.4.0.tar.gz
cp $APPVEYOR_BUILD_FOLDER/appveyor/*.patch .
echo $SERIAL>$ROOT_CYG/src/version
fi

if [[ ! -d $ROOT_CYG/$PORT/bin ]] ; then
cd $ROOT_CYG/$PORT/src/ocaml
cp config/s-nt.h config/s.h
cp config/m-nt.h config/m.h
sed -e "s|PREFIX=[^\r]*|PREFIX=$ROOT/$PORT|" config/Makefile.$PORT > config/Makefile
export PATH=$ROOT_CYG/$PORT/bin:$PATH
eval $(tools/msvs-promote-path)
make -f Makefile.nt flexdll world.opt install
cd ..
set -e
tar -xzf $ROOT_CYG/src/findlib-1.7.3.tar.gz
cd findlib-1.7.3
# Upstreamed; not merged
patch -p1 -i $ROOT_CYG/src/findlib-1.7.3.patch
# Not yet upstreamed
sed -i -e 's/\.a/$(LIB_SUFFIX)/g' src/findlib/Makefile
./configure
make all opt
make install
cd ..
tar -xzf $ROOT_CYG/src/jbuilder-1.0-beta10.tar.gz
cd jbuilder-1.0-beta10
ocaml bootstrap.ml
./boot.exe
cp _build/default/bin/main.exe $ROOT_CYG/$PORT/bin/jbuilder.exe
cd ..
tar -xzf $ROOT_CYG/src/easy-format-1.2.0.tar.gz
cd easy-format-1.2.0
# Upstreaming not required: master has been converted to jbuilder
patch -p1 -i $ROOT_CYG/src/easy-format-1.2.0.patch
make
make install
cd ..
tar -xzf $ROOT_CYG/src/biniou-1.2.0.tar.gz
cd biniou-1.2.0
make
ocamlfind install biniou _build/install/default/lib/biniou/*
cd ..
tar -xzf $ROOT_CYG/src/ocamlbuild-0.11.0.tar.gz
cd ocamlbuild-0.11.0
# Manually apply fix from a8d2e8
sed -i -e 's/pack\.o/pack$(EXT_OBJ)/g' Makefile
make -f configure.make all OCAMLBUILD_PREFIX=$ROOT_CYG/$PORT OCAMLBUILD_BINDIR=$ROOT_CYG/$PORT/bin OCAMLBUILD_LIBDIR=$(ocamlfind printconf path) OCAML_NATIVE=true OCAML_NATIVE_TOOLS=true
make all findlib-install
cd ..
tar -xzf $ROOT_CYG/src/cppo-1.5.0.tar.gz
cd cppo-1.5.0
make PREFIX=$ROOT_CYG/$PORT opt install-bin
cd ..
tar -xzf $ROOT_CYG/src/yojson-1.4.0.tar.gz
cd yojson-1.4.0
make
ocamlfind install yojson _build/install/default/lib/yojson/*
fi
;;
build)
cp -a $APPVEYOR_BUILD_FOLDER $APPVEYOR_BUILD_FOLDER/../merlin-$PORT
cd $APPVEYOR_BUILD_FOLDER/../merlin-$PORT
./configure --prefix $ROOT_CYG/$PORT
make
make install
# make test
;;
esac
47 changes: 47 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
platform:
- x64

clone_depth: 1

environment:
global:
CYG_ROOT: C:/cygwin
CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
CYG_CACHE: C:/cygwin/var/cache/setup

cache:
- C:\cygwin\var\cache\setup
- C:\OCaml

install:
# Make sure the Cygwin path comes before the Git one (otherwise
# cygpath behaves crazily), but after the MSVC one.
- set Path=C:\cygwin\bin;%Path%
- '%CYG_ROOT%\bin\bash -lc "cygcheck -dc cygwin"'
- '"%CYG_ROOT%\setup-x86.exe" -qgnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P diffutils -P make -P mingw64-i686-gcc-core -P mingw64-x86_64-gcc-core > NUL'
- '%CYG_ROOT%\bin\bash -lc "cygcheck -dc cygwin"'
- set OCAML_PREV_PATH=%PATH%
- set OCAML_PREV_LIB=%LIB%
- set OCAML_PREV_INCLUDE=%INCLUDE%

build_script:
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare mingw"'
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare mingw64"'
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare msvc"'
- set PATH=%OCAML_PREV_PATH%
- set LIB=%OCAML_PREV_LIB%
- set INCLUDE=%OCAML_PREV_INCLUDE%
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh prepare msvc64"'
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build msvc64"'
- set PATH=%OCAML_PREV_PATH%
- set LIB=%OCAML_PREV_LIB%
- set INCLUDE=%OCAML_PREV_INCLUDE%
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build msvc"'
- set PATH=%OCAML_PREV_PATH%
- set LIB=%OCAML_PREV_LIB%
- set INCLUDE=%OCAML_PREV_INCLUDE%
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build mingw"'
- '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor.sh build mingw64"'
29 changes: 29 additions & 0 deletions appveyor/easy-format-1.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff -Naur a/Makefile b/Makefile
--- a/Makefile 2015-12-07 21:58:29.000000000 +0000
+++ b/Makefile 2017-07-21 14:19:28.720009800 +0100
@@ -3,6 +3,7 @@

NATDYNLINK := $(shell if [ -f `ocamlfind ocamlc -where`/dynlink.cmxa ]; \
then echo YES; else echo NO; fi)
+EXT_OBJ = $(shell ocamlc -config | sed -ne "s/ext_obj: //p" | tr -d '\r')

ifeq "${NATDYNLINK}" "YES"
CMXS=easy_format.cmxs
@@ -53,7 +54,7 @@
caml2html easy_format_example.ml -t -o easy_format_example.html

soft-clean:
- rm -f *.cm[iox] *.cmxs *.o *.annot \
+ rm -f *.cm[iox] *.cmxs *.o *.obj *.annot \
test_easy_format lambda_example simple_example \
bytecode nativecode

@@ -65,7 +66,7 @@

COMMON_INSTALL_FILES = META easy_format.cmi easy_format.mli
BC_INSTALL_FILES = easy_format.cmo
-NC_INSTALL_FILES = easy_format.cmx easy_format.o $(CMXS)
+NC_INSTALL_FILES = easy_format.cmx easy_format$(EXT_OBJ) $(CMXS)

install:
echo "version = \"$(VERSION)\"" > META; cat META.tpl >> META
22 changes: 22 additions & 0 deletions appveyor/findlib-1.7.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/configure b/configure
index 34c5115..e801760 100755
--- a/configure
+++ b/configure
@@ -191,7 +191,7 @@ for tool in sed awk ocaml ocamlc uname rm make cat m4 dirname basename; do
fi
done

-lib_suffix=`ocamlc -config 2>/dev/null|grep '^ext_lib'|sed 's/ext_lib: //'`
+lib_suffix=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^ext_lib: //p'`

# Check for Cygwin:

@@ -225,7 +225,7 @@ use_cygpath=0
# Whether we have to translate Unix paths to/from Windows paths.

if [ -z "$system" ]; then
- system=`ocamlc -config 2>/dev/null|grep '^system'|sed 's/system: //'`
+ system=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^system: //p'`
# This may be
# - mingw or mingw64
# - win32

0 comments on commit 4a90774

Please sign in to comment.