From 09303c6d4b85da080a43c99b7a4e6f28a467fa9b Mon Sep 17 00:00:00 2001 From: Kye Shi Date: Mon, 14 Feb 2022 21:33:12 -0800 Subject: [PATCH] new package: ghcup-0.1.17.8 --- srcpkgs/ghcup/INSTALL.msg | 8 ++ .../ghcup-0.1.17.8-fix-ghc902-fromjson.patch | 86 +++++++++++++++++++ srcpkgs/ghcup/template | 29 +++++++ 3 files changed, 123 insertions(+) create mode 100644 srcpkgs/ghcup/INSTALL.msg create mode 100644 srcpkgs/ghcup/patches/ghcup-0.1.17.8-fix-ghc902-fromjson.patch create mode 100644 srcpkgs/ghcup/template diff --git a/srcpkgs/ghcup/INSTALL.msg b/srcpkgs/ghcup/INSTALL.msg new file mode 100644 index 000000000000..100bbd0780b7 --- /dev/null +++ b/srcpkgs/ghcup/INSTALL.msg @@ -0,0 +1,8 @@ +ghcup comes with an internal downloader, but optionally depends on curl and/or +wget for more advanced usages (e.g., proxying). To use curl/wget as downloader, +first make sure they are installed, then run `ghcup config set downloader Curl`. + +Also, ghcup requires $GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin to be in your PATH +(by default, $GHCUP_INSTALL_BASE_PREFIX is $HOME); make sure to update your +shell launch scripts accordingly. Alternatively, when GHCUP_USE_XDG_DIRS is set, +GHCUP uses XDG-ish directories. diff --git a/srcpkgs/ghcup/patches/ghcup-0.1.17.8-fix-ghc902-fromjson.patch b/srcpkgs/ghcup/patches/ghcup-0.1.17.8-fix-ghc902-fromjson.patch new file mode 100644 index 000000000000..978a7abc1ad0 --- /dev/null +++ b/srcpkgs/ghcup/patches/ghcup-0.1.17.8-fix-ghc902-fromjson.patch @@ -0,0 +1,86 @@ +patch given by hasufell, posted at https://gist.github.com/hasufell/164af24885c6f066291c417a9850388d +diff --git a/lib/GHCup/Types/JSON.hs b/lib/GHCup/Types/JSON.hs +index 8d7cd3b..3dd05ee 100644 +--- a/lib/GHCup/Types/JSON.hs ++++ b/lib/GHCup/Types/JSON.hs +@@ -79,37 +79,6 @@ instance FromJSON Tag where + instance ToJSON URI where + toJSON = toJSON . E.decodeUtf8With E.lenientDecode . serializeURIRef' + +-instance FromJSON URLSource where +- parseJSON v = +- parseGHCupURL v +- <|> parseOwnSourceLegacy v +- <|> parseOwnSourceNew1 v +- <|> parseOwnSourceNew2 v +- <|> parseOwnSpec v +- <|> legacyParseAddSource v +- <|> newParseAddSource v +- where +- parseOwnSourceLegacy = withObject "URLSource" $ \o -> do +- r :: URI <- o .: "OwnSource" +- pure (OwnSource [Right r]) +- parseOwnSourceNew1 = withObject "URLSource" $ \o -> do +- r :: [URI] <- o .: "OwnSource" +- pure (OwnSource (fmap Right r)) +- parseOwnSourceNew2 = withObject "URLSource" $ \o -> do +- r :: [Either GHCupInfo URI] <- o .: "OwnSource" +- pure (OwnSource r) +- parseOwnSpec = withObject "URLSource" $ \o -> do +- r :: GHCupInfo <- o .: "OwnSpec" +- pure (OwnSpec r) +- parseGHCupURL = withObject "URLSource" $ \o -> do +- _ :: [Value] <- o .: "GHCupURL" +- pure GHCupURL +- legacyParseAddSource = withObject "URLSource" $ \o -> do +- r :: Either GHCupInfo URI <- o .: "AddSource" +- pure (AddSource [r]) +- newParseAddSource = withObject "URLSource" $ \o -> do +- r :: [Either GHCupInfo URI] <- o .: "AddSource" +- pure (AddSource r) + + instance FromJSON URI where + parseJSON = withText "URL" $ \t -> +@@ -349,7 +318,40 @@ deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''GHCupI + deriveToJSON defaultOptions { sumEncoding = ObjectWithSingleField } ''URLSource + deriveJSON defaultOptions { sumEncoding = ObjectWithSingleField } ''Key + deriveJSON defaultOptions { fieldLabelModifier = \str' -> maybe str' T.unpack . T.stripPrefix (T.pack "k-") . T.pack . kebab $ str' } ''UserKeyBindings +-deriveJSON defaultOptions { fieldLabelModifier = \str' -> maybe str' T.unpack . T.stripPrefix (T.pack "u-") . T.pack . kebab $ str' } ''UserSettings +- + deriveToJSON defaultOptions { fieldLabelModifier = kebab } ''Settings + deriveToJSON defaultOptions { fieldLabelModifier = drop 2 . kebab } ''KeyBindings -- move under key-bindings key ++ ++instance FromJSON URLSource where ++ parseJSON v = ++ parseGHCupURL v ++ <|> parseOwnSourceLegacy v ++ <|> parseOwnSourceNew1 v ++ <|> parseOwnSourceNew2 v ++ <|> parseOwnSpec v ++ <|> legacyParseAddSource v ++ <|> newParseAddSource v ++ where ++ parseOwnSourceLegacy = withObject "URLSource" $ \o -> do ++ r :: URI <- o .: "OwnSource" ++ pure (OwnSource [Right r]) ++ parseOwnSourceNew1 = withObject "URLSource" $ \o -> do ++ r :: [URI] <- o .: "OwnSource" ++ pure (OwnSource (fmap Right r)) ++ parseOwnSourceNew2 = withObject "URLSource" $ \o -> do ++ r :: [Either GHCupInfo URI] <- o .: "OwnSource" ++ pure (OwnSource r) ++ parseOwnSpec = withObject "URLSource" $ \o -> do ++ r :: GHCupInfo <- o .: "OwnSpec" ++ pure (OwnSpec r) ++ parseGHCupURL = withObject "URLSource" $ \o -> do ++ _ :: [Value] <- o .: "GHCupURL" ++ pure GHCupURL ++ legacyParseAddSource = withObject "URLSource" $ \o -> do ++ r :: Either GHCupInfo URI <- o .: "AddSource" ++ pure (AddSource [r]) ++ newParseAddSource = withObject "URLSource" $ \o -> do ++ r :: [Either GHCupInfo URI] <- o .: "AddSource" ++ pure (AddSource r) ++ ++deriveJSON defaultOptions { fieldLabelModifier = \str' -> maybe str' T.unpack . T.stripPrefix (T.pack "u-") . T.pack . kebab $ str' } ''UserSettings ++ diff --git a/srcpkgs/ghcup/template b/srcpkgs/ghcup/template new file mode 100644 index 000000000000..c854e78e25e9 --- /dev/null +++ b/srcpkgs/ghcup/template @@ -0,0 +1,29 @@ +# Template file for 'ghcup' +pkgname=ghcup +version=0.1.17.8 +revision=1 +archs='x86_64 i686' +wrksrc="ghcup-hs-v$version" +hostmakedepends='tar git cabal-install' +makedepends='zlib-devel ncurses-libtinfo-devel libarchive-devel' +depends='zlib ncurses-libtinfo-libs libarchive gcc gmp make perl' +short_desc='Installer for the general purpose language Haskell' +maintainer='Kye Shi ' +license='LGPL-3.0-only' +homepage='https://www.haskell.org/ghcup/' +distfiles="https://gitlab.haskell.org/haskell/ghcup-hs/-/archive/v$version/ghcup-hs-v$version.tar.gz" +checksum='15156760d8593045515002c8c91803cbf67c9eb4bab357c46d2fdedea8c63ab1' +nopie_files='/usr/bin/ghcup' +nocross='cannot cross compile haskell yet' + +do_build() { + cabal update --prefix="$PWD" + cabal build --prefix="$PWD" --project-file='cabal.ghc902.project' -f'+internal-downloader' -f'+system-libarchive' -f'+tui' +} + +do_install() { + cabal install --prefix="$PWD" --install-method='copy' --installdir="$DESTDIR/usr/bin" + for sh in 'bash' 'fish' 'zsh'; do + vcompletion "scripts/shell-completions/$sh" "$sh" + done +}