Skip to content

Commit

Permalink
dev-util/ghcup-bin: new package, add 0.1.30.0
Browse files Browse the repository at this point in the history
Bug: gentoo-haskell#1292
Signed-off-by: hololeap <[email protected]>
  • Loading branch information
hololeap committed Dec 6, 2024
1 parent 4a2e3df commit d8988e0
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev-util/ghcup-bin/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DIST ghcup-bin-0.1.30.0-SHA256SUMS 2761 BLAKE2B 3102f1bbb07968fb019693a51c28b6431600449e6ea52001458ac3fefe28139a6dfa2ec096375c629f159befba4c8dc8a309074cf294f0038accb3bfd1966d22 SHA512 4fb4ccc5a9da79409d5a98eb7c08a1e9b516ac50ee323e55d511def5b272725d948b23e2b76f67f3e9f32bf4d7c1d828c021e0b8b8aa9a9e5db198b9604e83f8
DIST ghcup-bin-0.1.30.0-SHA256SUMS.sig 682 BLAKE2B a7b04a6b64a00fc4bf73fa86a13ab0e3fb95845f2168b58b35107b6d6f9b01e4c527bc7f5eb78bc8df96e521e850d14c15bc9977794a8c9664989023b9d6bda1 SHA512 8c56473d4c3fc389e600f6344ca61613182931910eaf157c8aef7f49f0b646debcfa59362fb74d5384e7bc841fd287310eb93cda46b8d9800853125ab514251f
DIST ghcup-bin-0.1.30.0-aarch64-linux-static-exe 103805848 BLAKE2B 544ae5bc731864f9f8d0f57735608a0b4c5f9a99ea61eac54dd4dcb2f08327e2cc704792736379d566ca7d45814978aa5c92db54915947400784b8969dfc354d SHA512 375b61bdfe13da8451afee4f9540cf5f7d200673068f58e78beb46558f29da4324528bec0d20eb8bb333b529cae4ba085cc691ec800ae759a6df127734ecb0ad
DIST ghcup-bin-0.1.30.0-armv7-linux-exe 64294756 BLAKE2B e15e916a972694acfbf9b3322fdf9123e123055f1092e1066f3216fe1c0aca8f8983120026059cf22a524ed27fd1e13092b54370f4a7494abc7c0cc190ba67a2 SHA512 2a74b341a5c9109e1189537e9207470e7f044bfa3bdb78463349d5cd3f08b9012c20cfcea992b2760381575d89685da13e0ca5bcb3295f4750265ac5254a3852
DIST ghcup-bin-0.1.30.0-i386-linux-exe 14228856 BLAKE2B 71399c8eae3e589826c5d3c569d298c493df358b30031f3c5036bd216e895e10263650b7e81dc7ea2af03cf4075e2b7fd128e1f13c711902fced96c0fd750e6a SHA512 5ccec7d96f57c49e01babffc589227e68b3e6dc7a03d91e2f63ca499c1dd612bc2cf82cd7916e653b28673c04325c361bf38409febc2685d9fea141014331ebb
DIST ghcup-bin-0.1.30.0-x86_64-linux-exe 15709832 BLAKE2B a98c47ceebaacb885b3d12e167c0e23f242a05a5b87f9be16bf2487a75228872ae69a5fc79c5b56058e90fc2cade251b1f4ac976f6499d5e79dd63ceb6e87ba0 SHA512 35edd67dd4902309b45bb97034c7e6e3640eca99c424403060d553028952947a410c7872f290979d444f4f568cc08e7d9bdcb60cbb4f13cdce9bcf8743ee16cc
113 changes: 113 additions & 0 deletions dev-util/ghcup-bin/ghcup-bin-0.1.30.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES=""

inherit verify-sig

DESCRIPTION="Rust toolchain installer"
HOMEPAGE="https://rust-lang.github.io/rustup/"

VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/ghcup.asc

# The list of binary name prefixes from upstream, chosen using $ARCH
ghcup_bin_prefix() {
case ${1} in
amd64) echo "x86_64-linux" ;;
arm64) echo "aarch64-linux-static" ;;
arm ) echo "armv7-linux" ;;
x86 ) echo "i386-linux" ;;
"" ) echo "x86_64-linux" ;; # Failsafe for NO arch (pkgcheck seems to need this)

* ) die "Unsupported arch (no upstream distfiles available): ${ARCH}" ;;
esac
}

# directory where upstream binaries live
GHCUP_BIN_DIR_URI="https://downloads.haskell.org/~ghcup/${PV}"

SRC_URI="
amd64? (
${GHCUP_BIN_DIR_URI}/$(ghcup_bin_prefix amd64)-ghcup-${PV}
-> ${P}-$(ghcup_bin_prefix amd64)-exe
)
arm64? (
${GHCUP_BIN_DIR_URI}/$(ghcup_bin_prefix arm64)-ghcup-${PV}
-> ${P}-$(ghcup_bin_prefix arm64)-exe
)
arm? (
${GHCUP_BIN_DIR_URI}/$(ghcup_bin_prefix arm)-ghcup-${PV}
-> ${P}-$(ghcup_bin_prefix arm)-exe
)
x86? (
${GHCUP_BIN_DIR_URI}/$(ghcup_bin_prefix x86)-ghcup-${PV}
-> ${P}-$(ghcup_bin_prefix x86)-exe
)
verify-sig? (
${GHCUP_BIN_DIR_URI}/SHA256SUMS
-> ${P}-SHA256SUMS
${GHCUP_BIN_DIR_URI}/SHA256SUMS.sig
-> ${P}-SHA256SUMS.sig
)
"

# No need for ${P} subdirectory
S="${WORKDIR}"

LICENSE="LGPL-3"
SLOT="0"

# Only keyword an arch if someone has done (extensive) testing with it
KEYWORDS="~amd64"

BDEPEND="${BDEPEND}
sec-keys/openpgp-keys-ghcup
"

### Export some more variables specific to the local $ARCH, for convenience

# the binary name prefix
GHCUP_BIN_PREFIX="$(ghcup_bin_prefix "${ARCH}")"

# name (prefix) for our saved files in $DISTDIR (specific to local $ARCH!)
GHCUP_DISTDIR_PREFIX="${P}-${GHCUP_BIN_PREFIX}"

# The upstream name of the ghcup binary we will work with (specific to local $ARCH!)
GHCUP_BIN="${GHCUP_BIN_PREFIX}-ghcup-${PV}"

###

# Print _only_ the relevant line from the sumfile for our $GHCUP_BIN
ghcup_trim_sumfile() {
grep ./${GHCUP_BIN}\$ "${S}/SHA256SUMS"
}

src_unpack() {
cp -v "${DISTDIR}/${GHCUP_DISTDIR_PREFIX}-exe" \
"${S}/${GHCUP_BIN}" || die # Match name in $S to upstream

if use verify-sig; then
verify-sig_verify_detached "${DISTDIR}/${P}"-SHA256SUMS{,.sig}

for checksum_file in SHA256SUMS{,.sig}; do
cp -v "${DISTDIR}/${P}-${checksum_file}" \
"${S}/${checksum_file}" || die
done

sha256sum --check <(ghcup_trim_sumfile) || die
fi
}

src_install() {
exeinto /usr/bin
newexe "${GHCUP_BIN}" ghcup
}

pkg_postinst() {
elog 'Adjust your $PATH to run executables installed by GHCup:'
elog "export PATH=\"\$HOME/.cabal/bin:\$HOME/.ghcup/bin:\$PATH\""
elog 'See: <https://www.haskell.org/ghcup/install/#manual-installation>'
}
12 changes: 12 additions & 0 deletions dev-util/ghcup-bin/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>Gentoo Haskell</name>
</maintainer>
<upstream>
<remote-id type="hackage">ghcup</remote-id>
<remote-id type="github">haskell/ghcup-hs</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit d8988e0

Please sign in to comment.