This repository has been archived by the owner on Feb 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
windows-platform.sh
144 lines (130 loc) · 4.94 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/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 shake.exe, HsColour.exe (maybe 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/Haskell/bin:/c/Program Files/Haskell Platform/2014.2.0.0/lib/extralibs/bin"
NSIS_BIN="/c/Program Files (x86)/NSIS"
GHC_BINDIST=build/ghc-bindist/local
HPTOOL=hptool/dist/build/hptool/hptool.exe
if ( cabal sandbox --help >/dev/null 2>&1 ) ; 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
else
if ( cabal install --dry-run --only-dependencies | grep -q 'would be installed' ) ; then
echo '=== pre-requisite packages for hptool are not installed'
echo ' run the following:'
echo ' cd hptool ; cabal install --only-dependencies'
exit 1
fi
fi
echo '***'
echo '*** Building hptool'
echo '***'
(cd hptool; cabal build)
CWD=`pwd`
MINGW=$GHC_BINDIST/mingw
# A clean, well-lighted, 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; }
echo "> cabal --version"
cabal --version
echo "> which haddock"
which haddock
echo "> haddock --version"
haddock --version
# 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 \
-a -d winExternalSrc/msys/i386/usr \
-a -d winExternalSrc/msys/x86_64/usr \
\) ]
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 " * MSys2 'usr' directory, as seen in git-for-windows(tm)"
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>
msys/
i386/
usr/{bin,lib,libexec,share,ssl}
x86_64/
usr/{bin,lib,libexec,share,ssl}
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