Commit 973d968a authored by ijones's avatar ijones
Browse files

fixed registration problems

** added installpath to the library_dirs variable. this makes it so
   that register will not give the error "cannot find `libtest-1.0.a'
   on library path"
** added HS to library name in package config
** added labels to test cases
** added test case
** added ghc-pkg unregister for test case, so that it won't fail.
parent 92a364ec
......@@ -97,8 +97,9 @@ checkTargetDir targetDir suffixes
return ()
tests :: [Test]
tests = [TestCase $
do setCurrentDirectory "test"
tests = [TestLabel "configure GHC, sdist" $ TestCase $
do system "ghc-pkg -r test-1.0 --config-file=$HOME/.ghc-packages"
setCurrentDirectory "test"
dirE1 <- doesDirectoryExist ",tmp"
when dirE1 (system "rm -r ,tmp">>return())
dirE2 <- doesDirectoryExist "dist"
......@@ -116,14 +117,21 @@ tests = [TestCase $
assertEqual "dist/src exists" False
doesDirectoryExist "dist/build" >>=
assertBool "dist/build doesn't exists",
TestCase $ -- GHC and --install-prefix (uses above config)
TestLabel "GHC and install-prefix" $ TestCase $ -- (uses above config)
do let targetDir = ",tmp2"
instRetCode <- system $ "./setup install --install-prefix=" ++ targetDir
checkTargetDir ",tmp2/lib/test-1.0/" [".hi"]
doesFileExist (pathJoin [",tmp2/lib/test-1.0/", "libHStest-1.0.a"])
>>= assertBool "library doesn't exist"
assertEqual "install returned error code" ExitSuccess instRetCode,
TestCase $ -- no intsall-prefix and hugs
TestLabel "GHC and install w/ no prefix" $ TestCase $
do let targetDir = ",tmp/lib/test-1.0/"
instRetCode <- system $ "./setup install --user"
checkTargetDir targetDir [".hi"]
doesFileExist (pathJoin [targetDir, "libHStest-1.0.a"])
>>= assertBool "library doesn't exist"
assertEqual "install returned error code" ExitSuccess instRetCode,
TestLabel "no install-prefix and hugs" $ TestCase $
do system "./setup configure --hugs --prefix=,tmp"
>>= assertEqual "HUGS configure returned error code" ExitSuccess
system "./setup build"
......
......@@ -35,7 +35,8 @@ mkGHCPackageConfig pkg_descr lbi
name = pkg_name,
auto = True,
import_dirs = [mkImportDir pkg_descr lbi],
hs_libraries = [pkg_name],
library_dirs = [mkImportDir pkg_descr lbi],
hs_libraries = ["HS"++pkg_name],
extra_libraries = extraLibs pkg_descr,
include_dirs = includeDirs pkg_descr,
c_includes = includes pkg_descr,
......
......@@ -102,9 +102,9 @@ installHugs pref buildPref pkg_descr
mkImportDir :: PackageDescription -> LocalBuildInfo -> FilePath
mkImportDir pkg_descr lbi =
#ifdef mingw32_TARGET_OS
prefix lbi ++ '/':pkg_name
pathJoin [prefix lbi, pkg_name
#else
prefix lbi ++ "/lib/" ++ pkg_name
pathJoin [prefix lbi, "lib", pkg_name]
#endif
where
pkg_name = showPackageId (package pkg_descr)
......
Supports Markdown
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