void-packages/srcpkgs/WiringPi/template

111 lines
2.7 KiB
Bash

# Template file for 'WiringPi'
pkgname=WiringPi
version=0.0.20200408
revision=2
_githash=50b7c5ed7d238a637db7d9c73978466eb022a8de
_sover=2.60
archs="arm*"
wrksrc="${pkgname}-${_githash}"
build_style=meta
depends="libwiringPi-${version}_${revision}
libwiringPi-dev-${version}_${revision}
WiringPi-gpio-${version}_${revision}
WiringPi-examples-${version}_${revision}"
short_desc="GPIO Interface library for the Raspberry Pi"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="LGPL-3.0-or-later"
homepage="http://wiringpi.com/"
distfiles="https://github.com/WiringPi/WiringPi/archive/${_githash}.tar.gz"
checksum=ba83290d3c5e4cd3fd470321ab2a85133334014532e5f275ef4d699ccaf72fc5
CFLAGS="-fcommon -Wno-unused-result -I. -I../wiringPi -I../devLib"
do_configure() {
find -name Makefile -exec sed -i "{}" \
-e "s;^DEBUG;#DEBUG;" \
-e "s;^CC;#CC;" \
-e "s;^INCLUDE;#INCLUDE;" \
-e "s;^DEFS;#DEFS;" \
-e "s;^CFLAGS;#CFLAGS;" \
-e "s;^LDFLAGS;#LDFLAGS;" \
-e "s;^LIBS;#LIBS;" \
\;
}
do_build() {
msg_normal "Building wiringPi ...\n"
make ${makejobs} -C wiringPi all
ln -srv wiringPi/libwiringPi.so.${_sover} \
wiringPi/libwiringPi.so
msg_normal "Building devLib ...\n"
export LIBS+=" -Wl,-L,../wiringPi -Wl,-l,wiringPi"
make ${makejobs} -C devLib all
ln -srv devLib/libwiringPiDev.so.${_sover} \
devLib/libwiringPiDev.so
msg_normal "Building gpio ...\n"
export LIBS+=" -lcrypt -lrt -lm"
export LIBS+=" -Wl,-L,../devLib -Wl,-l,wiringPiDev"
make ${makejobs} V=1 -C gpio all
}
do_install() {
export LDCONFIG="/usr/bin/true"
export PREFIX="/usr"
# Temporary symlink /usr/lib -> /lib for install
ln -srv ${DESTDIR}/usr/lib ${DESTDIR}/lib
make DESTDIR="${DESTDIR}" -C wiringPi install
make DESTDIR="${DESTDIR}" -C devLib install
rm -v ${DESTDIR}/lib
# Fix borked symlinks to *.so files
ln -srvf ${DESTDIR}/usr/lib/libwiringPi.so.${_sover} \
${DESTDIR}/usr/lib/libwiringPi.so
ln -srvf ${DESTDIR}/usr/lib/libwiringPiDev.so.${_sover} \
${DESTDIR}/usr/lib/libwiringPiDev.so
# Install gpio
vbin gpio/gpio
vman gpio/gpio.1
# Install examples
vmkdir usr/share/examples
vcopy examples usr/share/examples/WiringPi
}
libwiringPi_package() {
short_desc+=" - libraries"
pkg_install() {
vmove usr/lib/libwiringPi.so.${_sover}
vmove usr/lib/libwiringPiDev.so.${_sover}
}
}
libwiringPi-dev_package() {
short_desc+=" - development files"
depends="libwiringPi-${version}_${revision}"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.so"
}
}
WiringPi-gpio_package() {
short_desc+=" - gpio tool"
pkg_install() {
vmove usr/bin
vmove usr/share/man
}
}
WiringPi-examples_package() {
short_desc+=" - examples"
pkg_install() {
vmove usr/share/examples
}
}