_pkgname=fluidsynth
pkgname=static-compat-$_pkgname
pkgver=2.5.6
pkgrel=1
pkgdesc="A real-time software synthesizer based on the SoundFont 2 specifications"
arch=(x86_64)
url="https://www.fluidsynth.org/"
_url="https://github.com/fluidsynth/fluidsynth"
license=(LGPL-2.1-or-later)
depends=(static-compat-glib2 static-compat-alsa-lib)
makedepends=(static-compat-cmake ninja)
source=(
  $_pkgname-$pkgver.tar.gz::$_url/archive/v$pkgver.tar.gz
)
sha512sums=('0470b190da7e3f330e4fbdf28035ff172866213e0d13f968965b82022ec5cf5c13935624fa0067bb7d9a92cfab1d8238a1ebecbbe91164b298d36a02e50464bc')
b2sums=('c87eef6142932f8f18c0bc281a6242732ea2e7d9883ec9ad9b92c7e39c8f2afcb25b5a8a17a20b3033d79e6b5aebefc06a607f7eab77dd9e5cd44d4d9175d02b')

build() {
  export CFLAGS+=' -ldl'
  source static-compat-environment
  local  cmake_options=(
    -G Ninja
    -B build
    -D LIB_SUFFIX=""
    -S $_pkgname-$pkgver
    -W no-dev
    -Denable-aufile=0 -Denable-dbus=0 -Denable-ipv6=0 -Denable-jack=0 -Denable-ladspa=0 -Denable-midishare=0 -Denable-opensles=0 -Denable-oboe=0 -Denable-oss=0 -Denable-readline=0 -Denable-winmidi=1 -Denable-waveout=0 -Denable-network=0 -Denable-pulseaudio=0 -Denable-dsound=0 -Denable-alsa=1 -Denable-libinstpatch=0 -Denable-portaudio=0 -Denable-wasapi=0 -Denable-openmp=1 -Denable-libsndfile=0 -Denable-sdl2=0
  )

  static-compat-cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  source static-compat-environment
  ctest build
}

package() {
  source static-compat-environment
  DESTDIR="$pkgdir" cmake --install build
}
