Skip to content

Instantly share code, notes, and snippets.

@jfischoff
Created July 2, 2012 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfischoff/3036297 to your computer and use it in GitHub Desktop.
Save jfischoff/3036297 to your computer and use it in GitHub Desktop.
Some shake cabal stuff I don't need
mkPackageRule packageDir = do
desc <- parseCabalPackage packageDir
let version = show $ pkgVersion $ package desc
srcs = collectSrcs desc
dependencies = collectDeps desc
libPath = [str|cabal-dev/lib/libHS$packageDir$-$version$.a|]
want libPath
libPath *> \_ -> do
need $ srcs ++ dependencies
system' "cabal-dev" ["install", packageDir ++ "/", "--force-reinstalls",
"--enable-tests"]
collectDeps desc = result where
--get the dependencies for the whole thing
--get the dependencies for the library, executable, and tests
libDeps = targetBuildDepends $ libBuildInfo desc
libDeps = targetBuildDepends $ libBuildInfo desc
collectSrcs desc = result where
Just libDesc = library desc
executables' = executables decs
testSuites' = testSuites decs
result = libSrcs libDesc
++ (concatMap executableSrcs executables')
++ (concatMap testSuiteSrcs testSuites' )
libSrcs = collectBuildInfoSrcs . libBuildInfo
executableSrcs = collectBuildInfoSrcs . buildInfo
testSuiteSrcs = collectBuildInfoSrcs . testBuildInfo
collectBuildInfoSrcs buildInfo = do
concat <$> mapM (\srcDir -> matchFileGlob $ FileGlob srcDir ".hs") srcs
parseCabalPackage packageDir = do
pdfile <- findPackageDesc packageDir
ppd <- readPackageDescription verbosity pdfile
return $ flattenPackageDescription ppd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment