diff --git a/cabal.project.release b/cabal.project.release index 0acb162e..1a0ca762 100644 --- a/cabal.project.release +++ b/cabal.project.release @@ -2,9 +2,10 @@ import: cabal.project.common optimization: 2 --- The release project file always wants to build with -tar. --- The tar flag is only there to circumvent complicated errors during --- development, which sometimes happens due to libarchive. +-- The release project file always wants to build with -tar on the +-- platforms it supports (which are those it provides config.h files +-- for). The tar flag is only there to circumvent complicated errors +-- during development, which sometimes happens due to libarchive. package ghcup flags: +tui @@ -32,3 +33,6 @@ elif os(freebsd) xz -system-xz package * ghc-options: -split-sections +else + package ghcup + flags: +tar diff --git a/lib-opt/GHCup/OptParse/ChangeLog.hs b/lib-opt/GHCup/OptParse/ChangeLog.hs index 97bf9d23..797cfefa 100644 --- a/lib-opt/GHCup/OptParse/ChangeLog.hs +++ b/lib-opt/GHCup/OptParse/ChangeLog.hs @@ -136,6 +136,7 @@ changelog ChangeLogOptions{..} runAppState runLogger = do Darwin -> exec "open" [T.unpack $ decUTF8Safe $ serializeURIRef' uri] Nothing Nothing Linux _ -> exec "xdg-open" [T.unpack $ decUTF8Safe $ serializeURIRef' uri] Nothing Nothing FreeBSD -> exec "xdg-open" [T.unpack $ decUTF8Safe $ serializeURIRef' uri] Nothing Nothing + OpenBSD -> exec "xdg-open" [T.unpack $ decUTF8Safe $ serializeURIRef' uri] Nothing Nothing Windows -> do let args = "start \"\" " ++ (T.unpack $ decUTF8Safe $ serializeURIRef' uri) c <- liftIO $ system $ args diff --git a/lib/GHCup/Platform.hs b/lib/GHCup/Platform.hs index efd92db4..1b5a6e9a 100644 --- a/lib/GHCup/Platform.hs +++ b/lib/GHCup/Platform.hs @@ -119,11 +119,17 @@ getPlatform = do either (const Nothing) Just . versioning . decUTF8Safe' <$> getFreeBSDVersion pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver } + "openbsd" -> do + ver <- + either (const Nothing) Just . versioning . decUTF8Safe' + <$> getOpenBSDVersion + pure $ PlatformResult { _platform = OpenBSD, _distroVersion = ver } "mingw32" -> pure PlatformResult { _platform = Windows, _distroVersion = Nothing } what -> throwE $ NoCompatiblePlatform what lift $ logDebug $ "Identified Platform as: " <> T.pack (prettyShow pfr) pure pfr where + getOpenBSDVersion = lift $ fmap _stdOut $ executeOut "uname" ["-r"] Nothing getFreeBSDVersion = lift $ fmap _stdOut $ executeOut "freebsd-version" [] Nothing getDarwinVersion = lift $ fmap _stdOut $ executeOut "sw_vers" ["-productVersion"] @@ -306,6 +312,7 @@ getStackGhcBuilds PlatformResult{..} = do [] -> [] _ -> L.intercalate "-" c) libComponents + OpenBSD -> pure [] FreeBSD -> case _distroVersion of Just fVer @@ -343,6 +350,8 @@ getStackOSKey PlatformRequest { .. } = (A_64 , Darwin ) -> pure "macosx" (A_32 , FreeBSD) -> pure "freebsd32" (A_64 , FreeBSD) -> pure "freebsd64" + (A_32 , OpenBSD) -> pure "openbsd32" + (A_64 , OpenBSD) -> pure "openbsd64" (A_32 , Windows) -> pure "windows32" (A_64 , Windows) -> pure "windows64" (A_ARM , Linux _) -> pure "linux-armv7" @@ -350,6 +359,7 @@ getStackOSKey PlatformRequest { .. } = (A_Sparc, Linux _) -> pure "linux-sparc" (A_ARM64, Darwin ) -> pure "macosx-aarch64" (A_ARM64, FreeBSD) -> pure "freebsd-aarch64" + (A_ARM64, OpenBSD) -> pure "openbsd-aarch64" (arch', os') -> throwE $ UnsupportedSetupCombo arch' os' getStackPlatformKey :: (MonadReader env m, MonadFail m, HasLog env, MonadCatch m, MonadIO m) diff --git a/lib/GHCup/Types.hs b/lib/GHCup/Types.hs index 2984c3fd..4bc2c1aa 100644 --- a/lib/GHCup/Types.hs +++ b/lib/GHCup/Types.hs @@ -230,6 +230,7 @@ data Platform = Linux LinuxDistro | Darwin -- ^ must exit | FreeBSD + | OpenBSD | Windows -- ^ must exit deriving (Eq, GHC.Generic, Ord, Show) @@ -240,6 +241,7 @@ platformToString :: Platform -> String platformToString (Linux distro) = "linux-" ++ distroToString distro platformToString Darwin = "darwin" platformToString FreeBSD = "freebsd" +platformToString OpenBSD = "openbsd" platformToString Windows = "windows" instance Pretty Platform where diff --git a/lib/GHCup/Types/JSON.hs b/lib/GHCup/Types/JSON.hs index 34009781..1ddc6126 100644 --- a/lib/GHCup/Types/JSON.hs +++ b/lib/GHCup/Types/JSON.hs @@ -144,12 +144,14 @@ instance ToJSONKey Platform where Darwin -> T.pack "Darwin" FreeBSD -> T.pack "FreeBSD" Linux d -> T.pack ("Linux_" <> show d) + OpenBSD -> T.pack "OpenBSD" Windows -> T.pack "Windows" instance FromJSONKey Platform where fromJSONKey = FromJSONKeyTextParser $ \t -> if | T.pack "Darwin" == t -> pure Darwin | T.pack "FreeBSD" == t -> pure FreeBSD + | T.pack "OpenBSD" == t -> pure OpenBSD | T.pack "Windows" == t -> pure Windows | T.pack "Linux_" `T.isPrefixOf` t -> case T.stripPrefix (T.pack "Linux_") t