### this file is sourced not run
PKGVER=5.0.0
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=kicad-$PKGVER.tar.xz
MD5SUM=99a39910a3f7d8320b605bb9a9ff3af8
SRC_URL=https://launchpad.net/kicad/5.0/$PKGVER/+download/$TARBALL
BUNDLE=

SLACKREQ='wxwidgets libglew cairo freeglut python curl liboce libngspice curl'
# build-time: libglm, private libboost 
SLACKDESC="kicad: kicad $PKGVER (Open source EDA)
kicad: 
kicad: KiCad is a Cross Platform and Open Source Electronics Design 
kicad: Automation Suite. Comes with tools to do schematic capture, 
kicad: simulation, and making professional PCB layout.
kicad: 
kicad: You will also need kicad-data package, please use matching version.
kicad: 
kicad: http://kicad-pcb.org/
kicad: 
kicad: 
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	# need to download stuff
	echo nameserver 8.8.8.8 > /etc/resolv.conf &&
	
	# cmake can be stupid ...
	rm /usr/bin/wx-config && ln -s wx-config-64 /usr/bin/wx-config &&

	# lib64 fix
	cd /tmp/kicad* &&
	sed -i -e 's|lib/kicad/plugins|lib64/kicad/plugins|' CMakeLists.txt &&

	# build options
	CMAKEFLAGS="$CMAKEFLAGS \
		-DCMAKE_BUILD_TYPE=Release \
		-DKICAD_SCRIPTING=ON \
		-DKICAD_SCRIPTING_MODULES=ON \
		-DKICAD_SCRIPTING_WXPYTHON=OFF \
		-DKICAD_SCRIPTING_ACTION_MENU=ON \
	" &&
	MAKEINSTALLFLAGS=-j4 &&

	pkg_build_cmake &&
	pkg_build_slackdesc &&

	# cleanup
	rm -f /usr/bin/wx-config /etc/resolv.conf /root/.bzr.log &&
	rm -r /root/.bazaar
}


