-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create setup script for Windows SDL as cabal flags don't support rela…
…tive paths
- Loading branch information
1 parent
b4f3eeb
commit a63f253
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Distribution.PackageDescription | ||
( GenericPackageDescription | ||
, HookedBuildInfo | ||
, extraLibDirs | ||
, includeDirs | ||
, libBuildInfo | ||
, library | ||
) | ||
import Distribution.Simple | ||
( Args | ||
, UserHooks | ||
, confHook | ||
, defaultMainWithHooks | ||
, simpleUserHooks | ||
) | ||
import Distribution.Simple.LocalBuildInfo | ||
( LocalBuildInfo | ||
, localPkgDescr | ||
) | ||
import Distribution.Simple.Setup | ||
( ConfigFlags | ||
) | ||
import Data.Maybe | ||
( fromJust | ||
) | ||
import System.Directory | ||
( getCurrentDirectory | ||
) | ||
|
||
main :: IO () | ||
main = defaultMainWithHooks simpleUserHooks { confHook = sdlConfHook } | ||
|
||
sdlConfHook :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo | ||
sdlConfHook (description, buildInfo) flags = do | ||
localBuildInfo <- confHook simpleUserHooks (description, buildInfo) flags | ||
let packageDescription = localPkgDescr localBuildInfo | ||
library = fromJust $ library packageDescription | ||
libraryBuildInfo = libBuildInfo library | ||
dir <- getCurrentDirectory | ||
return localBuildInfo { | ||
localPkgDescr = packageDescription { | ||
library = Just $ library { | ||
libBuildInfo = libraryBuildInfo { | ||
includeDirs = (dir ++ "/sdl/include"):(includeDirs libraryBuildInfo), | ||
extraLibDirs = (dir ++ "/sdl/lib"):(extraLibDirs libraryBuildInfo) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters