summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2615e8a909ab15413cbc97c8f45d036730a757ae (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
98
99
# Maintainer: Darrell Enns <darrell at darrellenns dot com>
# Contributor: qubidt <qubidt at gmail dot com>
# Contributor: loredan13
# Contributor: lf <packages at lfcode dot ca>
pkgname=klipper-git
_pkgname=klipper
pkgver=r4940.e2d7c5981
pkgrel=1
pkgdesc="3D printer firmware with motion planning on the host"
arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h' 'aarch64')
url="https://www.klipper3d.org/"
license=('GPL3')
groups=()
depends=(
	python-cffi
	python-pyserial
	python-greenlet
	python-jinja
	python-can
	libusb
)
optdepends=(
	'ncurses: for choosing compilation config'
	'avrdude: for flashing firmware on AVR MCU'
	'stm32flash: for flashing firmware on STM MCU'
	'avr-gcc: for AVR MCU firmware compilation'
	'avr-binutils: for AVR MCU firmware compilation'
	'avr-libc: for AVR MCU firmware compilation'
	'python-numpy: for resonance measurement'
	'python-matplotlib: for resonance measurement'
	'dfu-util: for flashing firmware on STM32 MCUs'
)
optdepends_x86_64=(
	'arm-none-eabi-newlib: for ARM MCU firmware compilation'
	'arm-none-eabi-gcc: for ARM MCU firmware compilation'
	'arm-none-eabi-binutils: for ARM MCU firmware compilation'
)
makedepends=('git')
provides=("$_pkgname")
conflicts=("$_pkgname")
replaces=()
backup=("etc/${_pkgname}/klipper.cfg"
        "usr/lib/klipper/.config")
options=()
install='klipper.install'
source=("${_pkgname}::git+https://github.com/Klipper3d/klipper"
        'klipper.service'
        'sysusers.conf'
        'tmpfiles.conf')
noextract=()
md5sums=('SKIP'
         '4ccfb9669d304b99146b92a4912ae1fd'
         'cf3715af9f53cc1660e412abe3697342'
         'd707e8986ed6cf189461f03bdaf365aa')

pkgver() {
	cd "$srcdir/$_pkgname"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/$_pkgname"
	python -m compileall klippy
	python klippy/chelper/__init__.py
}

package() {
	cd "$srcdir/$_pkgname"
	install -Dm644 "$srcdir/klipper.service" "$pkgdir/usr/lib/systemd/system/${_pkgname}.service"
	install -Dm644 "$srcdir/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/${_pkgname}.conf"
	install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/${_pkgname}.conf"

	install -m775 -d "$pkgdir/usr/lib/${_pkgname}"
	install -m755 -d "$pkgdir/usr/lib/${_pkgname}/docs"
	install -m755 -d "$pkgdir/usr/lib/${_pkgname}/config"
	install -m775 -d "$pkgdir/usr/lib/${_pkgname}/klippy"
	install -m755 -d "$pkgdir/usr/lib/${_pkgname}/lib"
	install -m755 -d "$pkgdir/usr/lib/${_pkgname}/src"
	install -m755 -d "$pkgdir/usr/lib/${_pkgname}/scripts"
	install -m2775 -d "$pkgdir/etc/${_pkgname}"
	install -m2775 -d "$pkgdir/usr/lib/${_pkgname}/out"
	install -m2775 -d "$pkgdir/var/lib/${_pkgname}"

	cp -ra "$srcdir/${_pkgname}/docs"/* "$pkgdir/usr/lib/${_pkgname}/docs"/
	cp -ra "$srcdir/${_pkgname}/config/"* "$pkgdir/usr/lib/${_pkgname}/config"/
	cp -ra "$srcdir/${_pkgname}/klippy/"* "$pkgdir/usr/lib/${_pkgname}/klippy"/
	cp -ra "$srcdir/${_pkgname}/scripts/"* "$pkgdir/usr/lib/${_pkgname}/scripts"/
	cp -ra "$srcdir/${_pkgname}/lib/"* "$pkgdir/usr/lib/${_pkgname}/lib"/
	cp -ra "$srcdir/${_pkgname}/Makefile" "$pkgdir/usr/lib/${_pkgname}"/
	cp -ra "$srcdir/${_pkgname}/src/"* "$pkgdir/usr/lib/${_pkgname}/src"/

	mkdir -p "$pkgdir//usr/share/doc"
	ln -s "/usr/lib/${_pkgname}/docs" "$pkgdir/usr/share/doc/${_pkgname}"

	touch "$srcdir/${_pkgname}/.config"
	install -m664 "$srcdir/${_pkgname}/.config" "$pkgdir/usr/lib/${_pkgname}/.config"

	python scripts/make_version.py ARCHLINUX > "$pkgdir/usr/lib/${_pkgname}/klippy/.version"
}