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

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
}
