diff --git a/Cabal/Distribution/Simple/Build/PathsModule.hs b/Cabal/Distribution/Simple/Build/PathsModule.hs index c70f34ad1a9..5da4338ab07 100644 --- a/Cabal/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/Distribution/Simple/Build/PathsModule.hs @@ -71,7 +71,7 @@ generate pkg_descr lbi = pragmas++ "module " ++ display paths_modulename ++ " (\n"++ " version,\n"++ - " getBinDir, getLibDir, getDataDir, getLibexecDir,\n"++ + " getBinDir, getLibDir, getHiDir, getDataDir, getLibexecDir,\n"++ " getDataFileName, getSysconfDir\n"++ " ) where\n"++ "\n"++ @@ -108,9 +108,10 @@ generate pkg_descr lbi = "\n\nbindirrel :: FilePath\n" ++ "bindirrel = " ++ show flat_bindirreloc ++ "\n"++ - "\ngetBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++ + "\ngetBinDir, getLibDir, getHiDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++ "getBinDir = "++mkGetEnvOrReloc "bindir" flat_bindirreloc++"\n"++ "getLibDir = "++mkGetEnvOrReloc "libdir" flat_libdirreloc++"\n"++ + "getHiDir = "++mkGetEnvOrReloc "hidir" flat_hidirreloc++"\n"++ "getDataDir = "++mkGetEnvOrReloc "datadir" flat_datadirreloc++"\n"++ "getLibexecDir = "++mkGetEnvOrReloc "libexecdir" flat_libexecdirreloc++"\n"++ "getSysconfDir = "++mkGetEnvOrReloc "sysconfdir" flat_sysconfdirreloc++"\n"++ @@ -124,16 +125,18 @@ generate pkg_descr lbi = "\n"++ filename_stuff | absolute = - "\nbindir, libdir, datadir, libexecdir, sysconfdir :: FilePath\n"++ + "\nbindir, libdir, hidir, datadir, libexecdir, sysconfdir :: FilePath\n"++ "\nbindir = " ++ show flat_bindir ++ "\nlibdir = " ++ show flat_libdir ++ + "\nhidir = " ++ show flat_hidir ++ "\ndatadir = " ++ show flat_datadir ++ "\nlibexecdir = " ++ show flat_libexecdir ++ "\nsysconfdir = " ++ show flat_sysconfdir ++ "\n"++ - "\ngetBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++ + "\ngetBinDir, getLibDir, getHiDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++ "getBinDir = "++mkGetEnvOr "bindir" "return bindir"++"\n"++ "getLibDir = "++mkGetEnvOr "libdir" "return libdir"++"\n"++ + "getHiDir = "++mkGetEnvOr "hidir" "return hidir"++"\n"++ "getDataDir = "++mkGetEnvOr "datadir" "return datadir"++"\n"++ "getLibexecDir = "++mkGetEnvOr "libexecdir" "return libexecdir"++"\n"++ "getSysconfDir = "++mkGetEnvOr "sysconfdir" "return sysconfdir"++"\n"++ @@ -151,6 +154,8 @@ generate pkg_descr lbi = "getBinDir = getPrefixDirRel bindirrel\n\n"++ "getLibDir :: IO FilePath\n"++ "getLibDir = "++mkGetDir flat_libdir flat_libdirrel++"\n\n"++ + "getHiDir :: IO FilePath\n"++ + "getHiDir = "++mkGetDir flat_hidir flat_hidirrel++"\n\n"++ "getDataDir :: IO FilePath\n"++ "getDataDir = "++ mkGetEnvOr "datadir" (mkGetDir flat_datadir flat_datadirrel)++"\n\n"++ @@ -173,6 +178,7 @@ generate pkg_descr lbi = prefix = flat_prefix, bindir = flat_bindir, libdir = flat_libdir, + hidir = flat_hidir, datadir = flat_datadir, libexecdir = flat_libexecdir, sysconfdir = flat_sysconfdir @@ -180,6 +186,7 @@ generate pkg_descr lbi = InstallDirs { bindir = flat_bindirrel, libdir = flat_libdirrel, + hidir = flat_hidirrel, datadir = flat_datadirrel, libexecdir = flat_libexecdirrel, sysconfdir = flat_sysconfdirrel @@ -187,6 +194,7 @@ generate pkg_descr lbi = flat_bindirreloc = shortRelativePath flat_prefix flat_bindir flat_libdirreloc = shortRelativePath flat_prefix flat_libdir + flat_hidirreloc = shortRelativePath flat_prefix flat_hidir flat_datadirreloc = shortRelativePath flat_prefix flat_datadir flat_libexecdirreloc = shortRelativePath flat_prefix flat_libexecdir flat_sysconfdirreloc = shortRelativePath flat_prefix flat_sysconfdir diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs index 6903f5f1c69..78c4a68eded 100644 --- a/Cabal/Distribution/Simple/Configure.hs +++ b/Cabal/Distribution/Simple/Configure.hs @@ -684,6 +684,7 @@ configure (pkg_descr0', pbi) cfg = do dirinfo "Binaries" (bindir dirs) (bindir relative) dirinfo "Libraries" (libdir dirs) (libdir relative) + dirinfo "Interfaces" (hidir dirs) (hidir relative) dirinfo "Private binaries" (libexecdir dirs) (libexecdir relative) dirinfo "Data files" (datadir dirs) (datadir relative) dirinfo "Documentation" (docdir dirs) (docdir relative) @@ -2013,7 +2014,7 @@ checkRelocatable verbosity pkg lbi all isJust (fmap (stripPrefix p) [ bindir, libdir, dynlibdir, libexecdir, includedir, datadir - , docdir, mandir, htmldir, haddockdir, sysconfdir] ) + , hidir, docdir, mandir, htmldir, haddockdir, sysconfdir] ) -- Check if the library dirs of the dependencies that are in the package -- database to which the package is installed are relative to the diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index 5e2a1310f62..126dedcbd6b 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -1116,12 +1116,13 @@ installLib :: Verbosity -> LocalBuildInfo -> FilePath -- ^install location -> FilePath -- ^install location for dynamic libraries + -> FilePath -- ^install location for interfaces -> FilePath -- ^Build location -> PackageDescription -> Library -> ComponentLocalBuildInfo -> IO () -installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do +installLib verbosity lbi targetDir dynlibTargetDir hiTargetDir builtDir _pkg lib clbi = do -- copy .hi files over: whenVanilla $ copyModuleFiles "hi" whenProf $ copyModuleFiles "p_hi" @@ -1151,7 +1152,7 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do copyModuleFiles ext = findModuleFiles [builtDir] [ext] (libModules lib) - >>= installOrdinaryFiles verbosity targetDir + >>= installOrdinaryFiles verbosity hiTargetDir cid = compilerId (compiler lbi) libName = componentUnitId clbi diff --git a/Cabal/Distribution/Simple/Install.hs b/Cabal/Distribution/Simple/Install.hs index b7934e495f2..f74b012a87d 100644 --- a/Cabal/Distribution/Simple/Install.hs +++ b/Cabal/Distribution/Simple/Install.hs @@ -60,6 +60,7 @@ install pkg_descr lbi flags = do installDirs@(InstallDirs { bindir = binPref, libdir = libPref, + hidir = hiPref, -- dynlibdir = dynlibPref, --see TODO below datadir = dataPref, docdir = docPref, @@ -130,7 +131,7 @@ install pkg_descr lbi flags = do withLibLBI pkg_descr lbi $ case compilerFlavor (compiler lbi) of - GHC -> GHC.installLib verbosity lbi libPref dynlibPref buildPref pkg_descr + GHC -> GHC.installLib verbosity lbi libPref dynlibPref hiPref buildPref pkg_descr GHCJS -> GHCJS.installLib verbosity lbi libPref dynlibPref buildPref pkg_descr LHC -> LHC.installLib verbosity lbi libPref dynlibPref buildPref pkg_descr JHC -> JHC.installLib verbosity lbi libPref dynlibPref buildPref pkg_descr diff --git a/Cabal/Distribution/Simple/InstallDirs.hs b/Cabal/Distribution/Simple/InstallDirs.hs index 49c6f3cb299..739112afba5 100644 --- a/Cabal/Distribution/Simple/InstallDirs.hs +++ b/Cabal/Distribution/Simple/InstallDirs.hs @@ -80,7 +80,17 @@ data InstallDirs dir = InstallDirs { prefix :: dir, bindir :: dir, libdir :: dir, - libsubdir :: dir, + binlibsubdir :: dir, + hidir :: dir, + libsubdir :: dir, -- This field is deprecated by the introduction of + -- binlibsubdir and hidir. However, + -- we must keep it so that we can still work with + -- Setup executables build against an older version + -- of Cabal. For the same reason, we cannot + -- simply use libsubdir as the binlibsubdir, + -- because then Setup's build against an older + -- Cabal would put .hi files in the same directory + -- as the library object files dynlibdir :: dir, libexecdir :: dir, includedir :: dir, @@ -110,6 +120,8 @@ combineInstallDirs combine a b = InstallDirs { prefix = prefix a `combine` prefix b, bindir = bindir a `combine` bindir b, libdir = libdir a `combine` libdir b, + binlibsubdir = binlibsubdir a `combine` binlibsubdir b, + hidir = hidir a `combine` hidir b, libsubdir = libsubdir a `combine` libsubdir b, dynlibdir = dynlibdir a `combine` dynlibdir b, libexecdir = libexecdir a `combine` libexecdir b, @@ -125,9 +137,9 @@ combineInstallDirs combine a b = InstallDirs { appendSubdirs :: (a -> a -> a) -> InstallDirs a -> InstallDirs a appendSubdirs append dirs = dirs { - libdir = libdir dirs `append` libsubdir dirs, + libdir = libdir dirs `append` binlibsubdir dirs, datadir = datadir dirs `append` datasubdir dirs, - libsubdir = error "internal error InstallDirs.libsubdir", + binlibsubdir = error "internal error InstallDirs.binlibsubdir", datasubdir = error "internal error InstallDirs.datasubdir" } @@ -148,7 +160,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\/$libname\/$compiler@. +-- binlibsubdir to get: @\/usr\/lib64\/$libname\/$compiler@. -- -- An additional complication is the need to support relocatable packages on -- systems which support such things, like Windows. @@ -177,6 +189,16 @@ defaultInstallDirs comp userInstall _hasLibs = do prefix = installPrefix, bindir = "$prefix" "bin", libdir = installLibDir, + binlibsubdir = case comp of + JHC -> "$compiler" + LHC -> "$compiler" + UHC -> "$pkgid" + _other -> "$abi", + hidir = "$libdir" case comp of + JHC -> "$compiler" + LHC -> "$compiler" + UHC -> "$pkgid" + _other -> "$abi" "$libname", libsubdir = case comp of JHC -> "$compiler" LHC -> "$compiler" @@ -186,7 +208,7 @@ defaultInstallDirs comp userInstall _hasLibs = do libexecdir = case buildOS of Windows -> "$prefix" "$libname" _other -> "$prefix" "libexec", - includedir = "$libdir" "$libsubdir" "include", + includedir = "$hidir" "include", datadir = case buildOS of Windows -> "$prefix" _other -> "$prefix" "share", @@ -222,10 +244,12 @@ substituteInstallDirTemplates env dirs = dirs' prefix = subst prefix [], bindir = subst bindir [prefixVar], libdir = subst libdir [prefixVar, bindirVar], + binlibsubdir = subst binlibsubdir [], + hidir = subst hidir prefixBinLibVars, libsubdir = subst libsubdir [], dynlibdir = subst dynlibdir [prefixVar, bindirVar, libdirVar], libexecdir = subst libexecdir prefixBinLibVars, - includedir = subst includedir prefixBinLibVars, + includedir = subst includedir (prefixBinLibVars ++ [hidirVar]), datadir = subst datadir prefixBinLibVars, datasubdir = subst datasubdir [], docdir = subst docdir prefixBinLibDataVars, @@ -240,12 +264,13 @@ substituteInstallDirTemplates env dirs = dirs' prefixVar = (PrefixVar, prefix dirs') bindirVar = (BindirVar, bindir dirs') libdirVar = (LibdirVar, libdir dirs') - libsubdirVar = (LibsubdirVar, libsubdir dirs') + binlibsubdirVar = (BinlibsubdirVar, binlibsubdir dirs') + hidirVar = (HidirVar, hidir dirs') datadirVar = (DatadirVar, datadir dirs') datasubdirVar = (DatasubdirVar, datasubdir dirs') docdirVar = (DocdirVar, docdir dirs') htmldirVar = (HtmldirVar, htmldir dirs') - prefixBinLibVars = [prefixVar, bindirVar, libdirVar, libsubdirVar] + prefixBinLibVars = [prefixVar, bindirVar, libdirVar, binlibsubdirVar] prefixBinLibDataVars = prefixBinLibVars ++ [datadirVar, datasubdirVar] -- | Convert from abstract install directories to actual absolute ones by @@ -330,6 +355,8 @@ data PathTemplateVariable = PrefixVar -- ^ The @$prefix@ path variable | BindirVar -- ^ The @$bindir@ path variable | LibdirVar -- ^ The @$libdir@ path variable + | BinlibsubdirVar -- ^ The @$binlibsubdir@ path variable + | HidirVar -- ^ The @$hidir@ path variable | LibsubdirVar -- ^ The @$libsubdir@ path variable | DatadirVar -- ^ The @$datadir@ path variable | DatasubdirVar -- ^ The @$datasubdir@ path variable @@ -425,7 +452,10 @@ installDirsTemplateEnv dirs = [(PrefixVar, prefix dirs) ,(BindirVar, bindir dirs) ,(LibdirVar, libdir dirs) - ,(LibsubdirVar, libsubdir dirs) + ,(BinlibsubdirVar, binlibsubdir dirs) + ,(HidirVar, hidir dirs) + ,(LibsubdirVar, libsubdir dirs) -- We need to keep this around for Setup's + -- build against older versions of Cabal ,(DatadirVar, datadir dirs) ,(DatasubdirVar, datasubdir dirs) ,(DocdirVar, docdir dirs) @@ -447,6 +477,8 @@ instance Show PathTemplateVariable where show LibNameVar = "libname" show BindirVar = "bindir" show LibdirVar = "libdir" + show BinlibsubdirVar = "binlibsubdir" + show HidirVar = "hidir" show LibsubdirVar = "libsubdir" show DatadirVar = "datadir" show DatasubdirVar = "datasubdir" @@ -475,6 +507,8 @@ instance Read PathTemplateVariable where where vars = [("prefix", PrefixVar) ,("bindir", BindirVar) ,("libdir", LibdirVar) + ,("binlibsubdir", BinlibsubdirVar) + ,("hidir", HidirVar) ,("libsubdir", LibsubdirVar) ,("datadir", DatadirVar) ,("datasubdir", DatasubdirVar) diff --git a/Cabal/Distribution/Simple/Register.hs b/Cabal/Distribution/Simple/Register.hs index d1bd0abcdbc..d4b6bc1cadd 100644 --- a/Cabal/Distribution/Simple/Register.hs +++ b/Cabal/Distribution/Simple/Register.hs @@ -320,8 +320,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi IPI.exposedModules = componentExposedModules clbi, 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 + IPI.importDirs = [ hidir installDirs | hasModules ], + -- Note. the binlibsubdir and datasubdir templates have already been expanded -- into libdir and datadir. IPI.libraryDirs = if hasLibrary then libdir installDirs : extraLibDirs bi @@ -378,6 +378,7 @@ inplaceInstalledPackageInfo inplaceDir distPref pkg abi_hash lib lbi clbi = (absoluteInstallDirs pkg lbi NoCopyDest) { libdir = inplaceDir libTargetDir, datadir = inplaceDir dataDir pkg, + hidir = inplaceDir libTargetDir, docdir = inplaceDocdir, htmldir = inplaceHtmldir, haddockdir = inplaceHtmldir diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs index cb7cb2ee3a5..54e23c80fc1 100644 --- a/Cabal/Distribution/Simple/Setup.hs +++ b/Cabal/Distribution/Simple/Setup.hs @@ -762,9 +762,14 @@ installDirsOptions = libdir (\v flags -> flags { libdir = v }) installDirArg - , option "" ["libsubdir"] - "subdirectory of libdir in which libs are installed" - libsubdir (\v flags -> flags { libsubdir = v }) + , option "" ["binlibsubdir"] + "subdirectory of libdir in which binary libraries are installed" + binlibsubdir (\v flags -> flags { binlibsubdir = v }) + installDirArg + + , option "" ["hidir"] + "installation directory for library interface files" + hidir (\v flags -> flags { hidir = v }) installDirArg , option "" ["libexecdir"] @@ -801,6 +806,13 @@ installDirsOptions = "installation directory for configuration files" sysconfdir (\v flags -> flags { sysconfdir = v }) installDirArg + + , option "" ["libsubdir"] + ("subdirectory of libdir in which libs are installed." ++ + "Only has an effect on Setup files built against Cabal < 1.24.1" + ) + libsubdir (\v flags -> flags { libsubdir = v }) + installDirArg ] where installDirArg _sf _lf d get set = diff --git a/Cabal/doc/developing-packages.markdown b/Cabal/doc/developing-packages.markdown index 6519c3e799a..f791d08c726 100644 --- a/Cabal/doc/developing-packages.markdown +++ b/Cabal/doc/developing-packages.markdown @@ -1952,6 +1952,7 @@ version :: Version getBinDir :: IO FilePath getLibDir :: IO FilePath +getHiDir :: IO FilePath getDataDir :: IO FilePath getLibexecDir :: IO FilePath getSysconfDir :: IO FilePath diff --git a/Cabal/doc/installing-packages.markdown b/Cabal/doc/installing-packages.markdown index fbb995d31dc..efa6649ed63 100644 --- a/Cabal/doc/installing-packages.markdown +++ b/Cabal/doc/installing-packages.markdown @@ -498,36 +498,45 @@ package: variables: `$prefix`, `$bindir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` +`--hidir=`_dir_ +: Interface files (.hi) of libraries are installed here. + + In the simple build system, *dir* may contain the following path + variables: `$prefix`, `$bindir`, `$libdir`, `$binlibsubdir`, + `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, + `$arch`, `$abi`, `$abitag` + `--libexecdir=`_dir_ : Executables that are not expected to be invoked directly by the user are installed here. In the simple build system, _dir_ may contain the following path - variables: `$prefix`, `$bindir`, `$libdir`, `$libsubdir`, `$pkgid`, + variables: `$prefix`, `$bindir`, `$libdir`, `$binlibsubdir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` `--datadir`=_dir_ : Architecture-independent data files are installed here. In the simple build system, _dir_ may contain the following path - variables: `$prefix`, `$bindir`, `$libdir`, `$libsubdir`, `$pkgid`, `$pkg`, + variables: `$prefix`, `$bindir`, `$libdir`, `$binlibsubdir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` `--sysconfdir=`_dir_ : Installation directory for the configuration files. In the simple build system, _dir_ may contain the following path variables: - `$prefix`, `$bindir`, `$libdir`, `$libsubdir`, `$pkgid`, `$pkg`, `$version`, + `$prefix`, `$bindir`, `$libdir`, `$binlibsubdir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` In addition the simple build system supports the following installation path options: -`--libsubdir=`_dir_ -: A subdirectory of _libdir_ in which libraries are actually - installed. For example, in the simple build system on Unix, the - default _libdir_ is `/usr/local/lib`, and _libsubdir_ contains the - package identifier and compiler, e.g. `mypkg-0.2/ghc-6.4`, so - libraries would be installed in `/usr/local/lib/mypkg-0.2/ghc-6.4`. +`--binlibsubdir=`_dir_ +: A subdirectory of _libdir_ in which binary libraries are actually + installed. It is recommended that a single, common directory to be used to + store all installed libraries (as opposed to using `$pkgid` or similar + variables to create a directory per installed library), as this helps reduce + the size of rpath in executables built against dynamic libraries. + See [3982](https://github.com/haskell/cabal/pull/3982) for more details. _dir_ may contain the following path variables: `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` @@ -543,14 +552,14 @@ In addition the simple build system supports the following installation path opt : Documentation files are installed relative to this directory. _dir_ may contain the following path variables: `$prefix`, `$bindir`, - `$libdir`, `$libsubdir`, `$datadir`, `$datasubdir`, `$pkgid`, `$pkg`, + `$libdir`, `$binlibsubdir`, `$datadir`, `$datasubdir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` `--htmldir=`_dir_ : HTML documentation files are installed relative to this directory. _dir_ may contain the following path variables: `$prefix`, `$bindir`, - `$libdir`, `$libsubdir`, `$datadir`, `$datasubdir`, `$docdir`, `$pkgid`, + `$libdir`, `$binlibsubdir`, `$datadir`, `$datasubdir`, `$docdir`, `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` `--program-prefix=`_prefix_ @@ -568,6 +577,22 @@ In addition the simple build system supports the following installation path opt _suffix_ may contain the following path variables: `$pkgid`, `$pkg`, `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` +`--libsubdir=`_dir_ +: For use with Setup.hs files built against a version of Cabal prior to 1.24.1. + With later versions of Cabal, you should prefer `--binlibsubdir` and + `--hidir`, which let you separately specify where binary libraries + and interface files get installed, so that binary libraries can be + installed to a shared directory.. + + A subdirectory of _libdir_ in which libraries are actually + installed. For example, in the simple build system on Unix, the + default _libdir_ is `/usr/local/lib`, and _libsubdir_ contains the + ABI, e.g. `x86_64-linux-ghc-8.0.1`, so + libraries would be installed in `/usr/local/lib/x86_64-linux-ghc-8.0.1`. + + _dir_ may contain the following path variables: `$pkgid`, `$pkg`, + `$version`, `$compiler`, `$os`, `$arch`, `$abi`, `$abitag` + #### Path variables in the simple build system #### For the simple build system, there are a number of variables that can be @@ -590,8 +615,11 @@ independence](#prefix-independence)). `$libdir` : As above but for `--libdir` -`$libsubdir` -: As above but for `--libsubdir` +`$binlibsubdir` +: As above but for `--binlibsubdir` + +`$hidir` +: As above but for `--hidir` `$datadir` : As above but for `--datadir` @@ -602,6 +630,9 @@ independence](#prefix-independence)). `$docdir` : As above but for `--docdir` +`$libsubdir` +: As above but for `--libsubdir` + `$pkgid` : The name and version of the package, e.g. `mypkg-0.2` @@ -642,7 +673,8 @@ Option Windows Default `--prefix` (per-user) `C:\Documents And Settings\user\Application Data\cabal` `$HOME/.cabal` `--bindir` `$prefix\bin` `$prefix/bin` `--libdir` `$prefix` `$prefix/lib` -`--libsubdir` (others) `$pkgid\$compiler` `$pkgid/$compiler` +`--binlibsubdir` (others) `$abi` `$abi` +`--hidir` `$libdir\$abi\$libname` `$libdir/$abi/$libname` `--libexecdir` `$prefix\$pkgid` `$prefix/libexec` `--datadir` (executable) `$prefix` `$prefix/share` `--datadir` (library) `C:\Program Files\Haskell` `$prefix/share` @@ -652,6 +684,7 @@ Option Windows Default `--htmldir` `$docdir\html` `$docdir/html` `--program-prefix` (empty) (empty) `--program-suffix` (empty) (empty) +`--libsubdir` `$abi\$libname` `$abi/$libname` #### Prefix-independence #### diff --git a/cabal-install/Distribution/Client/ProjectPlanning.hs b/cabal-install/Distribution/Client/ProjectPlanning.hs index 4777ead9d9c..412b4cb20bc 100644 --- a/cabal-install/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/Distribution/Client/ProjectPlanning.hs @@ -1128,7 +1128,7 @@ elaborateInstallPlan platform compiler compilerprogdb platform defaultInstallDirs) { - InstallDirs.libsubdir = "", -- absoluteInstallDirs sets these as + InstallDirs.binlibsubdir = "", -- absoluteInstallDirs sets these as InstallDirs.datasubdir = "" -- 'undefined' but we have to use } -- them as "Setup.hs configure" args @@ -1914,6 +1914,8 @@ storePackageInstallDirs CabalDirLayout{cabalStorePackageDirectory} prefix = cabalStorePackageDirectory compid ipkgid bindir = prefix "bin" libdir = prefix "lib" + binlibsubdir = "" + hidir = prefix "lib" libsubdir = "" dynlibdir = libdir libexecdir = prefix "libexec" diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index 6aec3c6f5c4..067e620d760 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -84,7 +84,7 @@ import Distribution.Simple.Setup , optionVerbosity, boolOpt, boolOpt', trueArg, falseArg , readPToMaybe, optionNumJobs ) import Distribution.Simple.InstallDirs - ( PathTemplate, InstallDirs(sysconfdir) + ( PathTemplate, InstallDirs(binlibsubdir, hidir, sysconfdir) , toPathTemplate, fromPathTemplate ) import Distribution.Version ( Version(Version), anyVersion, thisVersion ) @@ -350,7 +350,7 @@ configureOptions = commandOptions configureCommand filterConfigureFlags :: ConfigFlags -> Version -> ConfigFlags filterConfigureFlags flags cabalLibVersion - | cabalLibVersion >= Version [1,23,0] [] = flags_latest + | cabalLibVersion >= Version [1,24,1] [] = flags_latest -- ^ NB: we expect the latest version to be the most common case. | cabalLibVersion < Version [1,3,10] [] = flags_1_3_10 | cabalLibVersion < Version [1,10,0] [] = flags_1_10_0 @@ -362,6 +362,7 @@ filterConfigureFlags flags cabalLibVersion | cabalLibVersion < Version [1,21,1] [] = flags_1_20_0 | cabalLibVersion < Version [1,22,0] [] = flags_1_21_0 | cabalLibVersion < Version [1,23,0] [] = flags_1_22_0 + | cabalLibVersion < Version [1,24,1] [] = flags_1_24_0 | otherwise = flags_latest where (profEnabledLib, profEnabledExe) = computeEffectiveProfiling flags @@ -373,10 +374,18 @@ filterConfigureFlags flags cabalLibVersion configAllowNewer = Just Cabal.AllowNewerNone } + -- Cabal < 1.24.1 doesn't know about --binlibsubdir and --hidir. + flags_1_24_0 = flags_latest { configInstallDirs = configInstallDirs_1_24_0} + configInstallDirs_1_24_0 = (configInstallDirs flags) + { binlibsubdir = NoFlag + , hidir = NoFlag + } + + -- Cabal < 1.23 doesn't know about '--profiling-detail'. -- Cabal < 1.23 has a hacked up version of 'enable-profiling' -- which we shouldn't use. - flags_1_22_0 = flags_latest { configProfDetail = NoFlag + flags_1_22_0 = flags_1_24_0 { configProfDetail = NoFlag , configProfLibDetail = NoFlag , configIPID = NoFlag , configProf = NoFlag @@ -405,7 +414,7 @@ filterConfigureFlags flags cabalLibVersion -- Cabal < 1.18.0 doesn't know about --extra-prog-path and --sysconfdir. flags_1_18_0 = flags_1_19_0 { configProgramPathExtra = toNubList [] , configInstallDirs = configInstallDirs_1_18_0} - configInstallDirs_1_18_0 = (configInstallDirs flags) { sysconfdir = NoFlag } + configInstallDirs_1_18_0 = (configInstallDirs flags_1_19_0) { sysconfdir = NoFlag } -- Cabal < 1.14.0 doesn't know about '--disable-benchmarks'. flags_1_14_0 = flags_1_18_0 { configBenchmarks = NoFlag } -- Cabal < 1.12.0 doesn't know about '--enable/disable-executable-dynamic' diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index bb8e8c8d615..d596b4e8132 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -527,7 +527,7 @@ instance Arbitrary a => Arbitrary (InstallDirs a) where <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 4 <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 8 <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 12 - <*> arbitrary <*> arbitrary -- 14 + <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 16 instance Arbitrary PackageDB where arbitrary = oneof [ pure GlobalPackageDB