Skip to content

Commit

Permalink
haiku: add as known platform (#9006)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicah authored Jun 14, 2023
1 parent c9aee94 commit 1df4a48
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Cabal-syntax/src/Distribution/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ data OS
| Android -- mobile OSs
| Ghcjs
| Wasi
| Haiku
| OtherOS String
deriving (Eq, Generic, Ord, Show, Read, Typeable, Data)

Expand All @@ -138,6 +139,7 @@ knownOSs =
, Android
, Ghcjs
, Wasi
, Haiku
]

osAliases :: ClassificationStrictness -> OS -> [String]
Expand Down
4 changes: 2 additions & 2 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ tests = testGroup "Distribution.Utils.Structured"
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
, testCase "GenericPackageDescription" $
md5Check (Proxy :: Proxy GenericPackageDescription) 0x8d8f340f10a58b8d8a87bf42213dac89
md5Check (Proxy :: Proxy GenericPackageDescription) 0xc7d1064aaf2c9bcf92c3d7f23e6d7e94
, testCase "LocalBuildInfo" $
md5Check (Proxy :: Proxy LocalBuildInfo) 0xbb22c3258d3092f31e992bc093d09170
md5Check (Proxy :: Proxy LocalBuildInfo) 0x0324f420f9fb98417098127a414cc7c0
#endif
]

Expand Down
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,7 @@ getRPaths lbi clbi | supportRPaths hostOS = do
supportRPaths Ghcjs = False
supportRPaths Wasi = False
supportRPaths Hurd = False
supportRPaths Haiku = False
supportRPaths (OtherOS _) = False
-- Do _not_ add a default case so that we get a warning here when a new OS
-- is added.
Expand Down
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/GHCJS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@ getRPaths lbi clbi | supportRPaths hostOS = do
supportRPaths Ghcjs = False
supportRPaths Wasi = False
supportRPaths Hurd = False
supportRPaths Haiku = False
supportRPaths (OtherOS _) = False
-- Do _not_ add a default case so that we get a warning here when a new OS
-- is added.
Expand Down
19 changes: 15 additions & 4 deletions Cabal/src/Distribution/Simple/InstallDirs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
Windows -> do
windowsProgramFilesDir <- getWindowsProgramFilesDir
return (windowsProgramFilesDir </> "Haskell")
Haiku -> return "/boot/system/non-packaged"
_ -> return "/usr/local"
installLibDir <-
case buildOS of
Expand All @@ -226,17 +227,27 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
, flibdir = "$libdir"
, libexecdir = case buildOS of
Windows -> "$prefix" </> "$libname"
Haiku -> "$libdir"
_other -> "$prefix" </> "libexec"
, includedir = "$libdir" </> "$libsubdir" </> "include"
, includedir = case buildOS of
Haiku -> "$prefix" </> "develop" </> "headers"
_other -> "$libdir" </> "$libsubdir" </> "include"
, datadir = case buildOS of
Windows -> "$prefix"
Haiku -> "$prefix" </> "data"
_other -> "$prefix" </> "share"
, datasubdir = "$abi" </> "$pkgid"
, docdir = "$datadir" </> "doc" </> "$abi" </> "$pkgid"
, mandir = "$datadir" </> "man"
, docdir = case buildOS of
Haiku -> "$prefix" </> "documentation"
_other -> "$datadir" </> "doc" </> "$abi" </> "$pkgid"
, mandir = case buildOS of
Haiku -> "$docdir" </> "man"
_other -> "$datadir" </> "man"
, htmldir = "$docdir" </> "html"
, haddockdir = "$htmldir"
, sysconfdir = "$prefix" </> "etc"
, sysconfdir = case buildOS of
Haiku -> "boot" </> "system" </> "settings"
_other -> "$prefix" </> "etc"
}

-- ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/PreProcess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ platformDefines lbi =
Ghcjs -> ["ghcjs"]
Wasi -> ["wasi"]
Hurd -> ["hurd"]
Haiku -> ["haiku"]
OtherOS _ -> []
archStr = case hostArch of
I386 -> ["i386"]
Expand Down
10 changes: 10 additions & 0 deletions changelog.d/pr-9006
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
synopsis: Add Haiku as a known platform
packages: Cabal
prs: #9006

description: {

- Cabal: Distribution now recognises Haiku as a valid platform,
and also implements Haiku's unique directory layout.

}

0 comments on commit 1df4a48

Please sign in to comment.