# Maintainer: Olliver Schinagl pkgname=shellcheck pkgver=0.7.1 pkgrel=1 pkgdesc="a static analysis tool for shell scripts" url="https://github.com/koalaman/shellcheck" arch="x86_64" # Limited by GHC / Cabal license="GPL-3.0" makedepends="cabal bash ghc" 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 v1-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() { HOME="$_cabal_home" cabal v1-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="95ca827f50035e352eabfbee9eb1791278f7c18c10c3a6c2656c5b9e87396b7b6c088f4cefa3d6f954ac6c2765ea50e232985b9f3eeea2dbe77c17473cc4a437 shellcheck-0.7.1.tar.gz f5448513b88a176029b1460d20b31835316810d9a7c7e8247fc687525c64b06c4347e5a3b28577dc851c278b54d98133153e097952d64f669a47623707b199c0 cabal.config"