summaryrefslogtreecommitdiff
path: root/repo/i2c-tools/i2c-tools.xibuild
blob: 6e9cd9a1c43fc956a96e68d070e53a57fdf1ed19 (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
#!/bin/sh

NAME="i2c-tools"
DESC="Tools for monitoring I2C devices"

MAKEDEPS=" linux-headers python"
DEPS="python"

PKG_VER=4.3
SOURCE="https://fossies.org/linux/misc/i2c-tools-$PKG_VER.tar.gz"

prepare() {
	apply_patches
	sed -e "s|^DESTDIR.*|DESTDIR = \"$PKG_DEST\"|" \
			-e "s|^prefix.*|prefix = /usr|" \
		 	-e "s|^PREFIX.*|PREFIX = /usr|" \
			-i Makefile
}

build() {
	make

	cd py-smbus
	CFLAGS="$CFLAGS -I$BUILD_ROOT/include" python3 setup.py build
    cd ..
}

package() {
	make install

	install -d "$PKG_DEST"/usr/lib
	mv "$PKG_DEST"/usr/lib/python3* "$PKG_DEST"/usr/lib

	cd py-smbus
	python3 setup.py install --prefix=/usr --root="$PKG_DEST"

}

postinstall () {
    groupadd i2c
    echo 'KERNEL=="i2c-[0-9]*", GROUP="i2c"' >> /etc/udev/rules.d/10-local_i2c_group.rules
}