| ... |
... |
@@ -7,6 +7,10 @@ |
|
7
|
7
|
#
|
|
8
|
8
|
# Currently, this script can only test that the in-tree `base` can be *built*
|
|
9
|
9
|
# with certain *released* GHCs.
|
|
|
10
|
+#
|
|
|
11
|
+# This script can run on both Unix and Windows. Since GHC’s infrastructure does
|
|
|
12
|
+# not offer Cabal pre-installed on Windows, this script uses a `Setup.hs` file
|
|
|
13
|
+# to build `base`, which works across operating systems.
|
|
10
|
14
|
|
|
11
|
15
|
# Establish error propagation
|
|
12
|
16
|
set -e -o pipefail
|
| ... |
... |
@@ -22,25 +26,30 @@ platform=$1 |
|
22
|
26
|
shift
|
|
23
|
27
|
ghc_versions=$*
|
|
24
|
28
|
|
|
|
29
|
+# Save project root
|
|
|
30
|
+project_root=$PWD
|
|
|
31
|
+
|
|
25
|
32
|
# Create directories for other GHCs
|
|
26
|
33
|
mkdir other-ghcs
|
|
27
|
34
|
mkdir other-ghcs/src
|
|
28
|
35
|
mkdir other-ghcs/opt
|
|
29
|
36
|
|
|
30
|
|
-# Save project root
|
|
31
|
|
-project_root=$PWD
|
|
32
|
|
-
|
|
33
|
|
-# Create Cabal file for `base`
|
|
|
37
|
+# Amend the `base` sources
|
|
34
|
38
|
cd libraries/base
|
|
35
|
39
|
sed -E -e 's/^( *ghc-internal)[^[:alnum:]-].*(,|$)/\1\2/' \
|
|
36
|
40
|
< base.cabal.in \
|
|
37
|
41
|
> base.cabal
|
|
|
42
|
+cat <<. >Setup.hs
|
|
|
43
|
+import Distribution.Simple
|
|
|
44
|
+main = defaultMain
|
|
|
45
|
+.
|
|
38
|
46
|
cd ${project_root}
|
|
39
|
47
|
|
|
40
|
48
|
# Build `base` with the different GHCs
|
|
41
|
49
|
for ghc_version in ${ghc_versions}
|
|
42
|
50
|
do
|
|
43
|
51
|
# Install the GHC
|
|
|
52
|
+ ghc_installation=${project_root}/other-ghcs/opt/${ghc_version}
|
|
44
|
53
|
cd other-ghcs/src
|
|
45
|
54
|
archive_file=ghc-${ghc_version}-${platform}.tar.xz
|
|
46
|
55
|
curl https://downloads.haskell.org/~ghc/${ghc_version}/${archive_file} \
|
| ... |
... |
@@ -49,18 +58,18 @@ do |
|
49
|
58
|
if [ -f ghc-${ghc_version}-*/configure ]
|
|
50
|
59
|
then # Unix
|
|
51
|
60
|
cd ghc-${ghc_version}-*
|
|
52
|
|
- ./configure --prefix "${project_root}/other-ghcs/opt/${ghc_version}"
|
|
|
61
|
+ ./configure --prefix "${ghc_installation}"
|
|
53
|
62
|
make install
|
|
54
|
63
|
else # Windows
|
|
55
|
|
- mv ghc-${ghc_version}-* "${project_root}/other-ghcs/opt/${ghc_version}"
|
|
|
64
|
+ mv ghc-${ghc_version}-* "${ghc_installation}"
|
|
56
|
65
|
fi
|
|
57
|
66
|
cd ${project_root}
|
|
58
|
67
|
|
|
59
|
68
|
# Build `base` with the installed GHC
|
|
60
|
69
|
cd libraries/base
|
|
61
|
|
- cabal build \
|
|
62
|
|
- --with-compiler "${project_root}/other-ghcs/opt/${ghc_version}/bin/ghc" \
|
|
63
|
|
- --allow-boot-library-installs \
|
|
|
70
|
+ "${ghc_installation}/bin/runghc" Setup.hs configure \
|
|
|
71
|
+ --with-compiler "${ghc_installation}/bin/ghc" \
|
|
64
|
72
|
-O0
|
|
|
73
|
+ "${ghc_installation}/bin/runghc" Setup.hs build
|
|
65
|
74
|
cd ${project_root}
|
|
66
|
75
|
done |