Skip to content

Commit f754c5b

Browse files
authored
Cleanup iserv patches (#439)
This commit cleans up iserv-related patches, especially for GHC 8.4, by making sure they are exactly changes made upstream (only with merge conflicts resolved). Overall, there are three groups of patches now: 1. move-iserv is merely an upstream change that was merged between 8.4 and 8.6. The previous patch was probably some development version, now it is the same as upstream. 2. iserv-autoconf was merged upstream between 8.6 and 8.8. The patch consists entirely of replacing version numbers with variables, therefore applying the same patch to 8.4 and 8.6 causes conflicts, so we have two versions of the same patch for simplicity. Additionally, the 8.6 is different from the upstream one in that it does not remove the .cabal files, see the commit description in the patch for details. 3. iserv-cleanup was merged between 8.8 and 8.10. It applies cleanly to 8.8 and 8.6, however there is conflict in one line when applying it to 8.4. As a workaround, when applying this patch to 8.4 we first prepare the source to avoid the conflict, and then undo this change. This allows us to use the same main patch for 8.4 as for 8.6 and 8.8. Also, in all patches changes to .gitignore were manually removed, as this file does not exist in the Nix checkout of src and this causes the patches to fail.
1 parent 29e42da commit f754c5b

7 files changed

+678
-313
lines changed

overlays/bootstrap.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ in {
6868
# will be applied to most versions of the GHC anyway (reordering the patches
6969
# results in rebuilds of GHC and reduces sharing in /nix/store).
7070
in fromUntil "8.4.4" "8.6" ./patches/ghc/ghc-8.4.4-reinstallable-lib-ghc.patch
71-
++ until "8.6" ./patches/ghc/move-iserv-8.4.2.patch
71+
++ until "8.6" ./patches/ghc/iserv-move-8.4.1.patch # 6fbe5f274ba84181f5db50901639ae382ef68c4b -- merged; ghc-8.6.1
7272
++ until "8.6" ./patches/ghc/hsc2hs-8.4.2.patch
7373
++ until "8.6" ./patches/ghc/various-8.4.2.patch
7474
++ until "8.6" ./patches/ghc/lowercase-8.4.2.patch
@@ -77,9 +77,11 @@ in {
7777
++ until "8.6" ./patches/ghc/outputtable-assert-8.4.patch
7878
++ fromUntil "8.6" "8.6.4" ./patches/ghc/MR148--T16104-GhcPlugins.patch
7979
++ until "8.6.4" ./patches/ghc/MR95--ghc-pkg-deadlock-fix.patch
80-
++ fromUntil "8.6" "8.8" ./patches/ghc/iserv-proxy-cleanup.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/250 -- merged; ghc-8.8.1
81-
++ from "8.6" ./patches/ghc/iserv-proxy-cleanup-2.patch
82-
++ from "8.8" ./patches/ghc/iserv-proxy-cleanup-3.patch
80+
++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-autoconf-8.4.1.patch # (same as below, but based on 8.4)
81+
++ fromUntil "8.6" "8.8" ./patches/ghc/iserv-autoconf-8.6.1.patch # 8f9f52d8e421ce544d5437a93117545d52d0eabd -- merged; ghc-8.8.1
82+
++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-cleanup-8.8.1-prepare-8.4.1.patch # (prepare for below; see patch for details)
83+
++ until "8.10" ./patches/ghc/iserv-cleanup-8.8.1.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/250 -- merged; ghc-8.10.1
84+
++ fromUntil "8.4" "8.6" ./patches/ghc/iserv-cleanup-8.8.1-revert-8.4.1.patch # (revert prepare)
8385
++ fromUntil "8.2" "8.8" ./patches/ghc/MR545--ghc-pkg-databases.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/545 -- merged; ghc-8.8.1
8486
++ fromUntil "8.6" "8.8" ./patches/ghc/outputtable-assert-8.6.patch
8587
++ fromUntil "8.6.4" "8.8" ./patches/ghc/ghc-8.6.4-reenable-th-qq-in-stage1.patch
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
From 14c09e8eca430cc0dea2c23d4ef0f399b3a52626 Mon Sep 17 00:00:00 2001
2+
From: Ryan Scott <[email protected]>
3+
Date: Mon, 26 Nov 2018 12:59:30 -0500
4+
Subject: [PATCH] Use autoconf to generate version numbers for libiserv and
5+
friends
6+
7+
Summary:
8+
Currently, the version numbers for `libiserv`, `iserv`, and
9+
`iserv-proxy` are hard-coded directly into their `.cabal` files.
10+
These are easy to forget to update, and in fact, this has already
11+
happened once (see #15866). Let's use `autoconf` to do this for us
12+
so that it is not forgotten in the future.
13+
14+
Test Plan: ./validate
15+
16+
Reviewers: bgamari
17+
18+
Reviewed By: bgamari
19+
20+
Subscribers: rwbarton, erikd, carter
21+
22+
GHC Trac Issues: #15866
23+
24+
Differential Revision: https://phabricator.haskell.org/D5302
25+
---
26+
.gitignore | 3 +++
27+
configure.ac | 2 +-
28+
.../libiserv/{libiserv.cabal => libiserv.cabal.in} | 8 ++++++--
29+
.../{iserv-proxy.cabal => iserv-proxy.cabal.in} | 8 ++++++--
30+
utils/iserv/{iserv.cabal => iserv.cabal.in} | 10 +++++++---
31+
5 files changed, 23 insertions(+), 8 deletions(-)
32+
rename libraries/libiserv/{libiserv.cabal => libiserv.cabal.in} (80%)
33+
rename utils/iserv-proxy/{iserv-proxy.cabal => iserv-proxy.cabal.in} (91%)
34+
rename utils/iserv/{iserv.cabal => iserv.cabal.in} (81%)
35+
36+
diff --git a/.gitignore b/.gitignore
37+
index 0d3a3a24d8..f4f8529f0a 100644
38+
--- a/.gitignore
39+
+++ b/.gitignore
40+
@@ -148,6 +148,7 @@ _darcs/
41+
/libraries/hslogo-16.png
42+
/libraries/index-frames.html
43+
/libraries/index.html
44+
+/libraries/libiserv/libiserv.cabal
45+
/libraries/minus.gif
46+
/libraries/ocean.css
47+
/libraries/plus.gif
48+
@@ -173,6 +174,8 @@ _darcs/
49+
/testsuite_summary*.txt
50+
/testsuite*.xml
51+
/testlog*
52+
+/utils/iserv/iserv.cabal
53+
+/utils/iserv-proxy/iserv-proxy.cabal
54+
/utils/mkUserGuidePart/mkUserGuidePart.cabal
55+
/utils/runghc/runghc.cabal
56+
/utils/gen-dll/gen-dll.cabal
57+
diff --git a/configure.ac b/configure.ac
58+
index 30241a5734..a5d2026434 100644
59+
--- a/configure.ac
60+
+++ b/configure.ac
61+
@@ -1298,7 +1298,7 @@ checkMake380() {
62+
checkMake380 make
63+
checkMake380 gmake
64+
65+
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
66+
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/libiserv/libiserv.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
67+
AC_OUTPUT
68+
[
69+
if test "$print_make_warning" = "true"; then
70+
diff --git a/libraries/libiserv/libiserv.cabal b/libraries/libiserv/libiserv.cabal.in
71+
similarity index 80%
72+
rename from libraries/libiserv/libiserv.cabal
73+
rename to libraries/libiserv/libiserv.cabal.in
74+
index 43f1180073..386f26c034 100644
75+
--- a/libraries/libiserv/libiserv.cabal
76+
+++ b/libraries/libiserv/libiserv.cabal.in
77+
@@ -1,5 +1,9 @@
78+
+-- WARNING: libiserv.cabal is automatically generated from libiserv.cabal.in by
79+
+-- ../../configure. Make sure you are editing libiserv.cabal.in, not
80+
+-- libiserv.cabal.
81+
+
82+
Name: libiserv
83+
-Version: 8.4
84+
+Version: @ProjectVersionMunged@
85+
Copyright: XXX
86+
License: BSD3
87+
-- XXX License-File: LICENSE
88+
@@ -25,7 +29,7 @@ Library
89+
bytestring >= 0.10 && < 0.11,
90+
containers >= 0.5 && < 0.6,
91+
deepseq >= 1.4 && < 1.5,
92+
- ghci == 8.4.*
93+
+ ghci == @ProjectVersionMunged@
94+
if flag(network)
95+
Exposed-Modules: Remote.Message
96+
, Remote.Slave
97+
diff --git a/utils/iserv-proxy/iserv-proxy.cabal b/utils/iserv-proxy/iserv-proxy.cabal.in
98+
similarity index 91%
99+
rename from utils/iserv-proxy/iserv-proxy.cabal
100+
rename to utils/iserv-proxy/iserv-proxy.cabal.in
101+
index fa25c77794..2da65ae556 100644
102+
--- a/utils/iserv-proxy/iserv-proxy.cabal
103+
+++ b/utils/iserv-proxy/iserv-proxy.cabal.in
104+
@@ -1,5 +1,9 @@
105+
+-- WARNING: iserv-proxy.cabal is automatically generated from iserv-proxy.cabal.in by
106+
+-- ../../configure. Make sure you are editing iserv-proxy.cabal.in, not
107+
+-- iserv-proxy.cabal.
108+
+
109+
Name: iserv-proxy
110+
-Version: 8.4
111+
+Version: @ProjectVersion@
112+
Copyright: XXX
113+
License: BSD3
114+
-- XXX License-File: LICENSE
115+
@@ -75,4 +79,4 @@ Executable iserv-proxy
116+
directory >= 1.3 && < 1.4,
117+
network >= 2.6,
118+
filepath >= 1.4 && < 1.5,
119+
- libiserv == 8.4
120+
+ libiserv == @ProjectVersionMunged@
121+
diff --git a/utils/iserv/iserv.cabal b/utils/iserv/iserv.cabal.in
122+
similarity index 81%
123+
rename from utils/iserv/iserv.cabal
124+
rename to utils/iserv/iserv.cabal.in
125+
index 768c0e0f83..d4234d4621 100644
126+
--- a/utils/iserv/iserv.cabal
127+
+++ b/utils/iserv/iserv.cabal.in
128+
@@ -1,5 +1,9 @@
129+
+-- WARNING: iserv.cabal is automatically generated from iserv.cabal.in by
130+
+-- ../../configure. Make sure you are editing iserv.cabal.in, not
131+
+-- iserv.cabal.
132+
+
133+
Name: iserv
134+
-Version: 8.4
135+
+Version: @ProjectVersion@
136+
Copyright: XXX
137+
License: BSD3
138+
-- XXX License-File: LICENSE
139+
@@ -35,8 +39,8 @@ Executable iserv
140+
bytestring >= 0.10 && < 0.11,
141+
containers >= 0.5 && < 0.6,
142+
deepseq >= 1.4 && < 1.5,
143+
- ghci == 8.4.*,
144+
- libiserv == 8.4
145+
+ ghci == @ProjectVersionMunged@,
146+
+ libiserv == @ProjectVersionMunged@
147+
148+
if os(windows)
149+
Cpp-Options: -DWINDOWS
150+
--
151+
2.24.1
152+

overlays/patches/ghc/iserv-proxy-cleanup.patch renamed to overlays/patches/ghc/iserv-autoconf-8.6.1.patch

Lines changed: 73 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,79 @@
1+
From c994c306f2e2f0ebcd8141c2c580ee7ed464cb7d Mon Sep 17 00:00:00 2001
2+
From: Kirill Elagin <[email protected]>
3+
Date: Thu, 6 Feb 2020 21:54:03 -0500
4+
Subject: [PATCH] Use autoconf to generate version numbers for libiserv and
5+
friends
6+
7+
kirelagin: This is the upstream commit modified not to remove original
8+
.cabal files. Before this change those files contained GHC versions and
9+
this caused conflicts when trying to apply the same patch to different
10+
versions of GHC. In this form the patch can be cleanly applied to any
11+
minor version of GHC 8.6.
12+
13+
Original commit description follows.
14+
15+
---
16+
17+
Summary:
18+
Currently, the version numbers for `libiserv`, `iserv`, and
19+
`iserv-proxy` are hard-coded directly into their `.cabal` files.
20+
These are easy to forget to update, and in fact, this has already
21+
happened once (see #15866). Let's use `autoconf` to do this for us
22+
so that it is not forgotten in the future.
23+
24+
Test Plan: ./validate
25+
26+
Reviewers: bgamari
27+
28+
Reviewed By: bgamari
29+
30+
Subscribers: rwbarton, erikd, carter
31+
32+
GHC Trac Issues: #15866
33+
34+
Differential Revision: https://phabricator.haskell.org/D5302
35+
---
36+
.gitignore | 3 +
37+
configure.ac | 2 +-
38+
libraries/libiserv/libiserv.cabal.in | 43 ++++++++++++++
39+
utils/iserv-proxy/iserv-proxy.cabal.in | 82 ++++++++++++++++++++++++++
40+
utils/iserv/iserv.cabal.in | 48 +++++++++++++++
41+
5 files changed, 177 insertions(+), 1 deletion(-)
42+
create mode 100644 libraries/libiserv/libiserv.cabal.in
43+
create mode 100644 utils/iserv-proxy/iserv-proxy.cabal.in
44+
create mode 100644 utils/iserv/iserv.cabal.in
45+
46+
diff --git a/.gitignore b/.gitignore
47+
index 7e2425c964..da0254f26a 100644
48+
--- a/.gitignore
49+
+++ b/.gitignore
50+
@@ -153,6 +153,7 @@ _darcs/
51+
/libraries/hslogo-16.png
52+
/libraries/index-frames.html
53+
/libraries/index.html
54+
+/libraries/libiserv/libiserv.cabal
55+
/libraries/minus.gif
56+
/libraries/ocean.css
57+
/libraries/plus.gif
58+
@@ -178,6 +179,8 @@ _darcs/
59+
/testsuite_summary*.txt
60+
/testsuite*.xml
61+
/testlog*
62+
+/utils/iserv/iserv.cabal
63+
+/utils/iserv-proxy/iserv-proxy.cabal
64+
/utils/mkUserGuidePart/mkUserGuidePart.cabal
65+
/utils/runghc/runghc.cabal
66+
/utils/gen-dll/gen-dll.cabal
167
diff --git a/configure.ac b/configure.ac
2-
index 846924727d..0e67c1051a 100644
68+
index 5fd3441563..d7d8d192a9 100644
369
--- a/configure.ac
470
+++ b/configure.ac
571
@@ -1334,7 +1334,7 @@ checkMake380() {
672
checkMake380 make
773
checkMake380 gmake
874

975
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
10-
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/remote-iserv/remote-iserv.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
76+
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
1177
AC_OUTPUT
1278
[
1379
if test "$print_make_warning" = "true"; then
@@ -60,90 +126,6 @@ index 0000000000..31eaaeb838
60126
+ Cpp-Options: -DWINDOWS
61127
+ else
62128
+ Build-Depends: unix >= 2.7 && < 2.9
63-
diff --git a/utils/iserv-proxy/iserv-proxy.cabal b/utils/iserv-proxy/iserv-proxy.cabal
64-
deleted file mode 100644
65-
index 5d276b244d..0000000000
66-
--- a/utils/iserv-proxy/iserv-proxy.cabal
67-
+++ /dev/null
68-
@@ -1,78 +0,0 @@
69-
-Name: iserv-proxy
70-
-Version: 8.6
71-
-Copyright: XXX
72-
-License: BSD3
73-
--- XXX License-File: LICENSE
74-
-Author: XXX
75-
-Maintainer: XXX
76-
-Synopsis: iserv allows GHC to delegate Tempalte Haskell computations
77-
-Description:
78-
- GHC can be provided with a path to the iserv binary with
79-
- @-pgmi=/path/to/iserv-bin@, and will in combination with
80-
- @-fexternal-interpreter@, compile Template Haskell though the
81-
- @iserv-bin@ delegate. This is very similar to how ghcjs has been
82-
- compiling Template Haskell, by spawning a separate delegate (so
83-
- called runner on the javascript vm) and evaluating the splices
84-
- there.
85-
- .
86-
- iserv can also be used in combination with cross compilation. For
87-
- this, the @iserv-proxy@ needs to be built on the host, targeting the
88-
- host (as it is running on the host). @cabal install -flibrary
89-
- -fproxy@ will yield the proxy.
90-
- .
91-
- Using the cabal for the target @arch-platform-target-cabal install
92-
- -flibrary@ will build the required library that contains the ffi
93-
- @startSlave@ function, which needs to be invoked on the target
94-
- (e.g. in an iOS application) to start the remote iserv slave.
95-
- .
96-
- calling the GHC cross compiler with @-fexternal-interpreter
97-
- -pgmi=$HOME/.cabal/bin/iserv-proxy -opti\<ip address\> -opti\<port\>@
98-
- will cause it to compile Template Haskell via the remote at \<ip address\>.
99-
- .
100-
- Thus to get cross compilation with Template Haskell follow the
101-
- following receipt:
102-
- .
103-
- * compile the iserv library for your target
104-
- .
105-
- > iserv $ arch-platform-target-cabal install -flibrary
106-
- .
107-
- * setup an application for your target that calls the
108-
- * startSlave function. This could be either haskell or your
109-
- * targets ffi capable language, if needed.
110-
- .
111-
- > void startSlave(false /* verbose */, 5000 /* port */,
112-
- > "/path/to/storagelocation/on/target");
113-
- .
114-
- * build the iserv-proxy
115-
- .
116-
- > iserv $ cabal install -flibrary -fproxy
117-
- * Start your iserv-slave app on your target running on say @10.0.0.1:5000@
118-
- * compiler your sources with -fexternal-interpreter and the proxy
119-
- .
120-
- > project $ arch-platform-target-ghc ModuleContainingTH.hs \
121-
- > -fexternal-interpreter \
122-
- > -pgmi=$HOME/.cabal/bin/iserv-proxy \
123-
- > -opti10.0.0.1 -opti5000
124-
- .
125-
- Should something not work as expected, provide @-opti-v@ for verbose
126-
- logging of the @iserv-proxy@.
127-
-
128-
-Category: Development
129-
-build-type: Simple
130-
-cabal-version: >=1.10
131-
-
132-
-Executable iserv-proxy
133-
- Default-Language: Haskell2010
134-
- Main-Is: Main.hs
135-
- Hs-Source-Dirs: src
136-
- Build-Depends: array >= 0.5 && < 0.6,
137-
- base >= 4 && < 5,
138-
- binary >= 0.7 && < 0.9,
139-
- bytestring >= 0.10 && < 0.11,
140-
- containers >= 0.5 && < 0.6,
141-
- deepseq >= 1.4 && < 1.5,
142-
- directory >= 1.3 && < 1.4,
143-
- network >= 2.6,
144-
- filepath >= 1.4 && < 1.5,
145-
- ghci == 8.6.*,
146-
- libiserv == 8.6.*
147129
diff --git a/utils/iserv-proxy/iserv-proxy.cabal.in b/utils/iserv-proxy/iserv-proxy.cabal.in
148130
new file mode 100644
149131
index 0000000000..0819064601
@@ -234,7 +216,7 @@ index 0000000000..0819064601
234216
+ libiserv == @ProjectVersionMunged@
235217
diff --git a/utils/iserv/iserv.cabal.in b/utils/iserv/iserv.cabal.in
236218
new file mode 100644
237-
index 0000000000..356c8a444a
219+
index 0000000000..bcb3be75a0
238220
--- /dev/null
239221
+++ b/utils/iserv/iserv.cabal.in
240222
@@ -0,0 +1,48 @@
@@ -249,7 +231,7 @@ index 0000000000..356c8a444a
249231
+-- XXX License-File: LICENSE
250232
+Author: XXX
251233
+Maintainer: XXX
252-
+Synopsis: iserv allows GHC to delegate Template Haskell computations
234+
+Synopsis: iserv allows GHC to delegate Tempalte Haskell computations
253235
+Description:
254236
+ GHC can be provided with a path to the iserv binary with
255237
+ @-pgmi=/path/to/iserv-bin@, and will in combination with
@@ -286,3 +268,6 @@ index 0000000000..356c8a444a
286268
+ Cpp-Options: -DWINDOWS
287269
+ else
288270
+ Build-Depends: unix >= 2.7 && < 2.9
271+
--
272+
2.24.1
273+

0 commit comments

Comments
 (0)