-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiserv-proxy.cabal
107 lines (102 loc) · 3.85 KB
/
iserv-proxy.cabal
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
Name: iserv-proxy
Version: 9.3
Copyright: XXX
License: BSD3
-- XXX License-File: LICENSE
Author: XXX
Maintainer: XXX
Synopsis: iserv allows GHC to delegate Template Haskell computations
Description:
GHC can be provided with a path to the iserv binary with
@-pgmi=/path/to/iserv-bin@, and will in combination with
@-fexternal-interpreter@, compile Template Haskell though the
@iserv-bin@ delegate. This is very similar to how ghcjs has been
compiling Template Haskell, by spawning a separate delegate (so
called runner on the javascript vm) and evaluating the splices
there.
.
iserv can also be used in combination with cross compilation. For
this, the @iserv-proxy@ needs to be built on the host, targeting the
host (as it is running on the host). @cabal install -flibrary
-fproxy@ will yield the proxy.
.
Using the cabal for the target @arch-platform-target-cabal install
-flibrary@ will build the required library that contains the FFI
@startInterpreter@ function, which needs to be invoked on the target
(e.g. in an iOS application) to start the remote iserv interpreter
.
calling the GHC cross compiler with @-fexternal-interpreter
-pgmi=$HOME/.cabal/bin/iserv-proxy -opti\<ip address\> -opti\<port\>@
will cause it to compile Template Haskell via the remote at \<ip address\>.
.
Thus to get cross compilation with Template Haskell follow the
following recipe:
.
* compile the iserv library for your target
.
> iserv $ arch-platform-target-cabal install -flibrary
.
* setup an application for your target that calls the
@startInterpreter@ function. This could be either the included
@iserv-proxy-interpreter@ executable or, if necessary, an application in
your target's FFI-capable language:
.
> void startInterpreter(
> false /* verbose */, 5000 /* port */,
> "/path/to/storagelocation/on/target");
.
* build the @iserv-proxy@
.
> iserv $ cabal install -flibrary -fproxy
.
* Start your iserv interpreter app on your target running on, for instance,
@10.0.0.1:5000@. Compile your sources with @-fexternal-interpreter@ and the
proxy
.
> project $ arch-platform-target-ghc ModuleContainingTH.hs \
> -fexternal-interpreter \
> -pgmi=$HOME/.cabal/bin/iserv-proxy \
> -opti10.0.0.1 -opti5000
.
Should something not work as expected, provide @-opti-v@ for verbose
logging of the @iserv-proxy@.
Category: Development
build-type: Simple
cabal-version: >=1.10
Library
Default-Language: Haskell2010
Hs-Source-Dirs: src
Exposed-Modules:
IServ.Remote.Message,
IServ.Remote.Interpreter
Build-Depends: array >= 0.5 && < 0.6,
base >= 4 && < 5,
binary >= 0.7 && < 0.9,
bytestring >= 0.10 && < 0.12,
containers >= 0.5 && < 0.8,
deepseq >= 1.4 && < 1.5,
directory >= 1.3 && < 1.4,
network >= 2.6,
filepath >= 1.4 && < 1.5,
ghci == 9.3,
libiserv == 9.3
Executable iserv-proxy
Default-Language: Haskell2010
Main-Is: Main.hs
Build-Depends: base >= 4 && < 5,
binary >= 0.7 && < 0.9,
bytestring >= 0.10 && < 0.12,
directory >= 1.3 && < 1.4,
network >= 2.6,
filepath >= 1.4 && < 1.5,
ghci == 9.3,
libiserv == 9.3,
iserv-proxy
Executable iserv-proxy-interpreter
Default-Language: Haskell2010
Main-Is: Interpreter.hs
-- We need to pass -fkeep-cafs to ensure that the interpreter retains CAFs
-- Iserv and GHC do something similar.
ghc-options: -fkeep-cafs
Build-Depends: base >= 4 && < 5,
iserv-proxy