From duncan.coutts at worc.ox.ac.uk Fri Jun 6 12:23:14 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 6 12:12:32 2008 Subject: [C2hs] Re: Licensing for Language.C In-Reply-To: <94766EBE-4F30-44C0-AA2A-A72E0FC0E1ED@gmail.com> References: <5ab17e790806031334u12e4373coc2ea7e395621765a@mail.gmail.com> <6B9CD17F-C2F9-421E-AC19-F8C9E9BF08D0@cse.unsw.edu.au> <1212570664.15010.248.camel@localhost> <94766EBE-4F30-44C0-AA2A-A72E0FC0E1ED@gmail.com> Message-ID: <1212769394.15010.369.camel@localhost> On Fri, 2008-06-06 at 17:41 +0200, Benedikt Huber wrote: > So how does relicensing work ? Will you publish the sources again, > under BSD license ? Or confirm that it is ok to use the BSD license in > some other way ? How about me writing this email and cc'ing it to the public c2hs list: I declare that I'm happy with relicensing the parts of the c2hs CParser.y (and the code it depends on, eg the lexer) in which I have a copyright interest from GPL-2 to a standard 3-clause new BSD license. Ok? > If everything has been clarified, I'll modify the LICENSE and .cabal > file (in the repo) accordingly. Ok. Duncan From chak at cse.unsw.edu.au Sat Jun 7 02:39:45 2008 From: chak at cse.unsw.edu.au (Manuel M T Chakravarty) Date: Sat Jun 7 02:32:20 2008 Subject: [C2hs] Re: Licensing for Language.C In-Reply-To: <1212769394.15010.369.camel@localhost> References: <5ab17e790806031334u12e4373coc2ea7e395621765a@mail.gmail.com> <6B9CD17F-C2F9-421E-AC19-F8C9E9BF08D0@cse.unsw.edu.au> <1212570664.15010.248.camel@localhost> <94766EBE-4F30-44C0-AA2A-A72E0FC0E1ED@gmail.com> <1212769394.15010.369.camel@localhost> Message-ID: <0420E45F-0337-4E99-888D-A0023103EC87@cse.unsw.edu.au> Same here, Benedikt. I am happy for any c2hs code that you find useful in Language.C and that I originated to be re-licensed under the three clause BSD license. Good luck with your GSoC project! Manuel Duncan Coutts: > > On Fri, 2008-06-06 at 17:41 +0200, Benedikt Huber wrote: > >> So how does relicensing work ? Will you publish the sources again, >> under BSD license ? Or confirm that it is ok to use the BSD license >> in >> some other way ? > > How about me writing this email and cc'ing it to the public c2hs list: > > I declare that I'm happy with relicensing the parts of the c2hs > CParser.y (and the code it depends on, eg the lexer) in which I have a > copyright interest from GPL-2 to a standard 3-clause new BSD license. > > Ok? > >> If everything has been clarified, I'll modify the LICENSE and .cabal >> file (in the repo) accordingly. > > Ok. > > Duncan > From int-e at gmx.de Sat Jun 7 15:10:19 2008 From: int-e at gmx.de (Bertram Felgenhauer) Date: Sat Jun 7 15:02:49 2008 Subject: [C2hs] Re: Relicensing the C parser of c2hs to 3-clause BSD In-Reply-To: <53586D07-3E52-4D80-A18F-3A8B0179C754@gmail.com> References: <53586D07-3E52-4D80-A18F-3A8B0179C754@gmail.com> Message-ID: <20080607191019.GD4258@zombie.inf.tu-dresden.de> Let's try this again. (Forgot to subscribe first.) Benedikt Huber wrote: > Now c2hs is licensed under GPL, and in discussions with my mentor Iavor > Diatchki, Duncan Coutts and Manuel Chakravarty, > in turned out that we'd like to have a BSD 3 license for Language.C, as > most haskell libraries have. > > Duncan and Manuel agreed to relicense the relevant parts of c2hs, via a > public announcment on the c2hs mailing list: > http://haskell.org/pipermail/c2hs/2008-June/000833.html > http://haskell.org/pipermail/c2hs/2008-June/000834.html > > Now as far as I can tell, you're the author of the pretty-printing module > (Pretty.hs), which we'd like to use as well. > It would be great if you could do the same, and send a similar relicensing > statement to the c2hs mailing list. I'm happy with relicensing the pretty printer code under a 3 clause BSD license. Good luck with your project, Bertram From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:09 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:25:57 2008 Subject: [C2hs] patch applied (c2hs): Remove obsolete build system files Message-ID: <20080620173409.GA11698@haskell.galois.com> Fri Jun 20 06:45:39 PDT 2008 Duncan Coutts * Remove obsolete build system files R ./Makefile R ./aclocal.m4 R ./c2hs.spec.in R ./config.guess R ./config.sub R ./configure.in R ./install-sh View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620134539-adfee-b3b730b56c29bc3198a338170eba5131b1e615f9.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:11 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:25:58 2008 Subject: [C2hs] patch applied (c2hs): Remove test code for FiniteMap module that no longer exists Message-ID: <20080620173411.GA11720@haskell.galois.com> Fri Jun 20 06:49:04 PDT 2008 Duncan Coutts * Remove test code for FiniteMap module that no longer exists R ./base/general/tests/ R ./base/general/tests/Main.hs R ./base/general/tests/doubles.hs R ./base/general/tests/unordered.hs View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620134904-adfee-3914fe2cb2b67fe20749550de889710ba9e985b4.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:12 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:25:58 2008 Subject: [C2hs] patch applied (c2hs): Move the base modules under src/ Message-ID: <20080620173412.GA11738@haskell.galois.com> Fri Jun 20 07:01:32 PDT 2008 Duncan Coutts * Move the base modules under src/ and tests under tests/ and remove tests modules which are testing now non-existant modules. ./base/ChangeLog -> ./ChangeLog.CTKlight ./base/TODO -> ./TODO.CTKlight ./base/errors/Errors.hs -> ./src/Data/Errors.hs ./base/general/DLists.hs -> ./src/Data/DLists.hs ./base/general/Position.hs -> ./src/Data/Position.hs ./base/general/UNames.hs -> ./src/Data/UNames.hs ./base/state/CIO.hs -> ./src/Control/CIO.hs ./base/state/State.hs -> ./src/Control/State.hs ./base/state/StateBase.hs -> ./src/Control/StateBase.hs ./base/state/StateTrans.hs -> ./src/Control/StateTrans.hs ./base/syms/Attributes.hs -> ./src/Data/Attributes.hs ./base/syms/Idents.hs -> ./src/Data/Idents.hs ./base/syms/NameSpaces.hs -> ./src/Data/NameSpaces.hs ./base/syntax/Lexers.hs -> ./src/Text/Lexers.hs ./base/state/tests/Main.hs -> ./tests/state.hs ./base/syms/tests/Main.hs -> ./tests/attributes.hs ./base/syntax/tests/LexersTest.hs -> ./tests/lexer.hs R ./base/ R ./base/errors/ R ./base/general/ R ./base/state/ R ./base/state/tests/ R ./base/syms/ R ./base/syms/tests/ R ./base/syntax/ R ./base/syntax/tests/ R ./base/syntax/tests/ParsersTest.hs A ./src/ A ./src/Control/ A ./src/Data/ A ./src/Text/ A ./tests/ View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620140132-adfee-ce9d030c6068f9cf670b9c27b932d06d9c56bb14.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:14 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:26:04 2008 Subject: [C2hs] patch applied (c2hs): Move c2hs modules under src/ Message-ID: <20080620173414.GA11755@haskell.galois.com> Fri Jun 20 09:11:08 PDT 2008 Duncan Coutts * Move c2hs modules under src/ and rename them to use hierarchical module names ./c2hs/c/C.hs -> ./src/C2HS/C.hs ./c2hs/c/CAST.hs -> ./src/C2HS/C/AST.hs ./c2hs/c/CAttrs.hs -> ./src/C2HS/C/Attrs.hs ./c2hs/c/CBuiltin.hs -> ./src/C2HS/C/Builtin.hs ./c2hs/c/CLexer.x -> ./src/C2HS/C/Lexer.x ./c2hs/c/CNames.hs -> ./src/C2HS/C/Names.hs ./c2hs/c/CParser.y -> ./src/C2HS/C/Parser.y ./c2hs/c/CParserMonad.hs -> ./src/C2HS/C/ParserMonad.hs ./c2hs/c/CPretty.hs -> ./src/C2HS/C/Pretty.hs ./c2hs/c/CTokens.hs -> ./src/C2HS/C/Tokens.hs ./c2hs/c/CTrav.hs -> ./src/C2HS/C/Trav.hs ./c2hs/chs/CHS.hs -> ./src/C2HS/CHS.hs ./c2hs/chs/CHSLexer.hs -> ./src/C2HS/CHS/Lexer.hs ./c2hs/examples -> ./examples ./c2hs/gen/CInfo.hs -> ./src/C2HS/C/Info.hs ./c2hs/state/C2HSState.hs -> ./src/C2HS/State.hs ./c2hs/state/Switches.hs -> ./src/C2HS/Switches.hs ./c2hs/toplevel/C2HSConfig.hs -> ./src/C2HS/Config.hs ./c2hs/toplevel/Main.hs -> ./src/Main.hs ./c2hs/toplevel/Version.hs -> ./src/C2HS/Version.hs ./c2hs/gen/GBMonad.hs -> ./src/C2HS/Gen/Monad.hs ./c2hs/gen/GenBind.hs -> ./src/C2HS/Gen/Bind.hs ./c2hs/gen/GenHeader.hs -> ./src/C2HS/Gen/Header.hs ./c2hs/c/tests/CCWrapper.hs -> ./tests/cparser/CCWrapper.hs ./c2hs/c/tests/Makefile -> ./tests/cparser/Makefile ./c2hs/c/tests/ParseUnit.hs -> ./tests/cparser/ParseUnit.hs ./c2hs/c/tests/cc-wrapper.sh -> ./tests/cparser/cc-wrapper.sh ./c2hs/c/tests/declr.i -> ./tests/cparser/declr.i ./c2hs/c/tests/simple.i -> ./tests/cparser/simple.i ./c2hs/c/tests/struct.i -> ./tests/cparser/struct.i ./c2hs/c/tests/typedef.i -> ./tests/cparser/typedef.i ./c2hs/tests/Calls.chs -> ./tests/system/Calls.chs ./c2hs/tests/Cpp.chs -> ./tests/system/Cpp.chs ./c2hs/tests/Enums.chs -> ./tests/system/Enums.chs ./c2hs/tests/Makefile -> ./tests/system/Makefile ./c2hs/tests/Marsh.chs -> ./tests/system/Marsh.chs ./c2hs/tests/Pointer.chs -> ./tests/system/Pointer.chs ./c2hs/tests/Simple.chs -> ./tests/system/Simple.chs ./c2hs/tests/Structs.chs -> ./tests/system/Structs.chs ./c2hs/tests/calls.h -> ./tests/system/calls.h ./c2hs/tests/cpp.h -> ./tests/system/cpp.h ./c2hs/tests/enums.c -> ./tests/system/enums.c ./c2hs/tests/enums.h -> ./tests/system/enums.h ./c2hs/tests/marsh.h -> ./tests/system/marsh.h ./c2hs/tests/pointer.c -> ./tests/system/pointer.c ./c2hs/tests/pointer.h -> ./tests/system/pointer.h ./c2hs/tests/simple.c -> ./tests/system/simple.c ./c2hs/tests/simple.h -> ./tests/system/simple.h ./c2hs/tests/structs.c -> ./tests/system/structs.c ./c2hs/tests/structs.h -> ./tests/system/structs.h ./c2hs/toplevel/c2hs_config.c -> ./src/C2HS/config.c ./c2hs/toplevel/c2hs_config.h -> ./src/C2HS/config.h ./src/Control/CIO.hs -> ./src/System/CIO.hs R ./c2hs/ M ./c2hs.cabal -49 +40 R ./c2hs/c/ R ./c2hs/c/tests/ R ./c2hs/chs/ R ./c2hs/gen/ R ./c2hs/state/ R ./c2hs/tests/ R ./c2hs/toplevel/ A ./src/C2HS/ A ./src/C2HS/C/ A ./src/C2HS/CHS/ A ./src/C2HS/Gen/ A ./src/System/ A ./tests/cparser/ A ./tests/system/ View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620161108-adfee-6ae78a985fc1d5f5ec79049826293865b63e134a.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:15 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:26:04 2008 Subject: [C2hs] patch applied (c2hs): Fix up module names and imports Message-ID: <20080620173415.GA11772@haskell.galois.com> Fri Jun 20 09:18:43 PDT 2008 Duncan Coutts * Fix up module names and imports M ./src/C2HS/C.hs -13 +13 M ./src/C2HS/C/AST.hs -4 +4 M ./src/C2HS/C/Attrs.hs -7 +7 M ./src/C2HS/C/Builtin.hs -4 +4 M ./src/C2HS/C/Info.hs -5 +5 M ./src/C2HS/C/Lexer.x -5 +5 M ./src/C2HS/C/Names.hs -8 +8 M ./src/C2HS/C/Parser.y -11 +11 M ./src/C2HS/C/ParserMonad.hs -6 +6 M ./src/C2HS/C/Pretty.hs -3 +3 M ./src/C2HS/C/Tokens.hs -3 +3 M ./src/C2HS/C/Trav.hs -8 +8 M ./src/C2HS/CHS.hs -7 +7 M ./src/C2HS/CHS/Lexer.hs -7 +7 M ./src/C2HS/Config.hs -5 +5 M ./src/C2HS/Gen/Bind.hs -11 +11 M ./src/C2HS/Gen/Header.hs -8 +8 M ./src/C2HS/Gen/Monad.hs -6 +6 M ./src/C2HS/State.hs -4 +4 M ./src/C2HS/Switches.hs -2 +2 M ./src/C2HS/Version.hs -1 +1 M ./src/C2HS/config.c -1 +1 M ./src/Control/State.hs -10 +9 M ./src/Control/StateBase.hs -6 +5 M ./src/Control/StateTrans.hs -1 +1 M ./src/Data/Attributes.hs -4 +4 M ./src/Data/DLists.hs -1 +1 M ./src/Data/Errors.hs -2 +2 M ./src/Data/Idents.hs -5 +5 M ./src/Data/NameSpaces.hs -3 +3 M ./src/Data/Position.hs -1 +1 M ./src/Data/UNames.hs -1 +1 M ./src/Main.hs -8 +8 M ./src/System/CIO.hs -2 +2 M ./src/Text/Lexers.hs -4 +4 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620161843-adfee-8e882f620d29c0b11f834165a385f70f6c970b05.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:16 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:26:05 2008 Subject: [C2hs] patch applied (c2hs): Use qualified names for DList module Message-ID: <20080620173416.GA11789@haskell.galois.com> Fri Jun 20 09:30:02 PDT 2008 Duncan Coutts * Use qualified names for DList module M ./src/C2HS/Gen/Header.hs -20 +21 M ./src/Data/DLists.hs -13 +13 M ./src/Text/Lexers.hs -4 +5 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620163002-adfee-25d878bf95faaae9ae3de7118448aada319a2b12.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:18 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:26:05 2008 Subject: [C2hs] patch applied (c2hs): Import System.CIO directly rather than by re-exporting Message-ID: <20080620173418.GA11806@haskell.galois.com> Fri Jun 20 10:07:55 PDT 2008 Duncan Coutts * Import System.CIO directly rather than by re-exporting M ./src/C2HS/C.hs -1 +1 M ./src/C2HS/CHS.hs -2 +2 M ./src/C2HS/State.hs +1 M ./src/Control/State.hs -2 +1 M ./src/Main.hs -4 +4 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620170755-adfee-51b57c108ca69c91963e2ba8c8b36de601b84379.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 13:34:19 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 13:26:07 2008 Subject: [C2hs] patch applied (c2hs): Use qualified names for System.CIO Message-ID: <20080620173419.GA11825@haskell.galois.com> Fri Jun 20 10:32:39 PDT 2008 Duncan Coutts * Use qualified names for System.CIO Always use import qualified System.CIO as CIO instead of putting a CIO suffix on everything. M ./src/C2HS/C.hs -2 +2 M ./src/C2HS/CHS.hs -6 +6 M ./src/C2HS/State.hs -2 +3 M ./src/Control/State.hs -3 +4 M ./src/Main.hs -37 +36 M ./src/System/CIO.hs -64 +58 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620173239-adfee-e0010853272e75d5ef9be98fbce883f2769cae21.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 18:41:21 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 18:33:05 2008 Subject: [C2hs] patch applied (c2hs): White space changes Message-ID: <20080620224121.GA19633@haskell.galois.com> Fri Jun 20 12:18:27 PDT 2008 Duncan Coutts * White space changes Convert tabs to spaces and remove trailing space M ./src/C2HS/C.hs -76 +76 M ./src/C2HS/C/AST.hs -242 +242 M ./src/C2HS/C/Attrs.hs -86 +86 M ./src/C2HS/C/Info.hs -21 +21 M ./src/C2HS/C/Lexer.x -148 +148 M ./src/C2HS/C/Names.hs -43 +43 M ./src/C2HS/C/Parser.y -539 +539 M ./src/C2HS/C/ParserMonad.hs -13 +13 M ./src/C2HS/C/Tokens.hs -126 +126 M ./src/C2HS/C/Trav.hs -182 +182 M ./src/C2HS/CHS.hs -422 +422 M ./src/C2HS/CHS/Lexer.hs -230 +230 M ./src/C2HS/Config.hs -14 +14 M ./src/C2HS/Gen/Bind.hs -722 +722 M ./src/C2HS/Gen/Header.hs -73 +73 M ./src/C2HS/Gen/Monad.hs -115 +115 M ./src/C2HS/State.hs -17 +17 M ./src/C2HS/Switches.hs -32 +32 M ./src/C2HS/Version.hs -5 +5 M ./src/C2HS/config.c -11 +11 M ./src/C2HS/config.h -4 +4 M ./src/Control/State.hs -86 +86 M ./src/Control/StateBase.hs -13 +13 M ./src/Control/StateTrans.hs -82 +82 M ./src/Data/Attributes.hs -78 +77 M ./src/Data/Errors.hs -28 +28 M ./src/Data/Idents.hs -15 +15 M ./src/Data/NameSpaces.hs -21 +21 M ./src/Data/Position.hs -8 +8 M ./src/Data/UNames.hs -14 +14 M ./src/Main.hs -157 +157 M ./src/System/CIO.hs -22 +22 M ./src/Text/Lexers.hs -111 +111 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620191827-9561d-d273a0a2dbef44c32e0c126c1901868121d4d104.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 18:41:24 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 18:33:07 2008 Subject: [C2hs] patch applied (c2hs): Partially convert to haddock style documentation markup Message-ID: <20080620224124.GA19660@haskell.galois.com> Fri Jun 20 15:34:45 PDT 2008 Duncan Coutts * Partially convert to haddock style documentation markup M ./src/C2HS/C.hs -3 +3 M ./src/C2HS/C/AST.hs -23 +23 M ./src/C2HS/C/Attrs.hs -28 +27 M ./src/C2HS/C/Builtin.hs -1 +1 M ./src/C2HS/C/Info.hs -7 +7 M ./src/C2HS/C/Names.hs -7 +7 M ./src/C2HS/C/Parser.y -5 +5 M ./src/C2HS/C/Pretty.hs -7 +7 M ./src/C2HS/C/Tokens.hs -2 +2 M ./src/C2HS/C/Trav.hs -89 +85 M ./src/C2HS/CHS.hs -35 +35 M ./src/C2HS/CHS/Lexer.hs -27 +25 M ./src/C2HS/Config.hs -15 +15 M ./src/C2HS/Gen/Bind.hs -66 +66 M ./src/C2HS/Gen/Header.hs -14 +14 M ./src/C2HS/Gen/Monad.hs -29 +29 M ./src/C2HS/State.hs -7 +7 M ./src/C2HS/Switches.hs -4 +4 M ./src/Control/State.hs -30 +28 M ./src/Control/StateBase.hs -12 +11 M ./src/Control/StateTrans.hs -34 +33 M ./src/Data/Attributes.hs -39 +38 M ./src/Data/DLists.hs -9 +9 M ./src/Data/Errors.hs -20 +20 M ./src/Data/Idents.hs -14 +14 M ./src/Data/NameSpaces.hs -8 +8 M ./src/Data/Position.hs -11 +10 M ./src/Data/UNames.hs -8 +8 M ./src/Main.hs -47 +46 M ./src/Text/Lexers.hs -35 +34 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620223445-9561d-c1196f59d569bda161b781824be10d90d485602a.gz From duncan.coutts at worc.ox.ac.uk Fri Jun 20 18:41:26 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Fri Jun 20 18:33:09 2008 Subject: [C2hs] patch applied (c2hs): Bump version number Message-ID: <20080620224126.GA19677@haskell.galois.com> Fri Jun 20 15:39:20 PDT 2008 Duncan Coutts * Bump version number Just so it's different from the last released version M ./c2hs.cabal -1 +1 View patch online: http://darcs.haskell.org/c2hs/_darcs/patches/20080620223920-9561d-ba0eecb3bfb7c513e49a0c9151dfc5f0cb93fba0.gz From jwlato at gmail.com Sun Jun 22 13:37:54 2008 From: jwlato at gmail.com (John Lato) Date: Sun Jun 22 13:29:33 2008 Subject: [C2hs] distributing packages that use C2HS Message-ID: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> Hello, I have a package (binding to a C library) that uses C2HS that I'm cleaning up for a hackage release. I was wondering if there are any guidelines as to which files to include and how to set up the build. I could include the .chs file, but then anyone trying to build the library would need C2HS. Alternatively, I could include just the .hs file I get from running C2HS (and C2HS.hs), which would be okay, but I would like to provide all available source files for anyone who's interested. Including both seems like asking for trouble in the build process. Does anyone have any recommendations for this? I couldn't find anything addressing it in the cabal packaging guidelines. Thanks, John Lato From chak at cse.unsw.edu.au Mon Jun 23 03:15:37 2008 From: chak at cse.unsw.edu.au (Manuel M T Chakravarty) Date: Mon Jun 23 03:07:14 2008 Subject: [C2hs] distributing packages that use C2HS In-Reply-To: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> References: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> Message-ID: <34C5D98C-AB05-4F8A-BE59-21F0EDF493B0@cse.unsw.edu.au> John Lato, > I have a package (binding to a C library) that uses C2HS that I'm > cleaning up for a hackage release. I was wondering if there are any > guidelines as to which files to include and how to set up the build. > I could include the .chs file, but then anyone trying to build the > library would need C2HS. Alternatively, I could include just the .hs > file I get from running C2HS (and C2HS.hs), which would be okay, but I > would like to provide all available source files for anyone who's > interested. Including both seems like asking for trouble in the build > process. Does anyone have any recommendations for this? I couldn't > find anything addressing it in the cabal packaging guidelines. Unfortunately, the inclusion of only the .hs file is in general not sufficient. C->Haskell hardcodes OS and C compiler-specific information in the .hs file, and hence, it is not portable. Manuel From duncan.coutts at worc.ox.ac.uk Mon Jun 23 05:54:27 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Mon Jun 23 05:41:06 2008 Subject: [C2hs] distributing packages that use C2HS In-Reply-To: <34C5D98C-AB05-4F8A-BE59-21F0EDF493B0@cse.unsw.edu.au> References: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> <34C5D98C-AB05-4F8A-BE59-21F0EDF493B0@cse.unsw.edu.au> Message-ID: <1214214867.15010.1011.camel@localhost> On Mon, 2008-06-23 at 17:15 +1000, Manuel M T Chakravarty wrote: > John Lato, > > I have a package (binding to a C library) that uses C2HS that I'm > > cleaning up for a hackage release. I was wondering if there are any > > guidelines as to which files to include and how to set up the build. > > I could include the .chs file, but then anyone trying to build the > > library would need C2HS. Alternatively, I could include just the .hs > > file I get from running C2HS (and C2HS.hs), which would be okay, but I > > would like to provide all available source files for anyone who's > > interested. Including both seems like asking for trouble in the build > > process. Does anyone have any recommendations for this? I couldn't > > find anything addressing it in the cabal packaging guidelines. > > Unfortunately, the inclusion of only the .hs file is in general not > sufficient. C->Haskell hardcodes OS and C compiler-specific > information in the .hs file, and hence, it is not portable. Right, and Cabal knows this so will not put the result of c2hs into the tarballs (where as it will for alex/happy). So, yes, just list all the modules in the .cabal file in exposed-modules or other-modules as appropriate and use cabal sdist to make the tarball. If you have dependencies between your .chs modules (ie if you use {# import #} hooks) then you will need to list the modules in the right order in the .cabal file because Cabal does not yet have support for working out the dependencies itself and doing them in the right order (we're working on it for a GSoC project this summer though). Another thing you should also use in the .cabal file is: build-tools: c2hs Duncan From duncan.coutts at worc.ox.ac.uk Mon Jun 23 18:09:40 2008 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Mon Jun 23 17:56:16 2008 Subject: [C2hs] distributing packages that use C2HS In-Reply-To: <9979e72e0806231051w400e9270u6555e7b37cde42d3@mail.gmail.com> References: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> <34C5D98C-AB05-4F8A-BE59-21F0EDF493B0@cse.unsw.edu.au> <1214214867.15010.1011.camel@localhost> <9979e72e0806231051w400e9270u6555e7b37cde42d3@mail.gmail.com> Message-ID: <1214258980.15010.1068.camel@localhost> On Mon, 2008-06-23 at 12:51 -0500, John Lato wrote: > Okay, thanks. I'll just need to live with the dependency on c2hs for > end-users. I suppose if that's a problem, I should have chosen > something other than c2hs as a build tool. In general though it does need to be done on the end users machine so it's not just a c2hs limitation. You may be lucky and know for certain that for the particular C API that you are binding that it is the same on every platform and contains no sizes or offsets of types (since sizes and offsets change between platforms, especially between 32 and 64bit ones). In that happy circumstance then it would be safe to bundle pre-generated .hs files. Cabal will not help you there however since it takes the conservative position that the result of c2hs (and hsc2hs and other FFI pre-processors) is platform dependent. One way to check if its portable is to look at the .hs files generated by c2hs and see if there are any numbers generated. If so then it is platform dependent. Another way of saying it is that call and fun hooks are ok but sizeof, get and set hooks are not. However even if there are no numbers in the generated .hs that doesn't guarantee you're safe. If you're binding to a .h file that might be different on different systems then you've got problems. It is quite common for lots of system headers to use slightly different types on different systems. If you're binding to a C library that has the same implementation on each system or is otherwise guaranteed to have the same C interface then you'd be ok. If you were *absolutely* sure then you could manually include the generated .hs files in dist/build/ in the same path in the tarball and it would work without c2hs installed (assuming you also removed the c2hs build-tool dep). For example see the tarball for happy and where the pre-generated .hs file lives in the tarball (of course for happy, cabal does this automatically because it knows the output of happy is platform independent). Duncan From jwlato at gmail.com Tue Jun 24 01:27:02 2008 From: jwlato at gmail.com (John Lato) Date: Tue Jun 24 01:18:35 2008 Subject: [C2hs] distributing packages that use C2HS In-Reply-To: <1214258980.15010.1068.camel@localhost> References: <9979e72e0806221037l5c7dd12byc2628a65857422da@mail.gmail.com> <34C5D98C-AB05-4F8A-BE59-21F0EDF493B0@cse.unsw.edu.au> <1214214867.15010.1011.camel@localhost> <9979e72e0806231051w400e9270u6555e7b37cde42d3@mail.gmail.com> <1214258980.15010.1068.camel@localhost> Message-ID: <9979e72e0806232227p20a546bfs451aac3dc3dd4941@mail.gmail.com> On Mon, Jun 23, 2008 at 5:09 PM, Duncan Coutts wrote: > > On Mon, 2008-06-23 at 12:51 -0500, John Lato wrote: > > In general though it does need to be done on the end users machine so > it's not just a c2hs limitation. > > You may be lucky and know for certain that for the particular C API that > you are binding that it is the same on every platform and contains no > sizes or offsets of types (since sizes and offsets change between > platforms, especially between 32 and 64bit ones). In that happy > circumstance then it would be safe to bundle pre-generated .hs files. Well, thanks for pointing this out. I'd forgotten that the offsets will change with platforms, even though one of the reasons I was attracted to c2hs was because I didn't want to have to worry about that myself. Looks like I put that concern a little too far outside my thoughts! The API is definitely not the same on every platform. There can even be size variances on the same platform depending on the C library's build options, which is yet another item that needs to be done on the end-users machine. John