aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-02-09 19:46:44 +0100
committerDaniel Gröber <dxld@darkboxed.org>2019-02-09 19:48:30 +0100
commitf2189de2797e391124ead51eada6d57b2929c88f (patch)
treecb41b5fb34408b6b9b41b61b427eeb4ba72aa14a /src/CabalHelper/Compiletime
parent307b53fb1511033249b98132fdd155deee4ce3a2 (diff)
Shortcut helper compilation when Cabal version is already available
This is mostly an optimization for Nix which already sets up the environment correctly, so we should reward its users :)
Diffstat (limited to 'src/CabalHelper/Compiletime')
-rw-r--r--src/CabalHelper/Compiletime/Cabal.hs7
-rw-r--r--src/CabalHelper/Compiletime/Data.hs1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/CabalHelper/Compiletime/Cabal.hs b/src/CabalHelper/Compiletime/Cabal.hs
index a61b6f6..6477b85 100644
--- a/src/CabalHelper/Compiletime/Cabal.hs
+++ b/src/CabalHelper/Compiletime/Cabal.hs
@@ -20,7 +20,7 @@ Description : Cabal library source unpacking
License : GPL-3
-}
-{-# LANGUAGE DeriveFunctor #-}
+{-# LANGUAGE DeriveFunctor, CPP #-}
module CabalHelper.Compiletime.Cabal where
@@ -36,7 +36,7 @@ import System.FilePath
import CabalHelper.Compiletime.Types
import CabalHelper.Compiletime.Process
-import CabalHelper.Shared.Common (trim, replace)
+import CabalHelper.Shared.Common (trim, replace, parseVer)
type UnpackedCabalVersion = CabalVersion' (CommitId, CabalSourceDir)
type ResolvedCabalVersion = CabalVersion' CommitId
@@ -215,3 +215,6 @@ findCabalFile pkgdir = do
if takeFileName p == takeExtension p
then "" -- just ".cabal" is not a valid cabal file
else takeExtension p
+
+bultinCabalVersion :: Version
+bultinCabalVersion = parseVer VERSION_Cabal
diff --git a/src/CabalHelper/Compiletime/Data.hs b/src/CabalHelper/Compiletime/Data.hs
index 07cf2d2..14793c5 100644
--- a/src/CabalHelper/Compiletime/Data.hs
+++ b/src/CabalHelper/Compiletime/Data.hs
@@ -85,6 +85,7 @@ runtimeSources :: (String, [(FilePath, FilePath)])
runtimeSources = $(
let files = map (\f -> (f, ("src/CabalHelper" </> f))) $ sort $
[ ("Runtime/Main.hs")
+ , ("Runtime/HelperMain.hs")
, ("Runtime/Compat.hs")
, ("Shared/Common.hs")
, ("Shared/InterfaceTypes.hs")