Distributing Haskell binaries as OSX App Bundles

I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to somehow distribute all the stuff together in a .app bundle. However, the only experience I have of doing this sort of stuff before is via xcode. What's the best way to go about this? It just occurred to me now that maybe cmake is the way to go? Any advice that might save me some time would be really appreciated. Cheers, Stephen

Stephen wrote:
I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to
I usually link in libgmp.a statically. This happens automatically if libgmp.a resides in ghc's libdir (just copy it) Cheers Christian

I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to somehow distribute all the stuff together in a .app bundle. However, the only experience I have of doing this sort of stuff before is via xcode. What's the best way to go about this? It just occurred to me now that maybe cmake is the way to go?
If you use the installer package version of GHC http://haskell.org/ghc/dist/6.8.3/chakravarty/GHC-6.8.3-i386.pkg GMP will automatically be linked statically. As far as creating app bundles, one way is to use xcode to to create the bundle structure and then have it call a conventional makefile based build system to do the actual build and install the binaries into the bundle structure. That's what I did to create the GHC.pkg. It might require some fiddling, though. Manuel

2008/9/24 Stephen
I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to somehow distribute all the stuff together in a .app bundle. However, the only experience I have of doing this sort of stuff before is via xcode. What's the best way to go about this? It just occurred to me now that maybe cmake is the way to go?
A long time ago I solved this problem by creating Cabal user hooks to package the binary into a .app bundle. The code is located here: http://tothepowerofdisco.com/repo/HaskellLibraries/ This isn't really quality code IMO. The version of cabal this works with is limited to that distributed with GHC 6.6 and the version of GHC 6.6 that dynamically linked with GMP.framework stored in /Library/Frameworks. Plus the package includes Core Audio and Core Foundation wrappers which really have nothing to do with packaging haskell applications into .app bundles. Still, it worked and I was able to create self-contained OS X applications. The reason the dynamically linked GMP framework was used instead of the statically linked GMP was due to the GMP license. This complicates creating a self-contained application but it is still possible. The technique I used was to rewrite the install name of GMP.framework to be executable relative and copy the framework into the application bundle. Course, the downside is this increases the application size by around 2mb! See: appPackageExe in http://tothepowerofdisco.com/repo/HaskellLibraries/MacOSX/Build.hs If there is interest in a Cabal-based flow for creating Mac OS X applications then I'll try to update the code to work with newer versions of Cabal. -- -Corey O'Connor

Thanks for all the replies. I did the whole otool -L thing, but not packaging it in a .app bundle because osx seems to swallow up terminal output from them (and gui stuff wasn't an option), so I jdidn't bundle it up. (actually, I ended up not following through that route. In the very, very end I ended up tossing it on a webserver and wrapping it in php ;P ) (also, sorry if I sent this twice...I think I sent it once to Corey only by accident)
participants (4)
-
Christian Maeder
-
Corey O'Connor
-
Manuel M T Chakravarty
-
Stephen