aboutsummaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2017-06-12 03:08:56 +0200
committerDaniel Gröber <dxld@darkboxed.org>2017-06-12 03:08:56 +0200
commitc8f7ac80ee152d737220c75a4d9b10211a37ace8 (patch)
tree0098798db293d9f52960d9f6ed35a998caa415f9 /Setup.hs
parenteddd7e4dcbd014030b6c28bc97adf47f7cfad2fb (diff)
Update and fix support for Cabal HEAD
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs22
1 files changed, 17 insertions, 5 deletions
diff --git a/Setup.hs b/Setup.hs
index 6909c27..94c8493 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,5 +1,14 @@
#!/usr/bin/env runhaskell
-{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
+{-# LANGUAGE CPP, RecordWildCards, NamedFieldPuns #-}
+
+#if defined(MIN_VERSION_Cabal) && MIN_VERSION_Cabal(2,1,0)
+
+-- https://github.com/haskell/cabal/pull/4501 is upstream in 2.0, yey
+import Distribution.Simple
+main = defaultMain
+
+#else
+
import Distribution.Simple
import Distribution.Simple.Utils
import Distribution.Simple.Setup
@@ -70,7 +79,7 @@ xInstallTarget :: PackageDescription
-> (PackageDescription -> LocalBuildInfo -> IO ())
-> IO ()
xInstallTarget pd lbi cf fn = do
- let (extended, regular) = partition isInternal (executables pd)
+ let (extended, regular) = partition isExeScopePrivate (executables pd)
let pd_regular = pd { executables = regular }
@@ -96,13 +105,16 @@ xInstallTarget pd lbi cf fn = do
fn pd_regular lbi
+isExeScopePrivate :: Executable -> Bool
+isExeScopePrivate exe =
+ fromMaybe False $ (=="private") <$> lookup "x-scope" fields
where
- isInternal :: Executable -> Bool
- isInternal exe =
- fromMaybe False $ (=="True") <$> lookup "x-internal" (customFieldsBI $ buildInfo exe)
+ fields = customFieldsBI $ buildInfo exe
onlyExePackageDesc :: [Executable] -> PackageDescription -> PackageDescription
onlyExePackageDesc exes pd = emptyPackageDescription {
package = package pd
, executables = exes
}
+
+#endif