# Template file for 'kicad'
pkgname=kicad
version=7.0.8
revision=1
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_EGL=ON
 -DKICAD_USE_OCC=$(vopt_if occt ON OFF) -DKICAD_SPICE=$(vopt_if spice ON OFF)"
hostmakedepends="pkg-config swig wxWidgets-gtk3-devel tar gettext
 python3 python3-setuptools"
makedepends="wxWidgets-gtk3-devel wxPython python3-devel glew-devel
 cairo-devel boost-devel libcurl-devel glm libgomp-devel libfreeglut-devel
 gtk+3-devel unixodbc-devel
 $(vopt_if occt occt-devel) $(vopt_if spice ngspice-devel)"
depends="wxPython"
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/kicad/-/archive/${version}/kicad-${version}.tar.gz"
checksum=734e8e1de21f6015bc41b2b79cc9e1aefdda5e6ff111a269191cebe0894a5c45
python_version=3
replaces="kicad-i18n>=0"
# one test appears to be flaky
# https://gitlab.com/kicad/code/kicad/-/blob/7.0.0/qa/unittests/eeschema/test_netlist_exporter_spice.h#L195-197
make_check=ci-skip

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+=" wxPython"
	configure_args+=" -DPYTHON_DEST=/${py3_sitelib}
	-DwxWidgets_CONFIG_OPTIONS='--prefix=${XBPS_CROSS_BASE}'"
fi

CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
