# Template file for 'tracebox'
pkgname=tracebox
version=0.4.4
revision=5
_click_ver=2.0.1
_crafter_git=3db70ab6fd62ade25de7328aaf8e9ba92696c92e
_crafter_ver=0.3.3git
create_wrksrc=yes
archs="i686 x86_64"
build_style=gnu-configure
hostmakedepends="automake pkg-config libtool unzip"
makedepends="libpcap-devel json-c-devel lua53-devel"
short_desc="Middlebox detection tool"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="http://www.tracebox.org/"
distfiles="
 https://github.com/tracebox/tracebox/archive/v${version}.tar.gz>tracebox-${version}.tar.gz
 https://github.com/bhesmans/click/archive/v${_click_ver}.tar.gz>click-${_click_ver}.tar.gz
 https://github.com/pellegre/libcrafter/archive/${_crafter_git}.zip>libcrafter-${_crafter_ver}.zip"
checksum="
 d212f02c6dfee51ab198413a7a53547fc2b5fe139efb3ebf082f1729c2d18f9f
 4e48591cb385000ee8daedf3cc18d4b00a9c5a142cc001e0780f0c7ebd713764
 d3a182a06b86a0bff7f9f5792876f8da9db9dd7936f36ef1b40770c400f43b97"
nocross=yes

CXXFLAGS="-std=c++14 -DHAVE_LUA_PUSHGLOBALTABLE=1"

pre_configure() {
	mv tracebox-${version}/* .
	# Do what ./bootstrap.sh would have done but without using git to pull submodules
	mkdir -p ${wrksrc}/test/tools ${wrksrc}/noinst/libcrafter
	mv -v click-${_click_ver} test/tools/click
	mv -v libcrafter-${_crafter_git}/{.gitignore,README,libcrafter} noinst/libcrafter
	rmdir -v libcrafter-${_crafter_git}
	# Set missing AM_PROG_AR
	sed -e "/AC_PROG_CXX/iAM_PROG_AR=${AR}" -i noinst/libcrafter/libcrafter/configure.ac
	autoreconf --force --install --verbose
}
