forked from ocaml/flexdll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor_build.sh
executable file
·114 lines (88 loc) · 2.9 KB
/
appveyor_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
function run {
NAME=$1
shift
echo "-=-=- $NAME -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
"$@"
CODE=$?
if [ $CODE -ne 0 ]; then
echo "-=-=- $NAME failed! -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
exit $CODE
else
echo "-=-=- End of $NAME -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
fi
}
function configure_ocaml {
cp config/m-nt.h $HEADER_DIR/m.h
cp config/s-nt.h $HEADER_DIR/s.h
sed -e "s|PREFIX=.*|PREFIX=$OCAMLROOT|" \
-e "s|OTHERLIBRARIES=.*|OTHERLIBRARIES=|" \
-e "s|WITH_DEBUGGER=.*|WITH_DEBUGGER=|" \
-e "s|WITH_OCAMLDOC=.*|WITH_OCAMLDOC=|" \
config/Makefile.msvc64 > $CONFIG_DIR/Makefile
#run "Content of config/Makefile" cat $CONFIG_DIR/Makefile
}
echo ** OCAMLROOT=$OCAMLROOT
#echo "APPVEYOR_PULL_REQUEST_NUMBER = $APPVEYOR_PULL_REQUEST_NUMBER"
#echo "APPVEYOR_PULL_REQUEST_TITLE = $APPVEYOR_PULL_REQUEST_TITLE"
#echo "APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME = $APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME"
#echo "APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH = $APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"
#echo "APPVEYOR_PULL_REQUEST_HEAD_COMMIT = $APPVEYOR_PULL_REQUEST_HEAD_COMMIT"
#echo "APPVEYOR_REPO_PROVIDER = $APPVEYOR_REPO_PROVIDER"
#echo "APPVEYOR_REPO_NAME = $APPVEYOR_REPO_NAME"
#echo "APPVEYOR_REPO_BRANCH = $APPVEYOR_REPO_BRANCH"
cd $APPVEYOR_BUILD_FOLDER
git tag merge
# Do not perform end-of-line conversion
git config --global core.autocrlf false
git clone https://github.com/ocaml/ocaml.git --branch $OCAMLBRANCH --depth 1 --recurse-submodules ocaml
cd ocaml
MAKEOCAML=make
CONFIG_DIR=config
HEADER_DIR=runtime/caml
case $OCAMLBRANCH in
4.03|4.04)
MAKEOCAML="make -f Makefile.nt"
HEADER_DIR=config
;;
4.05)
HEADER_DIR=config
;;
4.06|4.07)
HEADER_DIR=byterun/caml
esac
if [ $OCAMLBRANCH = "4.03" ] ; then
sed -i -e "s/:=.*/:=/" config/Makefile.msvc64
fi
configure_ocaml
if [ ! -f $OCAMLROOT/STAMP ] || [ "$(git rev-parse HEAD)" != "$(cat $OCAMLROOT/STAMP)" ]; then
run "make world.opt" $MAKEOCAML flexdll world.opt
run "make install" $MAKEOCAML install
git rev-parse HEAD > $OCAMLROOT/STAMP
fi
export CAML_LD_LIBRARY_PATH=$OCAMLROOT/lib/stublibs
pushd $APPVEYOR_BUILD_FOLDER
run "make flexlink.exe" make MSVC_DETECT=0 flexlink.exe
CHAINS="mingw mingw64 cygwin cygwin64 msvc msvc64"
for CHAIN in $CHAINS; do
run "make build_$CHAIN" make build_$CHAIN
done
for CHAIN in $CHAINS; do
run "make demo_$CHAIN" make demo_$CHAIN
done
popd
if [ "$SKIP_OCAML_TEST" != no ] ; then
exit 0
fi
if [ -f ocamlopt.opt ] ; then
git clean -dfx > /dev/null
cd flexdll
git clean -dfx > /dev/null
cd ..
configure_ocaml
fi
cd flexdll
git remote add local $(echo "$APPVEYOR_BUILD_FOLDER"| cygpath -f -) -f --tags
run "git checkout $APPVEYOR_REPO_COMMIT" git checkout merge
cd ..
run "make world" $MAKEOCAML flexdll world