From e34407b0080fa5c7176522b42783ad3c55a0f722 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Mon, 25 Feb 2019 20:35:29 -0500 Subject: cabal file and license --- monkeypatch.cabal | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 monkeypatch.cabal (limited to 'monkeypatch.cabal') diff --git a/monkeypatch.cabal b/monkeypatch.cabal new file mode 100644 index 0000000..4c66cb7 --- /dev/null +++ b/monkeypatch.cabal @@ -0,0 +1,69 @@ +cabal-version: 2.2 +name: monkeypatch +version: 0.1.0.0 +synopsis: Monkey-patch C module dependencies from haskell. +description: This tool generates all the glue neccessary to make use of + functions defined in a C source code file from Haskell. This + includes generating stubs for C functions the C file does not + define but does expect to be linked with. These stubs can be + overwritten at run-time from Haskell by using a setter (i.e. they + may be monkey-patched). Any stub that is called before it is + monkey-patched, has a default implementation that outputs a + console message with the symbol name and Haskell type. + . + For example, + . + > $ ./monkeypatch -- ctox/toxcore/onion_client.c + > writing MonkeyPatch/OnionClient.hs + > writing MonkeyPatch/OnionClient_patch.c + . + The C file name onion_client.c yielded a Haskell module + MonkeyPatch.OnionClient and another C module named + OnionClient_patch.c. The first contains all the foreign imports + neccessary to call functions defined in onion_client.c and also + setters for setting Haskell implementations for functions used, + but not defined, in the module. The OnionClient_patch.c provides + the symbols neccessary to link onion_client.c and invoke whatever + Haskell functions are set as their implementation. + . + Any options, such as -I include paths, neccessary to compile the C + file, may be passed before the file name, but after the \-\-. + Options provided before that symbol are interpretted by the + monkeypatch tool itself. + . + In some cases, such as when an external symbol is used that refers + to a variable or constant that is not a function, the tool will be + unable to generate a monkey-patchable stub. To work around this, + more than one C file can be specified. Only the last one on the + command line will export symbols to Haskell, the others may + provide C-implementations for dependencies that will not be + monkey-patched. These support modules may also be provided in + already-compiled form (as .o object files). + +homepage: http://github.com/joecrayne/monkeypatch +bug-reports: http://github.com/joecrayne/monkeypatch/issues +license: GPL-3.0-only +license-file: LICENSE +author: Joe Crayne +maintainer: joe@jerkface.net +copyright: (c) 2018 Joseph Crayne +category: Development +extra-source-files: CHANGELOG.md + +executable monkeypatch + main-is: monkeypatch.hs + -- other-modules: + -- other-extensions: + build-depends: base ^>=4.10.1.0 + , containers ^>=0.5.10.2 + , language-c + , haskell-src-exts + , bytestring + , syb + , template-haskell + , pretty + , pretty-show + , process + , directory + -- hs-source-dirs: + default-language: Haskell2010 -- cgit v1.2.3