# Template file for 'Lidarr'
pkgname=Lidarr
version=0.5.0.583
revision=1
hostmakedepends="msbuild-bin mono nodejs-lts yarn"
makedepends="libgdiplus-devel"
depends="mono libmediainfo"
short_desc="Music collection manager for Usenet and BitTorrent users"
maintainer="Young Jin Park <youngjinpark20@gmail.com>"
license="GPL-3.0-or-later"
homepage="http://lidarr.audio/"
_curlsharp_version=2.0.0
distfiles="https://github.com/lidarr/Lidarr/archive/v${version}.tar.gz
 https://github.com/Sonarr/CurlSharp/archive/sonarr-v${_curlsharp_version}.tar.gz"
checksum="58b814975b568fccaf3f68bfc37b9c7d81bea123a5c5f4e57fa1fd08b16bf450
 46b2ab7fca9ee322bd245569cad6204f7fb21f4d47ade722b9a8c5ca44685eae"

system_accounts="lidarr"
broken="System.DllNotFoundException: libgdiplus.so.0"
lidarr_homedir="/var/lib/lidarr"

case "$XBPS_TARGET_MACHINE" in
	i686*) broken="yarn broken on i686"
esac

make_dirs="
 /var/log/Lidarr/ 700 lidarr lidarr
 /var/lib/lidarr/ 750 lidarr lidarr"

post_extract() {
	cp -r ../CurlSharp-sonarr-v${_curlsharp_version}/* src/ExternalModules/CurlSharp
}

pre_build() {
	mono tools/nuget/nuget.exe update -self
}

do_build() {
	./build.sh
}

do_install() {
	vmkdir usr/lib/Lidarr
	vcopy _output_linux/* usr/lib/Lidarr
	vbin ${FILESDIR}/lidarr
	vsv Lidarr
}
