summarylogtreecommitdiffstats
path: root/PKGBUILD.in
blob: e395d20b55e9cc0102a38a158f0fdef27526e5b0 (plain)
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
# Maintainer: Rachel Mant <dx-mon@users.sourceforge.net>

pkgname=kicad-nightly
pkgver=@KICAD_VERSION@
pkgrel=1
pkgdesc='Electronic schematic and printed circuit board (PCB) design tools'
arch=('x86_64')
url='http://kicad-pcb.org/'
license=('GPL')
depends=('wxgtk3' 'python' 'boost-libs' 'glew' 'curl' 'glm' 'ngspice' 'opencascade' 'python-wxpython')
makedepends=('git' 'cmake' 'zlib' 'mesa' 'boost' 'swig' 'ninja')
options=('!strip')
optdepends=(
	'kicad-library-nightly: for footprints and symbols'
	'kicad-library-3d-nightly: for 3d models of components'
)
source=(
	'git+https://gitlab.com/kicad/code/kicad.git'#commit=@KICAD_HASH@
	'git+https://gitlab.com/kicad/code/kicad-i18n.git'#commit=@I18N_HASH@
	'kicad-nightly.env'
)
sha256sums=(
	'SKIP' 'SKIP'
	'fce26af6b9c181a99197bfc9bc6c778561ad55a375480f4d0d73bb34078b5d18'
)

build()
{
	cd "$srcdir/kicad"

	mkdir build
	cd build
	cmake .. -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr/lib/kicad-nightly \
		-DCMAKE_INSTALL_DATADIR=/usr/share/kicad-nightly \
		-DCMAKE_INSTALL_DOCDIR=/usr/share/doc/kicad-nightly \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib/kicad-nightly/lib \
		-DCMAKE_EXECUTABLE_SUFFIX=-nightly \
		-DKICAD_USE_OCE=OFF \
		-DKICAD_USE_OCC=ON \
		-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 \
		-DKICAD_DATA=/usr/share/kicad-nightly \
		-DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-gtk3 \
		-DBUILD_GITHUB_PLUGIN=ON
	ninja

	cd "$srcdir/kicad-i18n"

	mkdir build
	cd build
	cmake .. -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr/lib/kicad-nightly \
		-DCMAKE_INSTALL_DATADIR=/usr/share/kicad-nightly \
		-DCMAKE_INSTALL_DOCDIR=/usr/share/doc/kicad-nightly
	ninja
}

package()
{
	cd "$srcdir/kicad/build"
	DESTDIR="$pkgdir" ninja install

	mkdir -p "$pkgdir/usr/share"
	for prog in bitmap2component eeschema gerbview kicad pcbcalculator pcbnew; do
		sed -i \
			-e 's/^Exec=\([^ ]*\)\(.*\)$/Exec=\1-nightly\2/g' \
			-e 's/^Icon=\(.*\)$/Icon=\1-nightly/g' \
			-e 's/^Name=\(.*\)$/Name=\1 nightly/g' \
			"$pkgdir/usr/lib/kicad-nightly/share/applications/$prog.desktop"
		mv "$pkgdir/usr/lib/kicad-nightly/share/applications/$prog.desktop" \
			"$pkgdir/usr/lib/kicad-nightly/share/applications/${prog}-nightly.desktop"
	done
	mv "$pkgdir/usr/lib/kicad-nightly/share/applications" "$pkgdir/usr/share"

	cd "$srcdir"
	mkdir -p "$pkgdir/usr/share/kicad-nightly"
	cp kicad-nightly.env "$pkgdir/usr/share/kicad-nightly/kicad-nightly.env"

	mkdir -p "$pkgdir/usr/bin"
	(cd "$pkgdir/usr/lib/kicad-nightly/bin" && ls | grep -v '\.kiface') | while read prog; do
		cat > "$pkgdir/usr/bin/$prog-nightly" <<EOF
#!/bin/sh
. /usr/share/kicad-nightly/kicad-nightly.env
exec /usr/lib/kicad-nightly/bin/$prog
EOF
		chmod +x "$pkgdir/usr/bin/$prog-nightly"
	done

	cd "$srcdir/kicad-i18n/build"
	DESTDIR="$pkgdir" ninja install
}