# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Tesx <tesfabpel@gmail.com>

pkgname=goxel
pkgver=0.10.8
pkgrel=2
pkgdesc='3D program that lets you create voxel volumes'
arch=(x86_64)
url='https://goxel.xyz/'
license=(GPL3)
depends=(glfw gtk3)
makedepends=(scons)
source=("$pkgname-$pkgver.tar.gz::https://github.com/guillaumechereau/$pkgname/archive/v$pkgver.tar.gz")
b2sums=('6752c350b456fd021f066e51d8d3f0af8d1146703998858b80dd39328c0137a8e243598f6103cdae511a13d8e4666d90958676ddd6b48d5a26e892672d2c221a')

prepare() {
  cd $pkgname-$pkgver

  # Quick hack for the imgui.ini file that is placed directly in the home directory.
  # Upstream bug report: https://github.com/guillaumechereau/goxel/issues/250
  sed -i 's,"imgui.ini",".goxelrc",g' ext_src/imgui/imgui.cpp

  # Desktop shortcut fixes
  sed -i 's|/share/applications/goxel.desktop|/share/applications/io.github.guillaumechereau.Goxel.desktop|g' Makefile
  sed -i 's|\${SNAP}/icon.png|goxel|;s|Name=goxel|Name=Goxel|' snap/gui/goxel.desktop
}

build() {
  cd $pkgname-$pkgver
  scons mode=release werror=n
}

package() {
  make -C $pkgname-$pkgver DESTDIR="$pkgdir" PREFIX=/usr install
}
