summaryrefslogtreecommitdiff
path: root/monkeypatch.cabal
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-02-25 20:35:29 -0500
committerJoe Crayne <joe@jerkface.net>2019-02-25 20:35:29 -0500
commite34407b0080fa5c7176522b42783ad3c55a0f722 (patch)
tree488ceebc1c651e9915cce43cead685b341166c85 /monkeypatch.cabal
parent516e3520940959b378c71a8738456cc91878eb49 (diff)
cabal file and license
Diffstat (limited to 'monkeypatch.cabal')
-rw-r--r--monkeypatch.cabal69
1 files changed, 69 insertions, 0 deletions
diff --git a/monkeypatch.cabal b/monkeypatch.cabal
new file mode 100644
index 0000000..4c66cb7
--- /dev/null
+++ b/monkeypatch.cabal
@@ -0,0 +1,69 @@
1cabal-version: 2.2
2name: monkeypatch
3version: 0.1.0.0
4synopsis: Monkey-patch C module dependencies from haskell.
5description: This tool generates all the glue neccessary to make use of
6 functions defined in a C source code file from Haskell. This
7 includes generating stubs for C functions the C file does not
8 define but does expect to be linked with. These stubs can be
9 overwritten at run-time from Haskell by using a setter (i.e. they
10 may be monkey-patched). Any stub that is called before it is
11 monkey-patched, has a default implementation that outputs a
12 console message with the symbol name and Haskell type.
13 .
14 For example,
15 .
16 > $ ./monkeypatch -- ctox/toxcore/onion_client.c
17 > writing MonkeyPatch/OnionClient.hs
18 > writing MonkeyPatch/OnionClient_patch.c
19 .
20 The C file name onion_client.c yielded a Haskell module
21 MonkeyPatch.OnionClient and another C module named
22 OnionClient_patch.c. The first contains all the foreign imports
23 neccessary to call functions defined in onion_client.c and also
24 setters for setting Haskell implementations for functions used,
25 but not defined, in the module. The OnionClient_patch.c provides
26 the symbols neccessary to link onion_client.c and invoke whatever
27 Haskell functions are set as their implementation.
28 .
29 Any options, such as -I include paths, neccessary to compile the C
30 file, may be passed before the file name, but after the \-\-.
31 Options provided before that symbol are interpretted by the
32 monkeypatch tool itself.
33 .
34 In some cases, such as when an external symbol is used that refers
35 to a variable or constant that is not a function, the tool will be
36 unable to generate a monkey-patchable stub. To work around this,
37 more than one C file can be specified. Only the last one on the
38 command line will export symbols to Haskell, the others may
39 provide C-implementations for dependencies that will not be
40 monkey-patched. These support modules may also be provided in
41 already-compiled form (as .o object files).
42
43homepage: http://github.com/joecrayne/monkeypatch
44bug-reports: http://github.com/joecrayne/monkeypatch/issues
45license: GPL-3.0-only
46license-file: LICENSE
47author: Joe Crayne
48maintainer: joe@jerkface.net
49copyright: (c) 2018 Joseph Crayne
50category: Development
51extra-source-files: CHANGELOG.md
52
53executable monkeypatch
54 main-is: monkeypatch.hs
55 -- other-modules:
56 -- other-extensions:
57 build-depends: base ^>=4.10.1.0
58 , containers ^>=0.5.10.2
59 , language-c
60 , haskell-src-exts
61 , bytestring
62 , syb
63 , template-haskell
64 , pretty
65 , pretty-show
66 , process
67 , directory
68 -- hs-source-dirs:
69 default-language: Haskell2010