fjarri/haskell-sdl-template

trying to install

tabenius opened this issue · 6 comments

As a haskell newbie I'm trying to install your package:

$ runhaskell Setup.hs configure --user
Configuring SDLTemplate-1.0...

$ runhaskell Setup.hs build
Setup.hs: Maybe.fromJust: Nothing

Setup.hs:bundleAll lbi = fromJust $ lookup (FlagName "bundleall") (configConfigurationsFlags $ configFlags lbi)

Am I doing something wrong? Thank you

Cheers, Tobias

I am not sure what's happening here. Could you try running cabal configure and cabal build instead of calling the Setup.hs directly? Also, what version of cabal do you have?

I did this and it works, however the installed binary looks for the image in the wrong place for that binary. The .app in dist/build/ works great though! Shouldn't it install an .app instead?

$ sudo cabal configure
Resolving dependencies...
Configuring SDLTemplate-1.0...

$ sudo cabal build
Building SDLTemplate-1.0...
Preprocessing executable 'sdltemplate' for SDLTemplate-1.0...
Linking dist/build/sdltemplate/sdltemplate ...
Creating application bundle directory dist/build/SDLTemplate.app
Copying executable SDLTemplate into place
Copying SDLTemplate.icns to app's icon
Copying resource ./image.png to dist/build/SDLTemplate.app/Contents/Resources/image.png
Building dependency graph
Copying /usr/local/lib/libSDL_image-1.2.0.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib
Copying /usr/local/lib/libSDL-1.2.0.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Copying /usr/lib/libiconv.2.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/lib/libiconv.2.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/local/lib/libSDL_image-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/lib/libiconv.2.dylib to @executable_path/../Frameworks/usr/lib/libiconv.2.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/local/lib/libSDL-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Updating dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib's dependency on /usr/local/lib/libSDL-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Running Rez, etc.

$ sudo cabal install
Resolving dependencies...
Configuring SDLTemplate-1.0...
Building SDLTemplate-1.0...
Preprocessing executable 'sdltemplate' for SDLTemplate-1.0...
Linking dist/build/sdltemplate/sdltemplate ...
Creating application bundle directory dist/build/SDLTemplate.app
Copying executable SDLTemplate into place
Copying SDLTemplate.icns to app's icon
Copying resource ./image.png to dist/build/SDLTemplate.app/Contents/Resources/image.png
Building dependency graph
Copying /usr/local/lib/libSDL_image-1.2.0.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib
Copying /usr/local/lib/libSDL-1.2.0.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Copying /usr/lib/libiconv.2.dylib to dist/build/SDLTemplate.app/Contents/Frameworks/usr/lib/libiconv.2.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/local/lib/libSDL_image-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/lib/libiconv.2.dylib to @executable_path/../Frameworks/usr/lib/libiconv.2.dylib
Updating dist/build/SDLTemplate.app/Contents/MacOS/SDLTemplate's dependency on /usr/local/lib/libSDL-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Updating dist/build/SDLTemplate.app/Contents/Frameworks/usr/local/lib/libSDL_image-1.2.0.dylib's dependency on /usr/local/lib/libSDL-1.2.0.dylib to @executable_path/../Frameworks/usr/local/lib/libSDL-1.2.0.dylib
Running Rez, etc.
Warning: No documentation was generated as this package does not contain a
library. Perhaps you want to use the --executables flag.
Installing executable(s) in
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0/bin
Installed SDLTemplate-1.0
Updating documentation index /Users/btobias/Library/Haskell/doc/index.html

$ /Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0/bin/sdltemplate
sdltemplate: user error (IMG_Load
SDL message: Couldn't open /Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0/Resources/image.png)

$ find /Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0/
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0/
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0//bin
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0//bin/sdltemplate
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0//share
/Users/btobias/Library/Haskell/ghc-7.6.3/lib/SDLTemplate-1.0//share/image.png

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library

To be honest, I never intended it to be installable. This template is supposed to create a standalone .app (or a directory with an executable and data files, that's what the bundleall flag is for) on build, and that seems to be working fine for you.

Now I'm not saying it's impossible to make the install work; maybe it's even quite easy. How important is it for you?

It's not important right now, I just wanted to understand in case I
might want it in the future and thought it was a good idea to tell you.
Thank you for your time.

Yes, it is indeed a reasonable feature. I'll leave this issue open for the time being, in case I (or anyone else) has the time to implement it. It seems that essentially one needs to somehow detect the installation, and make DynPaths_<module_name> use the existing Paths_<module_name> functionality cabal provides (which will give the path of /share folder the resources are stored in).