Skip to content

Commit

Permalink
Define the path of license files
Browse files Browse the repository at this point in the history
  • Loading branch information
L-TChen committed Sep 20, 2023
1 parent c4e1268 commit 48018c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Cabal/src/Distribution/Simple/BuildPaths.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Distribution.Simple.BuildPaths
, haddockDirName
, hscolourPref
, haddockPref
, licenseFilePref
, autogenPackageModulesDir
, autogenComponentModulesDir
, autogenPathsModuleName
Expand Down Expand Up @@ -90,6 +91,9 @@ haddockPref :: HaddockTarget -> FilePath -> PackageDescription -> FilePath
haddockPref haddockTarget distPref pkg_descr =
distPref </> "doc" </> "html" </> haddockDirName haddockTarget pkg_descr

licenseFilePref :: FilePath -> FilePath -> FilePath
licenseFilePref docPref = (docPref </>)

-- | The directory in which we put auto-generated modules for EVERY
-- component in the package.
autogenPackageModulesDir :: LocalBuildInfo -> String
Expand Down
9 changes: 6 additions & 3 deletions Cabal/src/Distribution/Simple/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import Distribution.Types.UnqualComponentName

import Distribution.Package
import Distribution.PackageDescription
import Distribution.Simple.BuildPaths (haddockName, haddockPref)
import Distribution.Simple.BuildPaths
( haddockName
, haddockPref
, licenseFilePref
)
import Distribution.Simple.BuildTarget
import Distribution.Simple.Compiler
( CompilerFlavor (..)
Expand Down Expand Up @@ -74,7 +78,6 @@ import System.Directory
import System.FilePath
( isRelative
, takeDirectory
, takeFileName
, (</>)
)

Expand Down Expand Up @@ -182,7 +185,7 @@ copyPackage verbosity pkg_descr lbi distPref copydest = do
for_ lfiles $ \lfile' -> do
let lfile :: FilePath
lfile = getSymbolicPath lfile'
installOrdinaryFile verbosity lfile (docPref </> takeFileName lfile)
installOrdinaryFile verbosity lfile (licenseFilePref docPref lfile)

-- | Copy files associated with a component.
copyComponent
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/issue-9184
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
synopsis: Preserve the relative paths of license files
packages: Cabal
issues: #9184

0 comments on commit 48018c7

Please sign in to comment.