Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build compatibility with cabal new-build. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Control.Monad (void, when)
import Distribution.Simple
import Distribution.Simple.Setup (BuildFlags, fromFlagOrDefault, buildDistPref)
import Distribution.PackageDescription (HookedBuildInfo, emptyHookedBuildInfo)
import System.Cmd (system)
import System.Process (system)
import System.Directory (doesFileExist, createDirectoryIfMissing)
import System.FilePath ((</>))

Expand All @@ -15,15 +15,17 @@ maybeRunC2HS :: Args -> BuildFlags -> IO HookedBuildInfo
maybeRunC2HS _args flags = do
chiExists <- doesFileExist chiFile
when (not chiExists) $ do
let c2hs_args = "--output-dir=" ++ buildDir ++
" --include=" ++ buildDir ++
" --cppopts=-Iinclude --cppopts=-U__BLOCKS__"
let c2hs_args = ["c2hs",
"--output-dir=" ++ buildDir,
"--include=" ++ buildDir,
"--cppopts=-Iinclude --cppopts=-U__BLOCKS__",
chsFile]
createDirectoryIfMissing True internalDir
void $ system $ "c2hs " ++ c2hs_args ++ chsFile
void $ system $ unwords c2hs_args
return emptyHookedBuildInfo
where
distDir = fromFlagOrDefault "dist" (buildDistPref flags)
buildDir = distDir </> "build"
internalDir = buildDir </> "Foreign/OpenCL/Bindings/Internal"
chiFile = internalDir </> "Types.chi"
chsFile = internalDir </> "Types.chs"
chsFile = "Foreign/OpenCL/Bindings/Internal/Types.chs"
5 changes: 4 additions & 1 deletion hopencl.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ License-file: LICENSE
Author: Martin Dybdal <[email protected]>
Maintainer: Martin Dybdal <[email protected]>
Copyright: Copyright (c) 2011. Martin Dybdal, HIPERFIT research center, University of Copenhagen

Tested-with: GHC == 7.0.3
Build-type: Custom
Cabal-version: >= 1.10
Expand Down Expand Up @@ -118,3 +118,6 @@ Test-suite unit
Source-repository head
type: git
location: http://github.com/HIPERFIT/hopencl

Custom-setup
setup-depends: Cabal, base, filepath, directory, process