name: visualboyadvance-m
summary: Nintendo Game Boy Advance Emulator
description: |
  An open-source Nintendo Game Boy, Super Game Boy, Game Boy Advance Emulators.

adopt-info: vbam
grade: devel
confinement: strict
base: core22
parts:
  vbam:
    source: https://github.com/visualboyadvance-m/visualboyadvance-m.git
    override-pull: |
      snapcraftctl pull
      last_commit="$(git describe | sed 's/^v//; s/-.*-/-/')"
      snapcraftctl set-version "${last_commit}"
      sed -i.bak -e 's|Icon=visualboyadvance-m|Icon=/usr/share/icons/hicolor/scalable/apps/visualboyadvance-m.svg|g' src/wx/visualboyadvance-m.desktop
    plugin: cmake
    cmake-generator: Ninja
    stage-packages:
      - libsdl2-2.0-0
      - libsfml-network2.5
      - libsfml-system2.5
      - libnotify4
      - libsm6
      - libopenal1
      - libpng16-16
      - libpulse0
      - zlib1g
      - libgtk-3-0
      - libgl1
      - libglvnd0
      - libglx0
      - libopengl0
      - libwxgtk3.0-gtk3-0v5

    build-packages:
      - g++
      - gcc
      - gettext
      - make
      - cmake
      - nasm
      - pkg-config
      - git
      - zip
      - libnotify-dev
      - libsdl2-dev
      - libsfml-dev
      - libgtk-3-dev
      - libopenal-dev
      - libwxgtk3.0-gtk3-dev
    cmake-parameters:
      - -DENABLE_SDL=OFF
      - -DCMAKE_INSTALL_PREFIX=/usr

apps:
  visualboyadvance-m:
    plugs:
      - desktop
      - desktop-legacy
      - audio-playback
      - opengl
      - joystick
      - raw-usb
      - screen-inhibit-control
      - home
      - removable-media
      - network
      - wayland
      - x11
    command: usr/bin/visualboyadvance-m
    desktop: usr/share/applications/visualboyadvance-m.desktop
    extensions: [gnome]
    environment:
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
