Skip to content

Loading…

Make roguestar work on Windows and GHC7 #38

Merged
merged 2 commits into from

2 participants

@JPMoresmau

Mainly this is about removing upper bound that cause a dependency hell on GHC7, and adding rtsopts to enable RTS runtime options (which GHC 6.12 didn't need). I've add to add explicit DeepSeq dependencies too. For windows, in roguestar/Main I had to account for the fact that windows executable end in exe.
Unfortunately on my test windows machine I can't test on 6.12 because to get Parsec 3 I need to upgrade network, which requires a Unix toolchain even on windows. But I suppose you're on 6.12 so you will quickly see if I've broken something.
Hope this helps.

JP

@clanehin
Owner

Yikes. We've duplicated some effort. However, I'm inclined to prefer your patch over mine, since I can trust yours will compile on windows.

@clanehin clanehin merged commit 582bd08 into clanehin:master
@clanehin
Owner

Accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 5, 2011
  1. @JPMoresmau
Commits on Apr 6, 2011
  1. @JPMoresmau
View
37 roguestar-engine/roguestar-engine.cabal
@@ -1,18 +1,10 @@
name: roguestar-engine
version: 0.5
-cabal-version: -any
+cabal-version: >=1.2
build-type: Simple
license: OtherLicense
license-file: LICENSE
maintainer: Christopher Lane Hinson <lane@downstairspeople.org>
-build-depends: hslogger >=1.1.0 && <1.2,
- priority-sync >=0.2.1.0 && <0.3, PSQueue >=1.1 && <1.2,
- bytestring >=0.9.1.5 && <0.10, parallel >=2.2.0.1 && <2.3,
- stm >=2.1.1.2 && <2.2, data-memocombinators >=0.4.0 && <0.5,
- MonadRandom >=0.1.4 && <0.2, MaybeT >=0.1.2 && <0.2,
- mtl >=1.1.0.2 && <1.2, random >=1.0.0.2 && <1.1,
- old-time >=1.0.0.3 && <1.1, array >=0.3.0.0 && <0.3.1,
- containers >=0.3.0.0 && <0.3.1, base >=4 && <5
homepage: http://roguestar.downstairspeople.org/
synopsis: Sci-fi roguelike game. Backend.
description: Requires roguestar and roguestar-glut.
@@ -20,11 +12,18 @@ category: Game
author: Christopher Lane Hinson
tested-with: GHC ==6.12.1
-executable: roguestar-engine
-main-is: Main.hs
-pkgconfig-depends:
-hs-source-dirs: src
-other-modules: TravelData VisibilityData Stats FactionData Behavior
+executable roguestar-engine
+ main-is: Main.hs
+ hs-source-dirs: src
+ build-depends: hslogger >=1.1.0 ,
+ priority-sync >=0.2.1.0 && <0.3, PSQueue >=1.1 && <1.2,
+ bytestring >=0.9.1.5, parallel >=2.2.0.1 ,
+ stm >=2.1.1.2, data-memocombinators >=0.4.0 && <0.5,
+ MonadRandom >=0.1.4 && <0.2, MaybeT >=0.1.2 && <0.2,
+ mtl >=1.1.0.2, random >=1.0.0.2 && <1.1,
+ old-time >=1.0.0.3 && <1.1, array >=0.3.0.0 && <0.3.1,
+ containers >=0.3.0.0, base >=4 && <5
+ other-modules: TravelData VisibilityData Stats FactionData Behavior
Alignment PlaneData Grids Perception PlaneVisibility Turns Plane
CreatureData StatsData Protocol Character Tool Substances
HierarchicalDatabase Travel ToolData CharacterData Creature Facing
@@ -34,6 +33,10 @@ other-modules: TravelData VisibilityData Stats FactionData Behavior
Random PlayerState MakeData DBErrorFlag Construction Make Activate
Contact DeviceActivation WorkCluster Planet PlanetData Logging
NodeData CharacterAdvancement
-ghc-prof-options: -prof -auto-all
-ghc-shared-options: -prof -auto-all
-ghc-options: -threaded -fno-warn-type-defaults
+ ghc-prof-options: -prof -auto-all
+ ghc-shared-options: -prof -auto-all
+ if impl(ghc >= 7.0)
+ ghc-options: -threaded -fno-warn-type-defaults -rtsopts=all
+ else
+ ghc-options: -threaded -fno-warn-type-defaults
+
View
4 roguestar-engine/src/DB.hs
@@ -192,9 +192,9 @@ mapRO f xs = liftM (`using` parList rwhnf) $ mapM (dbSimulate . f) xs
sortByRO :: (DBReadable db,Ord b) => (forall m. DBReadable m => a -> m b) -> [a] -> db [a]
sortByRO f xs =
- liftM (List.map fst . sortBy (comparing snd)) $ flip mapRO xs $ \x ->
+ liftM (List.map fst . sortBy (comparing snd)) $ mapRO (\x ->
do y <- f x
- return (x,y)
+ return (x,y)) xs
-- | Run action synthesized from a read-only action (prepare-execute pattern).
atomic :: (x -> DB ()) -> (forall m. DBReadable m => m x) -> DB x
View
4 roguestar-engine/src/Protocol.hs
@@ -352,11 +352,11 @@ dbDispatchQuery ["object-details",uid] = ro $
do maybe_plane_ref <- dbGetCurrentPlane
(visibles :: [Reference ()]) <- maybe
(return [])
- (flip dbGetVisibleObjectsForFaction Player $ \ref ->
+ (dbGetVisibleObjectsForFaction (\ref ->
do let f = (== uid) . B.pack . show . toUID
let m_wielder = coerceReference ref
m_wield <- maybe (return Nothing) dbGetWielded m_wielder
- return $ maybe False f m_wield || f ref)
+ return $ maybe False f m_wield || f ref) Player)
maybe_plane_ref
let creature_refs = mapMaybe (coerceReferenceTyped _creature) visibles
wielded <- liftM catMaybes $ mapM dbGetWielded creature_refs
View
8 roguestar-gl/roguestar-gl.cabal
@@ -39,15 +39,15 @@ Library
rsagl==0.5,
rsagl-math==0.5,
rsagl-frp==0.5,
- containers>=0.3.0.0 && < 0.4,
+ containers>=0.3.0.0,
arrows>=0.4.1.2 && < 0.5,
- mtl>=1.1.0.2 && < 1.2,
+ mtl>=1.1.0.2,
MonadRandom>=0.1.4 && < 1.2,
OpenGL>=2.4.0.1 && < 2.5,
- filepath>=1.1.0.3 && < 1.2,
+ filepath>=1.1.0.3,
random>=1.0.0.2 && < 1.1,
bytestring>=0.9.1.5 && < 0.10,
- stm>=2.1.1.2 && < 2.2,
+ stm>=2.1.1.2,
priority-sync>=0.2.1.0 && < 0.2.2
ghc-options: -fno-warn-type-defaults -fexcess-precision
ghc-prof-options: -prof -auto-all
View
5 roguestar-glut/roguestar-glut.cabal
@@ -21,6 +21,9 @@ Executable roguestar-glut
roguestar-gl==0.5,
GLUT>=2.2.2.0 && < 2.3,
rsagl==0.5
- ghc-options: -threaded -fno-warn-type-defaults -fexcess-precision
+ if impl(ghc >= 7.0)
+ ghc-options: -threaded -fno-warn-type-defaults -fexcess-precision -rtsopts=all
+ else
+ ghc-options: -threaded -fno-warn-type-defaults -fexcess-precision
ghc-prof-options: -prof -auto-all
View
13 roguestar/src/Main.hs
@@ -16,6 +16,7 @@ import qualified Data.ByteString as B
import Data.ByteString.Char8 ()
import GHC.Exts (IsString(..))
import System.Directory
+import System.Info
data Args = Args {
arg_echo_protocol :: Bool,
@@ -97,7 +98,7 @@ main =
["-RTS"] ++
arg_engine args ++
["version","over","begin"]
- let roguestar_engine_bin = arg_prefix args `combine` "roguestar-engine"
+ let roguestar_engine_bin = arg_prefix args `combine` (makeExe "roguestar-engine")
roguestar_gl_bin <- findRoguestarGL args
when (arg_verbose args) $
putStrLn $ "starting process: " ++
@@ -146,14 +147,20 @@ main =
findRoguestarGL :: Args -> IO FilePath
findRoguestarGL args =
- do let roguestar_glut = arg_prefix args `combine` "roguestar-glut"
- let roguestar_gtk = arg_prefix args `combine` "roguestar-gtk"
+ do let roguestar_glut = arg_prefix args `combine` (makeExe "roguestar-glut")
+ let roguestar_gtk = arg_prefix args `combine` (makeExe "roguestar-gtk")
does_roguestar_glut_exist <- doesFileExist roguestar_glut
does_roguestar_gtk_exist <- doesFileExist roguestar_gtk
return $ case () of
() | does_roguestar_gtk_exist -> roguestar_gtk
() | does_roguestar_glut_exist -> roguestar_glut
+
+makeExe s= if elem os ["mingw32","cygwin32","win32"]
+ then s ++ ".exe"
+ else s
+
+
data Destination = DHandle Handle | DChan (Chan B.ByteString) | DChanTime (Chan B.ByteString)
send :: Destination -> B.ByteString -> IO ()
View
6 rsagl-frp/rsagl-frp.cabal
@@ -40,7 +40,7 @@ Library
old-time>= 1.0.0.3 && < 1.1,
array>= 0.3.0.0 && < 0.4,
arrows>= 0.4.1.2 && < 0.5,
- containers>= 0.3.0.0 && < 0.4,
- mtl>= 1.1.0.2 && < 1.2,
- stm>= 2.1.1.2 && < 2.2
+ containers>= 0.3.0.0,
+ mtl>= 1.1.0.2,
+ stm>= 2.1.1.2
View
1 rsagl-math/RSAGL/Math/Curve.hs
@@ -47,6 +47,7 @@ import RSAGL.Math.Angle
import RSAGL.Math.Affine
import Data.List
import Data.Maybe
+import Control.DeepSeq
import Control.Parallel.Strategies
import Control.Applicative
import RSAGL.Math.AbstractVector
View
1 rsagl-math/RSAGL/Math/Vector.lhs
@@ -40,6 +40,7 @@ module RSAGL.Math.Vector
orthos)
where
+import Control.DeepSeq
import Control.Parallel.Strategies
import RSAGL.Math.Angle
import System.Random
View
7 rsagl-math/rsagl-math.cabal
@@ -42,11 +42,12 @@ Library
build-depends: base>=4 && <5,
random>= 1.0.0.2 && < 1.1,
array>= 0.3.0.0 && < 0.4,
- containers>= 0.3.0.0 && < 0.4,
+ containers>= 0.3.0.0,
OpenGL>= 2.4.0.1 && < 2.5,
OpenGLRaw>= 1.1.0.1 && < 1.2,
parsec>=3.1.0 && < 3.2,
- parallel>=2.2.0.1 && < 2.3,
+ parallel>=2.2.0.1,
Vec>=0.9.8 && < 0.10,
- Vec-OpenGLRaw>=0.2.0.0 && < 0.3
+ Vec-OpenGLRaw>=0.2.0.0 && < 0.3,
+ deepseq>=1.1
View
1 rsagl/RSAGL/Auxiliary/ApplicativeWrapper.hs
@@ -11,6 +11,7 @@ module RSAGL.Auxiliary.ApplicativeWrapper
import Control.Applicative
import Data.Maybe
+import Control.DeepSeq
import Control.Parallel.Strategies
import RSAGL.Math.AbstractVector
View
1 rsagl/RSAGL/Color/Alpha.hs
@@ -6,6 +6,7 @@ module RSAGL.Color.Alpha
import RSAGL.Math.Types
import RSAGL.Color.Auxiliary
import RSAGL.Math.AbstractVector
+import Control.DeepSeq
import Control.Parallel.Strategies
import Control.Applicative
import RSAGL.Color.ColorSpace
View
1 rsagl/RSAGL/Color/RGB.hs
@@ -17,6 +17,7 @@ import RSAGL.Color.ColorSpace
import RSAGL.Color.Auxiliary
import RSAGL.Math.Vector
import RSAGL.Math.AbstractVector
+import Control.DeepSeq
import Control.Parallel.Strategies
-- | A color in the red-green-blue color space.
View
1 rsagl/RSAGL/Modeling/Material.hs
@@ -17,6 +17,7 @@ import Control.Applicative
import RSAGL.Color
import RSAGL.Math.Curve
import RSAGL.Auxiliary.ApplicativeWrapper
+import Control.DeepSeq
import Control.Parallel.Strategies
import Graphics.Rendering.OpenGL.GL hiding (RGB,RGBA,Alpha)
import RSAGL.Math.Types
View
1 rsagl/RSAGL/Modeling/Model.lhs
@@ -71,6 +71,7 @@ import Data.List as List
import Data.Maybe
import qualified Control.Monad.State as State
import Data.Monoid
+import Control.DeepSeq
import Control.Parallel.Strategies
import Graphics.Rendering.OpenGL.GL hiding (translate,rotate,scale,specular)
import RSAGL.Modeling.OpenGLPrimitives
View
1 rsagl/RSAGL/Modeling/Tesselation.hs
@@ -16,6 +16,7 @@ import RSAGL.Auxiliary.Auxiliary
import RSAGL.Math.Affine
import RSAGL.Math.BoundingBox
import Data.List
+import Control.DeepSeq
import Control.Parallel.Strategies hiding (r0)
import Control.Arrow
import Graphics.Rendering.OpenGL.GL.BeginEnd
View
11 rsagl/rsagl.cabal
@@ -56,14 +56,15 @@ Library
random>= 1.0.0.2 && < 1.1,
array>= 0.3.0.0 && < 0.4,
arrows>= 0.4.1.2 && < 0.5,
- containers>= 0.3.0.0 && < 0.4,
- parallel>= 2.2.0.1 && < 2.3,
- mtl>= 1.1.0.2 && < 1.2,
+ containers>= 0.3.0.0,
+ parallel>= 2.2.0.1,
+ mtl>= 1.1.0.2 ,
OpenGL>= 2.4.0.1 && < 2.5,
OpenGLRaw>= 1.1.0.1 && < 1.2,
parsec>=3.1.0 && < 3.2,
Vec>=0.9.8 && < 0.10,
Vec-OpenGLRaw>=0.2.0.0 && < 0.3,
- stm>= 2.1.1.2 && < 2.2,
- data-memocombinators>= 0.4.0 && < 0.5
+ stm>= 2.1.1.2,
+ data-memocombinators>= 0.4.0 && < 0.5,
+ deepseq>=1.1
Something went wrong with that request. Please try again.