# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=simgear
pkgver=2017.3.1
pkgrel=0
pkgdesc="Sim library for FlightGear"
url="https://github.com/FlightGear/simgear"
arch="all"
license="GPL"
depends=
depends_dev=
makedepends="$depends_dev boost-dev cmake curl-dev mesa-dev openal-soft-dev
	openscenegraph-dev zlib-dev"
install=
subpackages=
source="$pkgname-$pkgver.tar.gz::https://github.com/FlightGear/simgear/archive/version/$pkgver.tar.gz
	musl-fixes.patch
	"

builddir="$srcdir"/$pkgname-version-$pkgver

prepare() {
	cd "$builddir"
	default_prepare || return 1
	mkdir sgbuild && cd sgbuild || return 1
	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-D_POSIX_C_SOURCE=200112L \
		|| return 1
}

build() {
	cd "$builddir/sgbuild"
	make || return 1
}

package() {
	cd "$builddir/sgbuild"
	make DESTDIR="$pkgdir" install || return 1
}

sha512sums="bb05a200d5fdd173a5f7c8ca1a2279c8766f93de6823ea34af31a9a105a9e46d526b37c5a2231a2e9cd9759ffd1354a89ff1f731b3b9974c749d7fe4f1cd51bf  simgear-2017.3.1.tar.gz
7efcf01c9328b0732ae9aa7af4edb52e14919663a8d3acbe429a0697f59a55e85a71628d9afaa3d38327d960dbf5dacc1f964e38dd6cb499b593ae2be918b140  musl-fixes.patch"
