From 2cf65bf48ce400c9407b02920f17f9c497a2d28d Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" <ezyang@cs.stanford.edu> Date: Thu, 28 May 2015 14:48:09 -0700 Subject: [PATCH] Add libname install-dirs variable, use it by default. Fixes #2437. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> --- Cabal/Distribution/Simple/InstallDirs.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Cabal/Distribution/Simple/InstallDirs.hs b/Cabal/Distribution/Simple/InstallDirs.hs index 41f4d9173f..312622d035 100644 --- a/Cabal/Distribution/Simple/InstallDirs.hs +++ b/Cabal/Distribution/Simple/InstallDirs.hs @@ -57,7 +57,7 @@ import System.FilePath ((</>), isPathSeparator, pathSeparator) import System.FilePath (dropDrive) import Distribution.Package - ( PackageIdentifier, PackageKey, packageName, packageVersion ) + ( PackageIdentifier, PackageKey, packageName, packageVersion, packageKeyLibraryName ) import Distribution.System ( OS(..), buildOS, Platform(..) ) import Distribution.Compiler @@ -183,7 +183,7 @@ appendSubdirs append dirs = dirs { -- users to be able to configure @--libdir=\/usr\/lib64@ for example but -- because by default we want to support installing multiple versions of -- packages and building the same package for multiple compilers we append the --- libsubdir to get: @\/usr\/lib64\/$pkgkey\/$compiler@. +-- libsubdir to get: @\/usr\/lib64\/$libname\/$compiler@. -- -- An additional complication is the need to support relocatable packages on -- systems which support such things, like Windows. @@ -216,10 +216,10 @@ defaultInstallDirs comp userInstall _hasLibs = do JHC -> "$compiler" LHC -> "$compiler" UHC -> "$pkgid" - _other -> "$abi" </> "$pkgkey", + _other -> "$abi" </> "$libname", dynlibdir = "$libdir", libexecdir = case buildOS of - Windows -> "$prefix" </> "$pkgkey" + Windows -> "$prefix" </> "$libname" _other -> "$prefix" </> "libexec", includedir = "$libdir" </> "$libsubdir" </> "include", datadir = case buildOS of @@ -373,6 +373,7 @@ data PathTemplateVariable = | PkgVerVar -- ^ The @$version@ package version path variable | PkgIdVar -- ^ The @$pkgid@ package Id path variable, eg @foo-1.0@ | PkgKeyVar -- ^ The @$pkgkey@ package key path variable + | LibNameVar -- ^ The @$libname@ expanded package key path variable | CompilerVar -- ^ The compiler name and version, eg @ghc-6.6.1@ | OSVar -- ^ The operating system name, eg @windows@ or @linux@ | ArchVar -- ^ The CPU architecture name, eg @i386@ or @x86_64@ @@ -430,6 +431,7 @@ packageTemplateEnv pkgId pkg_key = [(PkgNameVar, PathTemplate [Ordinary $ display (packageName pkgId)]) ,(PkgVerVar, PathTemplate [Ordinary $ display (packageVersion pkgId)]) ,(PkgKeyVar, PathTemplate [Ordinary $ display pkg_key]) + ,(LibNameVar, PathTemplate [Ordinary $ packageKeyLibraryName pkgId pkg_key]) ,(PkgIdVar, PathTemplate [Ordinary $ display pkgId]) ] @@ -479,6 +481,7 @@ installDirsTemplateEnv dirs = instance Show PathTemplateVariable where show PrefixVar = "prefix" show PkgKeyVar = "pkgkey" + show LibNameVar = "libname" show BindirVar = "bindir" show LibdirVar = "libdir" show LibsubdirVar = "libsubdir" @@ -516,6 +519,7 @@ instance Read PathTemplateVariable where ,("htmldir", HtmldirVar) ,("pkgid", PkgIdVar) ,("pkgkey", PkgKeyVar) + ,("libname", LibNameVar) ,("pkg", PkgNameVar) ,("version", PkgVerVar) ,("compiler", CompilerVar) -- GitLab