Skip to content

Commit

Permalink
Bump Cabal submodule to 2.2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
angerman authored and bgamari committed Mar 4, 2018
1 parent 4631ceb commit 8f0b2f5
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion libraries/Cabal
Submodule Cabal updated from 578d3a to 98a72c
4 changes: 2 additions & 2 deletions libraries/base/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rules/build-package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/driver/T4437.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ expectedGhcOnlyExtensions = ["RelaxedLayout",
"AlternativeLayoutRuleTransitional",
"EmptyDataDeriving",
"NumericUnderscores",
"BlockArguments",
"GeneralisedNewtypeDeriving"]

expectedCabalOnlyExtensions :: [String]
Expand Down
2 changes: 1 addition & 1 deletion utils/check-api-annotations/check-api-annotations.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion utils/check-ppr/check-ppr.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 26 additions & 5 deletions utils/ghc-cabal/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion utils/ghc-cabal/ghc-cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion utils/ghctags/ghctags.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Executable ghctags

Build-Depends: base >= 4 && < 5,
containers,
Cabal >= 2.1 && <2.2,
Cabal >= 2.2 && <2.3,
ghc

0 comments on commit 8f0b2f5

Please sign in to comment.