# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
setvar pkgname = 'gns3-server'
setvar pkgver = '2.0.3'
setvar pkgrel = '0'
setvar pkgdesc = ""GNS3 network simulator. Server package.""
setvar url = ""https://github.com/GNS3/gns3-server""
setvar arch = ""all""
setvar license = ""GPL3""
setvar depends = ""busybox dynamips python3 py3-psutil py3-jinja2 py3-aiohttp1
	py3-aiohttp1-cors py3-pytest py3-netifaces py3-ws4py py3-zipstream
	py3-raven py3-jsonschema py3-yarl""
setvar makedepends = ""busybox-static py-setuptools python3-dev linux-headers py3-pytest""
setvar subpackages = ""$pkgname-doc""
setvar source = ""$pkgname-$pkgver.tar.gz::https://github.com/GNS3/$pkgname/archive/v$pkgver.tar.gz
	dropped-requirements.patch""

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

proc check {
	cd $builddir
	python3 setup.py check
}

proc build {
	cd $builddir
	# Upstream includes busybox binary for x86_64. We want to replace it by
	# $CARCH binary
	if test $CARCH != "x86_64"  {
		setvar busybox_bin = $(find . -name busybox -type f)
		cp /bin/busybox.static $busybox_bin
	}
	python3 setup.py build
}

proc package {
	cd $builddir
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	cat >"$pkgdir"/usr/share/doc/$pkgname/README.alpine <<< """
gns3-server has several optional packages that must be installed manually for additional functionality:

  apk add qemu
  apk add wiresark
  apk add ubridge
  apk add cpulimit
  apk add iouyap
  apk add vpcs

"""

}

setvar sha512sums = ""a9927e414f6fc6558cecabd006f9d123752b0b6e5b88408a53a6d1f195d22047ffdc3e4ccc6e132d04135c434174aa4b58f29deae9e952f83ccc678037f25b8a  gns3-server-2.0.3.tar.gz
e698dd1165b4493c8b467618ccffd31395af5832975a520a239fb03ec62678c3528f386eadd309686bd2cd73b89246c225510cc08bec5ff7389f2de84a380ca3  dropped-requirements.patch""