1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 19:55:26 +03:00
aports/community/shellcheck/APKBUILD
Olliver Schinagl 99acf6639b community/shellcheck: upgrade to 0.9.0
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2022-12-15 16:54:13 +00:00

100 lines
2.6 KiB
Text

# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=shellcheck
pkgver=0.9.0
pkgrel=0
pkgdesc="a static analysis tool for shell scripts"
url="https://github.com/koalaman/shellcheck"
# limited by ghc
arch="aarch64 x86_64"
license="GPL-3.0"
makedepends="cabal bash ghc libffi-dev"
subpackages="$pkgname-doc"
source="
$pkgname-$pkgver.tar.gz::https://github.com/koalaman/shellcheck/archive/v$pkgver.tar.gz
cabal.config
"
_cabal_home="$srcdir/dist"
cabal_update() {
msg "Freezing $pkgname dependencies"
# Resolve deps and generate fresh cabal.config with version constraints.
HOME="$_cabal_home" cabal update
(
cd "$builddir"
HOME="$_cabal_home" cabal v1-freeze --shadow-installed-packages
# Add version tag at the first line.
sed -i "1i--$pkgver" "cabal.config"
mv "cabal.config" "$startdir/"
)
if ! abuild checksum; then
die "Failed to update checksum, run 'abuild checksum' manually"
fi
}
prepare() {
default_prepare
./striptests
if [ "$(head -n 1 "$srcdir/cabal.config")" != "--$pkgver" ]; then
die "Requirements file is outdated, run 'abuild cabal_update'"
fi
ln -sf "$srcdir/cabal.config" "$builddir/cabal.config"
}
build() {
# ghc version path
export PATH="$PATH:/usr/lib/llvm14/bin"
HOME="$_cabal_home" cabal update
HOME="$_cabal_home" cabal v1-install \
--disable-documentation \
--only-dependencies
HOME="$_cabal_home" cabal v1-configure \
--prefix='/usr' \
--bindir='$prefix/bin' \
--docdir='$prefix/share/doc' \
--datadir='$prefix/share' \
--htmldir='$docdir/html' \
--libdir='$prefix/lib' \
--libsubdir="$pkgname" \
--datasubdir="$pkgname" \
--dynlibdir="$pkgname" \
--sysconfdir='/etc' \
--disable-library-profiling \
--disable-profiling \
--disable-shared \
--enable-executable-stripping \
--flags='GMP FFI standalone'
HOME="$_cabal_home" cabal v1-build -j
}
check() {
_test_script="$(mktemp)"
{
echo "#!/bin/sh"
echo
echo "exit 0"
} > "$_test_script"
trap 'rm "$_test_script"' EXIT
"$builddir/dist/build/$pkgname/$pkgname" "$_test_script"
trap - EXIT
rm "$_test_script"
}
package() {
HOME="$_cabal_home" cabal v1-copy --destdir="$pkgdir"
rm -r "$pkgdir/usr/lib/$pkgname"
mkdir -p "$pkgdir/usr/share/doc/$pkgname"
mv "$pkgdir/usr/share/doc/LICENSE" "$pkgdir/usr/share/doc/$pkgname"
}
sha512sums="
5931842b3b496c2a73db2576e89eede042a30e14dd98dec8fa36d58243acd1143a35645dd973f8c24f189ce760c746efd3d527209c2f9f1d044af372f2b9afea shellcheck-0.9.0.tar.gz
353583dacc08d76c9d458859e776f7bde69a1c4a6738c826f729d72f6dfde9fa60250af95d99a4f0cb8ab509e72dc8cd1ba4bb9096d4e94a280da9a3095c3eaa cabal.config
"