# Contributor: Dhruvin Gandhi # Maintainer: Dhruvin Gandhi pkgname=hledger-stockquotes pkgver=0.1.2.2 pkgrel=0 pkgdesc="hledger addon that pulls historical stock prices for commodities" url="https://github.com/prikhi/hledger-stockquotes#readme" arch="x86_64" # limited by GHC license="BSD-3-Clause" makedepends="ghc cabal libffi-dev ncurses-dev zlib-dev" source="$pkgname-$pkgver.tar.gz::https://github.com/prikhi/hledger-stockquotes/archive/refs/tags/$pkgver.tar.gz cabal.config " options="!check" # fail to build for some reason export CABAL_DIR="$srcdir"/cabal cabal_update() { msg "Freezing $pkgname dependencies" # Resolve deps and generate fresh cabal.config with version constraints. ( cd "$builddir" cabal update cabal v1-freeze --strong-flags --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 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.project.freeze" } build() { cabal update cabal build --prefix=/usr --enable-relocatable } check() { cabal test } package() { local ghcver=$(ghc --version | cut -d " " -f 8) install -Dm755 \ "dist-newstyle/build/$arch-linux/ghc-$ghcver/$pkgname-$pkgver/x/$pkgname/build/$pkgname/$pkgname" \ "$pkgdir"/usr/bin/$pkgname } sha512sums=" 0b637efc9d99f1b283b53cd45331603a8badd30d91692a854786e91c536ddf2d336973f7c2b8f1d8e439dc730893d91fbd1c2a040bed448a59f1006bfee79653 hledger-stockquotes-0.1.2.2.tar.gz da132ba8d991de94d9ca4e72dea63b484b056f65882359954f917ac4f098ddd2ef08f890d27492f846f07868a1e5607562b1471ac62d6715c287d5ffb5002e24 cabal.config "