# Template file for 'kicad'
pkgname=kicad
version=6.0.7
revision=2
build_style=cmake
build_helper=cmake-wxWidgets-gtk3
configure_args="-DKICAD_SCRIPTING_WXPYTHON=ON
 -DKICAD_BUILD_I18N=ON -DKICAD_I18N_UNIX_STRICT_PATH=ON
 -DwxWidgets_CONFIG_EXECUTABLE=$WX_CONFIG
 -DKICAD_USE_OCC=$(vopt_if occt ON OFF) -DKICAD_SPICE=$(vopt_if spice ON OFF)"
hostmakedepends="pkg-config swig wxWidgets-gtk3-devel python3 tar gettext"
makedepends="wxWidgets-gtk3-devel wxPython4 python3-devel glew-devel cairo-devel
 boost-devel libcurl-devel glm libgomp-devel libfreeglut-devel gtk+3-devel
 $(vopt_if occt occt-devel) $(vopt_if spice ngspice-devel)"
depends="wxPython4"
short_desc="Electronic schematic and PCB design software"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="GPL-3.0-or-later"
homepage="http://kicad.org"
distfiles="https://gitlab.com/kicad/code/${pkgname}/-/archive/${version}/kicad-${version}.tar.gz"
checksum=a72e88b15f360d76ea7427923a5073db5e34b5f8cfc4be389cfc24b12a71e7f9
python_version=3
replaces="kicad-i18n>=0"

build_options="spice occt"
build_options_default="spice occt"
desc_option_spice="Enable support for SPICE simulation"
desc_option_occt="Enable support for 3D STEP models"

if [ "$XBPS_WORDSIZE" != "$XBPS_TARGET_WORDSIZE" ]; then
	broken="pybind: Python config failure: Python is 64-bit, chosen compiler is 32-bit"
fi

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	broken="common/libgal.a(draw_panel_gal.cpp.o)"
fi

nocross="execute lemon during build"

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" wxPython4"
	configure_args+=" -DPYTHON_DEST=/${py3_sitelib}
	-DwxWidgets_CONFIG_OPTIONS='--prefix=${XBPS_CROSS_BASE}'"
fi
