packages feed

cabal-flatpak-1.0.0: src/domain/Distribution/Flatpak/GHC.hs

module Distribution.Flatpak.GHC
  ( formatVersion
  , ghcDirUrl
  , ghcArchive
  ) where

import Data.Text qualified as Text
import Text.Printf

import Cabal.Plan qualified as Plan
import Distribution.Flatpak qualified as Flatpak

formatVersion :: Plan.Ver -> String
formatVersion = Text.unpack . Plan.dispVer

-- | Directory on downloads.haskell.org that holds the binary distributions of a compiler.
ghcDirUrl :: Plan.PkgId -> String
ghcDirUrl (Plan.PkgId (Plan.PkgName compName) compVersion) =
  printf
    "https://downloads.haskell.org/%s/%s/"
    (Text.unpack compName)
    (formatVersion compVersion)

-- |
-- File name of the Debian 12 binary distribution of a compiler.
-- Its glibc and ncurses requirements are met by the freedesktop SDK.
ghcArchive :: Plan.PkgId -> Flatpak.Arch -> String
ghcArchive compiler arch =
  printf
    "%s-%s-deb12-linux.tar.xz"
    (Text.unpack $ Plan.dispPkgId compiler)
    (Flatpak.archString arch)