aboutsummaryrefslogtreecommitdiffstats
path: root/testing/kicad/APKBUILD
blob: 74920a0d34c2a9d6fa997afd7c5c1166f0b791e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=kicad
pkgver=5.1.9
pkgrel=1
pkgdesc="A Cross Platform and Open Source Electronics Design Automation Suite"
url="https://kicad-pcb.org/"
arch="all !s390x !mips !mips64 !armv7" # No support for s390x in libcontext (shipped with kicad) broken on mips
license="GPL-3.0-or-later"
makedepends="
	boost-dev
	cairo-dev
	chrpath
	cmake
	curl-dev
	glew-dev
	glm-dev
	ngspice-dev
	py3-wxpython
	python3-dev
	swig
	wxgtk-base-dev
	wxgtk3-dev
	zlib-dev
	"
depends="python3"
subpackages="$pkgname-i18n:i18n:noarch $pkgname-doc"
source="
	https://gitlab.com/kicad/code/kicad/-/archive/$pkgver/kicad-$pkgver.tar.gz
	https://gitlab.com/kicad/code/kicad-i18n/-/archive/$pkgver/kicad-i18n-$pkgver.tar.gz
	"

case "$CARCH" in
	x86_64)
		makedepends="$makedepends opencascade-dev vtk-dev"
		subpackages="$subpackages kicad-opencascade"
		;;
	*)
		# Dependency opencascade (needed for STEP file support in 3D preview)
		# not available on all other architectures
		;;
esac

_build_kicad() {
	mkdir -p "$1"
	cd "$1"
	cmake .. \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DKICAD_USE_OCE=OFF \
		-DKICAD_USE_OCC=$2 \
		-DKICAD_SCRIPTING=ON \
		-DKICAD_SCRIPTING_PYTHON3=ON  \
		-DKICAD_SCRIPTING_MODULES=ON  \
		-DKICAD_SCRIPTING_WXPYTHON=ON \
		-DKICAD_SCRIPTING_ACTION_MENU=ON \
		-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON \
		-DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-gtk3 \
		-DwxWidgets_INCLUDE_DIRS=/usr/include \
		-DBUILD_GITHUB_PLUGIN=ON
	make
	cd "$builddir"
}

_build_kicad_i18n() {
	cd "$srcdir"/kicad-i18n-$pkgver
	mkdir -p build
	cd build
	cmake .. -DCMAKE_INSTALL_PREFIX=/usr
	make
	cd "$builddir"
}

build() {
	# First build without opencascade
	_build_kicad "build" "OFF"
	_build_kicad_i18n

	# Now build with opencascade, if possible
	case "$CARCH" in
		x86_64)
			_build_kicad "build-occ" "ON"
			;;
		*)
			# Dependency opencascade (needed for STEP file support in 3D preview)
			# not available on all other architectures
			;;
	esac
}

check() {
	cd build
	make test
}

package() {
	cd build
	make DESTDIR="$pkgdir" install

	local sitedir=$(python3 -c "import site; print(site.getsitepackages()[0])")
	chrpath -d "$pkgdir/$sitedir"/_pcbnew.so
}

i18n() {
	cd "$srcdir"/kicad-i18n-$pkgver/build
	make DESTDIR="$subpkgdir" install
}

opencascade() {
	pkgdesc="kicad with support for STEP file in 3D preview"
	replaces="$pkgname"
	provides="$pkgname=$pkgver-r$pkgrel"
	cd "$builddir/build-occ"
	make DESTDIR="$subpkgdir" install
	# Remove documentation. $pkgname-doc is build from the root package.
	rm -rf "$subpkgdir"/usr/shared/doc

	local sitedir=$(python3 -c "import site; print(site.getsitepackages()[0])")
	chrpath -d "$subpkgdir/$sitedir"/_pcbnew.so
}

sha512sums="1b0676c8e375578b6d06836af35dd2ceb5e35b585e12660fa22461139e2e3af2d90fe2d5787ff8eab111bdba8fbfcc5446a8aa467e54f1372351c5a975df477f  kicad-5.1.9.tar.gz
bd15e13921d98424346d8650db28d8f0c4814599ce29b1135877fe2b34bb53d5d0e974e014a579a1a801f6bdea639de02b6dd4dcabf17d437976f4de819a8969  kicad-i18n-5.1.9.tar.gz"