Commit 7fa8f884 authored by Luite Stegeman's avatar Luite Stegeman
Browse files

add data-dir to InstalledPackageInfo

the datadir location for the inplace InstallDirs was pointing to the top directory
of the package instead of the directory containing the data. this has been fixed.
since templates have already been expanded at this point, datasubdir raises an
exception an cannot be used in generalInstalledPackageInfo. therefore the
full path is stored in datadir.
parent 23127088
......@@ -91,6 +91,7 @@ data InstalledPackageInfo_ m
trusted :: Bool,
importDirs :: [FilePath],
libraryDirs :: [FilePath],
dataDir :: FilePath,
hsLibraries :: [String],
extraLibraries :: [String],
extraGHCiLibraries:: [String], -- overrides extraLibraries for GHCi
......@@ -140,6 +141,7 @@ emptyInstalledPackageInfo
trusted = False,
importDirs = [],
libraryDirs = [],
dataDir = "",
hsLibraries = [],
extraLibraries = [],
extraGHCiLibraries= [],
......@@ -318,6 +320,9 @@ installedFieldDescrs = [
, listField "library-dirs"
showFilePath parseFilePathQ
libraryDirs (\xs pkg -> pkg{libraryDirs=xs})
, simpleField "data-dir"
showFilePath (parseFilePathQ Parse.<++ return "")
dataDir (\val pkg -> pkg{dataDir=val})
, listField "hs-libraries"
showFilePath parseTokenQ
hsLibraries (\xs pkg -> pkg{hsLibraries=xs})
......
......@@ -88,6 +88,7 @@ toCurrent ipi@InstalledPackageInfo{} =
Current.trusted = Current.trusted Current.emptyInstalledPackageInfo,
Current.importDirs = importDirs ipi,
Current.libraryDirs = libraryDirs ipi,
Current.dataDir = "",
Current.hsLibraries = hsLibraries ipi,
Current.extraLibraries = extraLibraries ipi,
Current.extraGHCiLibraries = [],
......
......@@ -123,6 +123,7 @@ toCurrent ipi@InstalledPackageInfo{} =
Current.trusted = Current.trusted Current.emptyInstalledPackageInfo,
Current.importDirs = importDirs ipi,
Current.libraryDirs = libraryDirs ipi,
Current.dataDir = "",
Current.hsLibraries = hsLibraries ipi,
Current.extraLibraries = extraLibraries ipi,
Current.extraGHCiLibraries = extraGHCiLibraries ipi,
......
......@@ -276,9 +276,12 @@ generalInstalledPackageInfo adjustRelIncDirs pkg ipid lib lbi clbi installDirs =
IPI.hiddenModules = otherModules bi,
IPI.trusted = IPI.trusted IPI.emptyInstalledPackageInfo,
IPI.importDirs = [ libdir installDirs | hasModules ],
-- Note. the libsubdir and datasubdir templates have already been expanded
-- into libdir and datadir.
IPI.libraryDirs = if hasLibrary
then libdir installDirs : extraLibDirs bi
else extraLibDirs bi,
IPI.dataDir = datadir installDirs,
IPI.hsLibraries = [ libname
| LibraryName libname <- componentLibraries clbi
, hasLibrary ],
......@@ -335,8 +338,7 @@ inplaceInstalledPackageInfo inplaceDir distPref pkg ipid lib lbi clbi =
installDirs =
(absoluteInstallDirs pkg lbi NoCopyDest) {
libdir = inplaceDir </> buildDir lbi,
datadir = inplaceDir,
datasubdir = distPref,
datadir = inplaceDir </> dataDir pkg,
docdir = inplaceDocdir,
htmldir = inplaceHtmldir,
haddockdir = inplaceHtmldir
......
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