# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: trya <tryagainprod@gmail.com>
# Contributor: Yvan <madridista40@orange.fr>

pkgname=gens-gs
pkgver=2.16.7
pkgrel=8
pkgdesc='An emulator of Sega Genesis, Sega CD and 32X, combining features from various forks of Gens'
arch=(x86_64)
url=https://segaretro.org/Gens/GS
license=(GPL)
depends=(
  lib32-gtk2
  lib32-libgl
  lib32-sdl
)
makedepends=(
  lib32-libglvnd
  nasm
)
optdepends=(
  'lib32-alsa-plugins: ALSA sound support'
  'lib32-libcanberra: Hide a silly warning'
  'lib32-libpulse: PulseAudio sound support'
)
provides=(gens)
conflicts=(gens)
source=(
  https://retrocdn.net/images/6/6d/Gens-gs-r7.tar.gz
  gens-gtk.patch
)
sha256sums=('6320cd7bee85472891e1e29b21731d2c8180d04db67ee21256491f3f9ad145c1'
            '29b1e9755b34e00ef7d19bdc527dc4f841400a0022c81ee71c331be4a76a6c1c')

prepare() {
  cd gens-gs-r7

  patch -Np1 -i ../gens-gtk.patch
}

build() {
  cd gens-gs-r7

  export CC='gcc -m32'
  export CXX='g++ -m32'
  export PKG_CONFIG_PATH=/usr/lib32/pkgconfig

  LIBS='-ldl -lX11' ./configure \
    --host='i686-unknown-linux-gnu' \
    --prefix='/usr' \
    --libdir='/usr/lib32' \
    --with-pic \
    --disable-static
  make
}

package() {
  cd gens-gs-r7

  make DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
