forked from haskell/haskell-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows-platform.sh
124 lines (110 loc) · 4.11 KB
/
windows-platform.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
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
TAR_FILE=$1
tar_name=${TAR_FILE##*/}
tar_vers=${tar_name#*-}
GHC_VERS=${tar_vers%%-*}
# These may need to be edited to suit your specific environment
# MSYS_BIN is needed on path for configure scripts;
# HASK_BIN is needed on path for cabal.exe
# NSIS_BIN is needed on path for makensisw.exe
MSYS_BIN="/c/Program Files (x86)/MinGW/msys/1.0/bin"
HASK_BIN="/c/Program Files (x86)/Haskell/bin"
NSIS_BIN="/c/Program Files (x86)/NSIS"
HPTOOL=hptool/dist/build/hptool/hptool.exe
if [ \! \( -e $HPTOOL -a -x $HPTOOL \) ]
then
if [ \! -d hptool/.cabal-sandbox ]
then
echo '***'
echo '*** Setting up sandbox for hptool'
echo '***'
cabal update
(cd hptool; cabal sandbox init; cabal install --only-dependencies)
fi
echo '***'
echo '*** Building hptool'
echo '***'
(cd hptool; cabal build)
fi
CWD=`pwd`
GHC_BINDIST=build/ghc-bindist/local
MINGW=$GHC_BINDIST/mingw
# A clean, cruft-free PATH
export PATH=$CWD/$GHC_BINDIST/bin:$CWD/$MINGW/bin:$MSYS_BIN:$NSIS_BIN:$HASK_BIN
which cabal ||
{ echo "Could not find cabal.exe on PATH!"; echo "PATH=$PATH"; exit 1; }
which makensisw ||
{ echo "Could not find makensisw.exe on PATH!"; echo "PATH=$PATH"; exit 1; }
# Make sure makensisw.exe is compiled with support for large strings
# makensisw="/c/Program\ Files\ \(x86\)/NSIS/Orig/makensis //HDRINFO"
nsis_max_strlen=`makensis //HDRINFO | grep 'NSIS_MAX_STRLEN' | awk '{ match($0, /NSIS_MAX_STRLEN=([0-9]+)/, x); if(x[1] != "") print x[1] }'`
if ! (( nsis_max_strlen >= 8192))
then
echo '***'
echo 'Please use the NSIS which has been patched for large strings.'
echo 'The NSIS found on PATH was built with the following:'
echo " NSIS_MAX_STRLEN='$nsis_max_strlen'"
exit 1
fi
# For now, we are just going to assume a subdirectory in the current
# top-level directory (i.e., where this script is), called "winExternalSrc",
# must exist and must contain glut and GHC user guide files.
#
# Test that assumption.
if [ \! \( -d winExternalSrc \
-a -d winExternalSrc/glut \
-a -d winExternalSrc/glut/include \
-a -e winExternalSrc/glut/include/glut.h \
-a -d winExternalSrc/glut/lib \
-a -d winExternalSrc/glut/lib/i386 \
-a -e winExternalSrc/glut/lib/i386/libglut32.a \
-a -e winExternalSrc/glut/lib/i386/glut32.dll \
-a -d winExternalSrc/glut/lib/x86_64 \
-a -e winExternalSrc/glut/lib/x86_64/libglut32.a \
-a -e winExternalSrc/glut/lib/x86_64/glut32.dll \
-a -d winExternalSrc/doc \
-a -e winExternalSrc/doc/users_guide.ps \
-a -e winExternalSrc/doc/users_guide.pdf \
-a -d winExternalSrc/doc/html \
-a -d winExternalSrc/winghci \
-a -e winExternalSrc/winghci/winghci.exe \
\) ]
then
echo '***'
echo 'The Haskell Platform for Windows needs some pre-built components'
echo 'to be provided:'
echo ' * winghci (can copy from a previous HP release)'
echo ' * GLUT library & DLL (e.g,. from freeglut-MinGW-2.8.1-1.mp.zip)'
echo " * GHC user's guide (matching the GHC in this HP)"
echo ''
echo 'Please create a subdirectory in this directory (where this script'
echo 'is), with the following contents and structure:'
cat <<EOF
./winExternalSrc/
glut/
include/
glut.h
<and any other headers needed for this particular GLUT>
lib/
i386/
libglut32.a
glut32.dll
x86_64/
libglut32.a
glut32.dll
doc/
users_guide.ps
users_guide.pdf
html/
<untar of users_guide.html.tar.bz2>
winghci/
winghci.exe
<and any other DLL, etc. needed to run this particular winghci>
EOF
exit 1
fi
echo '***'
echo "*** Running hptool for $GHC_VERS"
echo '***'
# For Windows platforms, do not build the source tarball
$HPTOOL "$@" build-local build-product