Investigate building and porting to other platforms
It's only tested on Linux atm. Platforms I'd like to have a development process for:
- Linux
- Windows
- OS X
- iOS
- Android
There needs to be some magic done to make it work on OSX it seems. See #7.
Okey, I've tried install it on my parents Windows 7 machine, I was not able to finish the installation since I don't got more computer time today, but I can share the experience.
Install cairo was smooth actually, simply install gtk2hs(http://projects.haskell.org/gtk2hs/download/) and follow its instruction and you will get cairo as a side-effect since gtk is dependent on it.
As for SDL, the hackage package contains a ./configure script which needs a Unix simulator or simular.
Some basic knowledge of using cmd.exe and how to set env-vars is probably needed but not difficult, just use google to see how they work in Windows 7.
Windows really gave me a headeqe not sure if I wanna continue installing this. xD Anyway hope this helps a little bit at least, if I take the time to install CygWin or such and am able to install SDL bindings then I will ofc check if helm builds and works on Windows.
The SDL bindings have a WIN32 file explaining how to install them without the configure script:
Building hsSDL on Win32
-----------------------
Bit Connor <[email protected]>
This is how I managed to get hsSDL working on Windows XP.
I used GHC version 6.6.1
1. Download the SDL mingw development package from the SDL website
http://www.libsdl.org
The file I used was SDL-devel-1.2.12-mingw32.tar.gz
2. Extract it somewhere. You will get a directory called SDL-1.2.12
I used C:\SDL-1.2.12
3. Modify SDL.cabal file from hsSDL distribution.
A. There is a line:
Extra-Libraries: SDL
Change it to:
Extra-Libraries: SDL.dll SDLmain
B. Add two new lines to the end of the file:
Include-Dirs: C:\SDL-1.2.12\include
Extra-Lib-Dirs: C:\SDL-1.2.12\lib
4. Open a Windows Command Prompt (Start -> Run -> "cmd.exe")
cd into the hsSDL distribution directory and run:
runghc Setup.lhs configure
I got an error at the end, about a missing sh:
...
configure: Using hsc2hs: C:\ghc\ghc-6.6.1\bin\hsc2hs.exe
configure: No c2hs found
configure: No cpphs found
configure: No greencard found
Setup.lhs: Cannot find: sh
I ignored the error, and didn't have any problems.
Next run:
runghc Setup.lhs build
Finally, run:
runghc Setup.lhs install
5. Compile the example program. Run:
cd Examples
ghc --make Test.hs
You should get a Test.exe file.
Before running it, copy the SDL.dll file into the directory. You can find
it here:
C:\SDL-1.2.12\bin\SDL.dll
Now run Test.exe, press spacebar a few times to watch the smiley face jump
around, and finally press Q to quit.
6. Using SDL from GHCi requires a trick. If you try running Test.hs you will
get this error:
> ghci Test.hs
Prelude Main> main
Loading package SDL-0.4.0 ... can't load .so/.DLL for: SDLmain (addDLL: unknown
error)
To get ghci working, you must make 2 copies of SDL.dll called SDLmain.dll,
and SDL.dll.dll:
copy SDL.dll SDLmain.dll
copy SDL.dll SDL.dll.dll
Now everything should work!
Peace,
Bit Connor <[email protected]>
Tommorrow I'll get a Windows machine from school. If eveything goes well I can report if Helm worka or not before the end of the week. I have to excuse foe previous time I said I was foing to try it on Windows but it was my parenta computer and when they say me changing system vars they freaked out...
Hi, I've managed to get helm installed on a Windows 7 machine following the instructions from the previous comments.
For reference, I'm using:
- haskell platform 2013.2.0.0
- gtk+-bundle_2.24.10-20120208_win32
- gtk-0.12.4 (from cabal install)
- SDL-devel-1.2.15-mingw32
- SDL-0.6.5 (with the modifications made as described in the WIN32 file of the tarball from hackage)
- fresh git clone of helm as of today
Built all the demos to verify it worked and all of them behaved correctly (as far as I can see, atleast)
Hope this is useful!
Nice. I'll wait for the SDL2 bindings to be ready before I go about documenting the process officially.
Another report from the Win7 front.
- Windows 7 Home Premium SP1
- MinGHC: GHC 7.8.4 (64-bit) [1]
- All deps built from a sandbox.
gtk+-bundle_2.22.1-20101229_win64.zip[2]SDL2-devel-2.0.3-mingw.tarwithx86_64paths, usingpkg-config.exefromgtk+. [3]cabal install cabal-install alex happyfor cabal 1.22.cabal install gtk2hs-buildtoolscabal sandbox add-sourceHelm HEAD. [4]
Issues:
- Had to bump bounds on
cairoandpangoto0.13.*to fix package registration error withgtk2hs-buildtoolsandcabal-1.22. Is there a way to coordinate this with Helm development? - Usual sample program from the
FRP.Helmdoc works, but fill only covers the top left quadrant of the window. (Coord system change in new lib versions perhaps?)
import FRP.Helm
import qualified FRP.Helm.Window as Window
render :: (Int, Int) -> Element
render (w, h) = collage w h [rect (fromIntegral w) (fromIntegral h) |> filled red]
main :: IO ()
main = run defaultConfig $ lift render Window.dimensions
[1] https://github.com/fpco/minghc [2] http://www.gtk.org/download/win64.php [3] https://www.libsdl.org/download-2.0.php [4] https://github.com/switchface/helm/commit/fa8dc639eaf6c70975aa0d717adbd3da7cfc9cea