Skip to content
This repository has been archived by the owner on Jan 17, 2020. It is now read-only.

Investigate building and porting to other platforms #3

Open
z0w0 opened this issue Jul 13, 2013 · 7 comments
Open

Investigate building and porting to other platforms #3

z0w0 opened this issue Jul 13, 2013 · 7 comments
Milestone

Comments

@z0w0
Copy link
Owner

z0w0 commented Jul 13, 2013

It's only tested on Linux atm. Platforms I'd like to have a development process for:

  • Linux
  • Windows
  • OS X
  • iOS
  • Android

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1074630-investigate-building-and-porting-to-other-platforms?utm_campaign=plugin&utm_content=tracker%2F290443&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F290443&utm_medium=issues&utm_source=github).
@z0w0
Copy link
Owner Author

z0w0 commented Jul 26, 2013

There needs to be some magic done to make it work on OSX it seems. See #7.

@funrep
Copy link
Contributor

funrep commented Jul 28, 2013

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.

@z0w0
Copy link
Owner Author

z0w0 commented Jul 28, 2013

The SDL bindings have a WIN32 file explaining how to install them without the configure script:

Building hsSDL on Win32
-----------------------
Bit Connor <bit@mutantlemon.com>


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 <bit@mutantlemon.com>

@funrep
Copy link
Contributor

funrep commented Sep 11, 2013

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...

@usc-m
Copy link

usc-m commented Sep 29, 2013

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!

@z0w0
Copy link
Owner Author

z0w0 commented Sep 30, 2013

Nice. I'll wait for the SDL2 bindings to be ready before I go about documenting the process officially.

@z0w0 z0w0 modified the milestones: 1.0.0, 0.7.0 Aug 13, 2014
@z0w0 z0w0 modified the milestones: 1.0.0, 0.7.0 Sep 7, 2014
@Kludgy
Copy link

Kludgy commented Jan 19, 2015

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.tar with x86_64 paths, using pkg-config.exe from gtk+. [3]
  • cabal install cabal-install alex happy for cabal 1.22.
  • cabal install gtk2hs-buildtools
  • cabal sandbox add-source Helm HEAD. [4]

Issues:

  • Had to bump bounds on cairo and pango to 0.13.* to fix package registration error with gtk2hs-buildtools and cabal-1.22. Is there a way to coordinate this with Helm development?
  • Usual sample program from the FRP.Helm doc 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] fa8dc63

@z0w0 z0w0 modified the milestones: 2.0.0, 1.0.0 Oct 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants