Bump Cabal submodule to 2.2
authorMoritz Angermann <moritz.angermann@gmail.com>
Sat, 3 Mar 2018 21:16:41 +0000 (16:16 -0500)
committerBen Gamari <ben@smart-cactus.org>
Sun, 4 Mar 2018 02:50:31 +0000 (21:50 -0500)
Requires some ghc-cabal changes as well.

Test Plan: ./validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: hsyl20, erikd, alpmestan, rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4453

libraries/Cabal
libraries/base/configure.ac
rules/build-package.mk
testsuite/tests/driver/T4437.hs
utils/check-api-annotations/check-api-annotations.cabal
utils/check-ppr/check-ppr.cabal
utils/ghc-cabal/Main.hs
utils/ghc-cabal/ghc-cabal.cabal
utils/ghctags/ghctags.cabal

index 578d3a5..98a72c9 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 578d3a50db818223017b8891df268d4200b8ffd3
+Subproject commit 98a72c9da6f56a9917b66d7532df755719ec7a25
index f472319..a141a25 100644 (file)
@@ -234,10 +234,10 @@ AS_IF([test "x$with_libcharset" != xno],
 fi
 
 # Hack - md5.h needs HsFFI.h.  Is there a better way to do this?
-CFLAGS="-I../../includes $CFLAGS"
+CFLAGS="-I../.. -I../../../../includes $CFLAGS"
 dnl Calling AC_CHECK_TYPE(T) makes AC_CHECK_SIZEOF(T) abort on failure
 dnl instead of considering sizeof(T) as 0.
-AC_CHECK_TYPE([struct MD5Context], [], [], [#include "include/md5.h"])
+AC_CHECK_TYPE([struct MD5Context], [], [AC_MSG_ERROR([internal error])], [#include "include/md5.h"])
 AC_CHECK_SIZEOF([struct MD5Context], [], [#include "include/md5.h"])
 
 AC_SUBST(EXTRA_LIBS)
index fb04f02..c29155c 100644 (file)
@@ -155,7 +155,7 @@ endif
 
 # Don't put bootstrapping packages in the bindist
 ifneq "$3" "0"
-BINDIST_EXTRAS += $1/*.cabal $$(wildcard $1/*.buildinfo) $1/$2/setup-config $1/LICENSE
+BINDIST_EXTRAS += $1/*.cabal $$(wildcard $1/*.buildinfo) $$(wildcard $1/dist-install/build/*.buildinfo) $1/$2/setup-config $1/LICENSE
 BINDIST_EXTRAS += $$($1_$2_INSTALL_INCLUDES_SRCS)
 endif
 
index d82e434..9f892c9 100644 (file)
@@ -41,6 +41,7 @@ expectedGhcOnlyExtensions = ["RelaxedLayout",
                              "AlternativeLayoutRuleTransitional",
                              "EmptyDataDeriving",
                              "NumericUnderscores",
+                             "BlockArguments",
                              "GeneralisedNewtypeDeriving"]
 
 expectedCabalOnlyExtensions :: [String]
index f2b3d74..3cdb378 100644 (file)
@@ -24,6 +24,6 @@ Executable check-api-annotations
 
     Build-Depends: base       >= 4   && < 5,
                    containers,
-                   Cabal      >= 2.1 && < 2.2,
+                   Cabal      >= 2.2 && < 2.3,
                    directory,
                    ghc
index e788927..d7429c8 100644 (file)
@@ -25,7 +25,7 @@ Executable check-ppr
     Build-Depends: base       >= 4   && < 5,
                    bytestring,
                    containers,
-                   Cabal      >= 2.1 && < 2.2,
+                   Cabal      >= 2.2 && < 2.3,
                    directory,
                    filepath,
                    ghc
index 3faf998..a918895 100644 (file)
@@ -15,7 +15,7 @@ import Distribution.Simple.GHC
 import Distribution.Simple.Program
 import Distribution.Simple.Program.HcPkg
 import Distribution.Simple.Setup (ConfigFlags(configStripLibs), fromFlag, toFlag)
-import Distribution.Simple.Utils (defaultPackageDesc, writeFileAtomic,
+import Distribution.Simple.Utils (defaultPackageDesc, findHookedPackageDesc, writeFileAtomic,
                                   toUTF8LBS)
 import Distribution.Simple.Build (writeAutogenFiles)
 import Distribution.Simple.Register
@@ -27,6 +27,7 @@ import qualified Distribution.Simple.PackageIndex as PackageIndex
 
 import Control.Exception (bracket)
 import Control.Monad
+import Control.Applicative ((<|>))
 import Data.List
 import Data.Maybe
 import System.IO
@@ -268,7 +269,13 @@ generate directory distdir config_args
       hooked_bi <-
            if (buildType pd0 == Configure) || (buildType pd0 == Custom)
            then do
-              maybe_infoFile <- defaultHookedPackageDesc
+              cwd <- getCurrentDirectory
+              -- Try to find the .buildinfo in the $dist/build folder where
+              -- cabal 2.2+ will expect it, but fallback to the old default
+              -- location if we don't find any.  This is the case of the
+              -- bindist, which doesn't ship the $dist/build folder.
+              maybe_infoFile <- findHookedPackageDesc (cwd </> distdir </> "build")
+                                <|> defaultHookedPackageDesc
               case maybe_infoFile of
                   Nothing       -> return emptyHookedBuildInfo
                   Just infoFile -> readHookedBuildInfo verbosity infoFile
@@ -284,13 +291,16 @@ generate directory distdir config_args
       -- generate inplace-pkg-config
       withLibLBI pd lbi $ \lib clbi ->
           do cwd <- getCurrentDirectory
+             let fixupIncludeDir dir | cwd `isPrefixOf` dir = [dir, cwd </> distdir </> "build" ++ drop (length cwd) dir]
+                                     | otherwise            = [dir]
              let ipid = mkUnitId (display (packageId pd))
              let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir
                                         pd (mkAbiHash "inplace") lib lbi clbi
                  final_ipi = installedPkgInfo {
                                  Installed.installedUnitId = ipid,
                                  Installed.compatPackageKey = display (packageId pd),
-                                 Installed.haddockHTMLs = []
+                                 Installed.haddockHTMLs = [],
+                                 Installed.includeDirs = concatMap fixupIncludeDir (Installed.includeDirs installedPkgInfo)
                              }
                  content = Installed.showInstalledPackageInfo final_ipi ++ "\n"
              writeFileAtomic (distdir </> "inplace-pkg-config")
@@ -369,11 +379,20 @@ generate directory distdir config_args
           mkLibraryRelDir "Cabal" = "libraries/Cabal/Cabal/dist-install/build"
           mkLibraryRelDir l       = "libraries/" ++ l ++ "/dist-install/build"
           libraryRelDirs = map mkLibraryRelDir transitiveDepNames
-      wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs
+
+          -- this is a hack to accommodate Cabal 2.2+ more hygenic
+          -- generated data.   We'll inject `dist-install/build` after
+          -- before the `include` directory, if any.
+          injectDistInstall :: FilePath -> [FilePath]
+          injectDistInstall x | takeBaseName x == "include" = [x, takeDirectory x ++ "/dist-install/build/" ++ takeBaseName x]
+          injectDistInstall x = [x]
+
+      wrappedIncludeDirs <- wrap $ concatMap injectDistInstall $ forDeps Installed.includeDirs
 
       let variablePrefix = directory ++ '_':distdir
           mods      = map display modules
           otherMods = map display (otherModules bi)
+          buildDir' = map (\c -> if c=='\\' then '/' else c) $ buildDir lbi
       let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)),
                 -- TODO: move inside withLibLBI
                 variablePrefix ++ "_COMPONENT_ID = " ++ localCompatPackageKey lbi,
@@ -387,7 +406,9 @@ generate directory distdir config_args
                 variablePrefix ++ "_DEP_COMPONENT_IDS = " ++ unwords depLibNames,
                 variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames,
                 variablePrefix ++ "_TRANSITIVE_DEP_COMPONENT_IDS = " ++ unwords transitiveDepLibNames,
-                variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi),
+                variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (  [ dir | dir <- includeDirs bi ]
+                                                                ++ [ buildDir' ++ "/" ++ dir | dir <- includeDirs bi
+                                                                                             , not (isAbsolute dir)]),
                 variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi),
                 variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi),
                 variablePrefix ++ "_EXTRA_LIBRARIES = " ++ unwords (extraLibs bi),
index 7f413b6..4b19116 100644 (file)
@@ -21,7 +21,7 @@ Executable ghc-cabal
 
     Build-Depends: base       >= 3   && < 5,
                    bytestring >= 0.10 && < 0.11,
-                   Cabal      >= 2.1 && < 2.2,
+                   Cabal      >= 2.2 && < 2.3,
                    directory  >= 1.1 && < 1.4,
                    filepath   >= 1.2 && < 1.5
 
index 0e2bc52..c798a93 100644 (file)
@@ -18,6 +18,6 @@ Executable ghctags
 
     Build-Depends: base       >= 4   && < 5,
                    containers,
-                   Cabal      >= 2.1 && <2.2,
+                   Cabal      >= 2.2 && <2.3,
                    ghc