File: UniqueSubdir.hs

package info (click to toggle)
haskell-ghc-lib-parser 9.6.6.20240701-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,280 kB
  • sloc: haskell: 109,582; yacc: 3,744; ansic: 2,480; makefile: 12
file content (22 lines) | stat: -rw-r--r-- 680 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module GHC.UniqueSubdir
  ( uniqueSubdir
  ) where

import Prelude -- See Note [Why do we import Prelude here?]

import Data.List (intercalate)

import GHC.Platform.ArchOS
import GHC.Version (cProjectVersion)

-- | A filepath like @x86_64-linux-7.6.3@ with the platform string to use when
-- constructing platform-version-dependent files that need to co-exist.
uniqueSubdir :: ArchOS -> FilePath
uniqueSubdir (ArchOS arch os) = intercalate "-"
  [ stringEncodeArch arch
  , stringEncodeOS os
  , cProjectVersion
  ]
  -- NB: This functionality is reimplemented in Cabal, so if you
  -- change it, be sure to update Cabal.
  -- TODO make Cabal use this now that it is in ghc-boot.