Commit 3a75dc98 authored by ijones's avatar ijones
Browse files

mostly changed showPackageId to pkgName.

** I'm not sure why I was encoding the version string into the package
   name for ghc-pkg.  I got rid of this.  Seems to still be happy.

** Had to fix some test cases for this also.
parent 9ab102e6
......@@ -112,7 +112,7 @@ tests = [TestLabel "testing the HUnit package" $ TestCase $
do oldDir <- getCurrentDirectory
setCurrentDirectory "test/HUnit-1.0"
pkgConf <- GHC.localPackageConfig
system $ "ghc-pkg --config-file=" ++ pkgConf ++ " -r HUnit-1.0"
system $ "ghc-pkg --config-file=" ++ pkgConf ++ " -r HUnit"
system "make clean"
system "make"
assertCmd "./setup configure --prefix=\",tmp\"" "hunit configure"
......@@ -126,14 +126,14 @@ tests = [TestLabel "testing the HUnit package" $ TestCase $
assertCmd "./setup build" "hunit build"
assertCmd "./setup install --user" "hunit install"
assertCmd ("ghc -package-conf " ++ pkgConf ++ " -package HUnit-1.0 HUnitTester.hs -o ./hunitTest") "compile w/ hunit"
assertCmd ("ghc -package-conf " ++ pkgConf ++ " -package HUnit HUnitTester.hs -o ./hunitTest") "compile w/ hunit"
assertCmd "./hunitTest" "hunit test"
assertCmd ("ghc-pkg --config-file=" ++ pkgConf ++ " -r HUnit-1.0") "package remove"
assertCmd ("ghc-pkg --config-file=" ++ pkgConf ++ " -r HUnit") "package remove"
setCurrentDirectory oldDir,
TestLabel "package A: configure GHC, sdist" $ TestCase $
do pkgConf <- GHC.localPackageConfig
system $ "ghc-pkg -r test-1.0 --config-file=" ++ pkgConf
system $ "ghc-pkg -r test --config-file=" ++ pkgConf
setCurrentDirectory "test/A"
system "make clean"
system "make"
......
......@@ -49,7 +49,7 @@ module Distribution.Simple.Build (
import Distribution.Misc (Extension(..), extensionsToNHCFlag, extensionsToGHCFlag)
import Distribution.Setup (CompilerFlavor(..), compilerFlavor, compilerPath)
import Distribution.Package (PackageDescription(..), BuildInfo(..), showPackageId)
import Distribution.Package (PackageDescription(..), BuildInfo(..), showPackageId, pkgName)
import Distribution.Simple.Configure (LocalBuildInfo(..), compiler)
import Distribution.Simple.Utils (rawSystemExit, setupMessage,
die, rawSystemPathExit,
......@@ -121,13 +121,13 @@ constructGHCCmdLine pref pkg_descr lbi =
in if null unsupported
then [
"--make", "-odir " ++ pref, "-hidir " ++ pref,
"-package-name", showPackageId (package pkg_descr)
"-package-name", pkgName (package pkg_descr)
]
++ flags
++ [ opt | (GHC,opts) <- maybe [] options (library pkg_descr),
opt <- opts ]
++ [ "-i" ++ pref ]
++ [ "-package " ++ showPackageId pkg | pkg <- packageDeps lbi ]
++ [ "-package " ++ pkgName pkg | pkg <- packageDeps lbi ]
++ maybe [] modules (library pkg_descr)
else error $ "Unsupported extension for GHC: "
++ (concat $ intersperse ", " (map show unsupported))
......
......@@ -18,7 +18,7 @@ module Distribution.Simple.GHCPackageConfig (
localPackageConfig
) where
import Distribution.Package (PackageDescription(..), BuildInfo(..), showPackageId)
import Distribution.Package (PackageDescription(..), BuildInfo(..), pkgName, showPackageId)
import Distribution.Simple.Configure (LocalBuildInfo(..))
import Distribution.Simple.Install (mkImportDir)
import Distribution.Simple.Utils(pathJoin)
......@@ -43,14 +43,14 @@ mkGHCPackageConfig pkg_descr lbi
auto = True,
import_dirs = [mkImportDir pkg_descr lbi],
library_dirs = [mkImportDir pkg_descr lbi],
hs_libraries = ["HS"++pkg_name],
hs_libraries = ["HS"++(showPackageId (package pkg_descr))],
extra_libraries = maybe [] extraLibs (library pkg_descr),
include_dirs = maybe [] includeDirs (library pkg_descr),
c_includes = maybe [] includes (library pkg_descr),
package_deps = map showPackageId (packageDeps lbi)
package_deps = map pkgName (packageDeps lbi)
}
where
pkg_name = showPackageId (package pkg_descr)
pkg_name = pkgName (package pkg_descr)
data GHCPackageConfig
= GHCPackage {
......
......@@ -52,7 +52,7 @@ module Distribution.Simple.Register (
import Distribution.Simple.Configure (LocalBuildInfo, compiler)
import Distribution.Setup (CompilerFlavor(..), Compiler(..))
import Distribution.Package (PackageDescription, package, showPackageId)
import Distribution.Package (PackageDescription, package, pkgName)
import Distribution.Simple.Utils (setupMessage, rawSystemExit, die)
import Distribution.Simple.GHCPackageConfig (mkGHCPackageConfig, showGHCPackageConfig)
import qualified Distribution.Simple.GHCPackageConfig as GHC (localPackageConfig)
......@@ -97,7 +97,7 @@ unregister pkg_descr lbi = do
die ("only unregistering with GHC is implemented")
rawSystemExit (compilerPkgTool (compiler lbi))
["--remove-package=" ++ showPackageId (package pkg_descr)]
["--remove-package=" ++ pkgName (package pkg_descr)]
-- ------------------------------------------------------------
......
......@@ -5,9 +5,10 @@
name)
** Build executables for mainModules
** Extensions
- add as many as possible
- complain if their use makes the code non-portable
** does clean remove installed-pkg-config and .setup-config or
whatever? should the former be a . file?
** license parser parses either known strings, or a filename.
** port code to windows
** ./Setup.lhs build for nhc
......
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