# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Abhishek Dasgupta <abhidg@gmail.com>
# Contributor: Eric Belanger <eric@archlinux.org>
# Contributor: Jan Fader <jan.fader@web.de>

pkgname=fish
pkgver=3.7.1
pkgrel=2
pkgdesc='Smart and user friendly shell intended mostly for interactive use'
url='https://fishshell.com/'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL2')
depends=('glibc' 'gcc-libs' 'ncurses' 'pcre2')
optdepends=('python: man page completion parser / web config tool'
            'pkgfile: command-not-found hook')
makedepends=('cmake' 'python-sphinx' 'jq')
checkdepends=('expect' 'procps-ng')
install=fish.install
backup=(etc/fish/config.fish)
source=(https://github.com/fish-shell/fish-shell/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz{,.asc}
        sphinx-no-parallel.patch)
validpgpkeys=(003837986104878835FA516D7A67D962D88A709A) # David Adam <zanchey@gmail.com>
sha256sums=('614c9f5643cd0799df391395fa6bbc3649427bb839722ce3b114d3bbc1a3b250'
            'SKIP'
            '16e15755ab363e1b9f04969091104c88c3cfc39a67621ad636419535e692874f')
sha512sums=('f1605c400c5d5494f37b92dd386963dba7a3f3c401c369aaf3ff616d9d94836a0138d26074be24c92d94d9d7b625513800899c9431f5e21be0757eb0a0bfd3fe'
            'SKIP'
            '3f9a0f53fa80bc1fa9ce1f66d230710d0b906bcc169dfef8fa68d194a1b29cc1cb194bd9db8ec1e682ba2393a474a000061e6ac12123b8b0baff1513d0f786c8')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 < "$srcdir/sphinx-no-parallel.patch" # can be removed when sphinx 7.3.0 releases
}

build() {
  cd ${pkgname}-${pkgver}
  export CXXFLAGS+=" ${CPPFLAGS}"
  cmake \
    -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_SYSCONFDIR=/etc \
    -DCMAKE_BUILD_TYPE=None \
    -DBUILD_DOCS=True \
    -Wno-dev
  make -C build VERBOSE=1
}

check() {
  cd ${pkgname}-${pkgver}
  make -C build test
}

package() {
  cd ${pkgname}-${pkgver}

  make -C build DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
