Commit 56e4627b authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Change the way we handle the version number during bootstrapping

Means we only need to have the version in one place now. Yay.
parent f631930f
......@@ -18,6 +18,7 @@ Description:
The Haskell Cabal is part of a larger infrastructure for distributing,
organizing, and cataloging Haskell libraries and tools.
Category: Distribution
cabal-version: >=1.6
Build-Type: Custom
-- Even though we do use the default Setup.lhs it's vital to bootstrapping
-- that we build Setup.lhs using our own local Cabal source code.
......@@ -120,7 +121,8 @@ Library
Distribution.Compat.CopyFile,
Distribution.Compat.TempFile,
Distribution.Simple.GHC.IPI641,
Distribution.Simple.GHC.IPI642
Distribution.Simple.GHC.IPI642,
Paths_Cabal
Extensions: CPP
......
......@@ -895,7 +895,6 @@ checkCabalVersion pkg =
-- version.
checkVersion :: [Int] -> Bool -> PackageCheck -> Maybe PackageCheck
checkVersion ver cond pc
| packageName pkg == PackageName "Cabal" = Nothing
| specVersion pkg >= Version ver [] = Nothing
| otherwise = check cond pc
......
......@@ -76,8 +76,7 @@ import Text.PrettyPrint.HughesPJ
import Distribution.ParseUtils hiding (parseFields)
import Distribution.PackageDescription
import Distribution.Package
( PackageName(..), PackageIdentifier(..), Dependency(..)
, packageName, packageVersion )
( PackageIdentifier(..), Dependency(..), packageName, packageVersion )
import Distribution.ModuleName ( ModuleName )
import Distribution.Version
( Version(Version), orLaterVersion
......@@ -623,10 +622,6 @@ parsePackageDescription file = do
"Do not use tabs for indentation (use spaces instead)\n"
++ " Tabs were used at (line,column): " ++ show tabs
maybeWarnCabalVersion _ pkg
| packageName pkg == PackageName "Cabal" -- supress warning for Cabal
= return ()
maybeWarnCabalVersion newsyntax pkg
| newsyntax && specVersion pkg < Version [1,2] []
= lift $ warning $
......
......@@ -104,7 +104,7 @@ import Distribution.Simple.BuildPaths
( autogenModulesDir )
import Distribution.Simple.Utils
( die, warn, info, setupMessage, createDirectoryIfMissingVerbose
, intercalate, cabalVersion, cabalBootstrapping
, intercalate, cabalVersion
, withFileContents, writeFileAtomic
, withTempFile )
import Distribution.System
......@@ -222,9 +222,7 @@ showHeader pkgid =
where
currentCabalId :: PackageIdentifier
currentCabalId = PackageIdentifier (PackageName "Cabal") currentVersion
where currentVersion | cabalBootstrapping = Version [0] []
| otherwise = cabalVersion
currentCabalId = PackageIdentifier (PackageName "Cabal") cabalVersion
currentCompilerId :: PackageIdentifier
currentCompilerId = PackageIdentifier (PackageName System.Info.compilerName)
......
......@@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Utils (
cabalVersion,
cabalBootstrapping,
-- * logging and errors
die,
......@@ -196,19 +195,16 @@ import Distribution.Compat.Exception
( catchIO, catchExit, onException )
import Distribution.Verbosity
-- We only get our own version number when we're building with ourselves
cabalVersion :: Version
#ifdef CABAL_VERSION
cabalVersion = Version [CABAL_VERSION] []
#else
cabalVersion = error "Cabal was not bootstrapped correctly"
#ifdef VERSION_base
import qualified Paths_Cabal (version)
#endif
cabalBootstrapping :: Bool
#ifdef CABAL_VERSION
cabalBootstrapping = False
-- We only get our own version number when we're building with ourselves
cabalVersion :: Version
#ifdef VERSION_base
cabalVersion = Paths_Cabal.version
#else
cabalBootstrapping = True
cabalVersion = Version [1,9999] [] --used when bootstrapping
#endif
-- ----------------------------------------------------------------------------
......
......@@ -23,11 +23,10 @@ DISTLOC=dist/release
DIST_STAMP=$(DISTLOC)/Cabal-$(VERSION).tar.gz
COMMA=,
VERSION_VALUE=$(subst .,$(COMMA),$(VERSION))
setup: $(SOURCES) Setup.hs
-mkdir -p dist/setup
$(HC) $(GHCFLAGS) --make -DCABAL_VERSION=$(VERSION_VALUE) -i. -odir dist/setup -hidir dist/setup Setup.hs -o setup
$(HC) $(GHCFLAGS) --make -i. -odir dist/setup -hidir dist/setup Setup.hs -o setup
Setup-nhc:
hmake -nhc98 -package base -prelude Setup
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment