# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Ben <contrasutra@myrealbox.com>

pkgname=sound-juicer
pkgver=3.40.0
pkgrel=4
pkgdesc="A lean and friendly audio CD extractor for GNOME"
url="https://wiki.gnome.org/Apps/SoundJuicer"
arch=(x86_64)
license=(GPL)
depends=(
  brasero
  gst-plugins-base
  gst-plugins-good
  gtk3
  iso-codes
  libcanberra
  libdiscid
  libmusicbrainz5
)
makedepends=(
  appstream-glib
  git
  itstool
  meson
)
optdepends=(
  'gst-plugins-ugly: MP3 encoding support'
  'gst-plugins-bad: Opus encoding support'
)
source=(
  "git+https://gitlab.gnome.org/GNOME/sound-juicer.git#tag=$pkgver"
  0001-Don-t-create-window-in-startup-phase.patch
)
b2sums=('bf2444827421803a3f4c94b83ccee03101703bb9a289526be696d42f1d4d54ca4807be080b9326938d0d1c0228fab48f37347d83032252195f0729f8d8dfbaa8'
        '9bbbd306def0fc0ded3c8729feb617a3e3dffe609a0da497237de825f411b09fc26a53af52662c468ca7d89d1629ce304fb95b06011f33b3e3c008a1043042c2')

prepare() {
  cd $pkgname

  # Fix icon name
  # https://gitlab.gnome.org/GNOME/sound-juicer/-/merge_requests/37
  git cherry-pick -n f4427c1d539e4ca4584359f6cb6033e09539be62

  # Don't create window in startup phase
  # https://gitlab.gnome.org/GNOME/sound-juicer/-/merge_requests/44
  git apply -3 ../0001-Don-t-create-window-in-startup-phase.patch
}

build() {
  arch-meson $pkgname build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
