Gordons Projects

--> Projects Top-Level GIT

Introduce a proper Debian source package build system
[wiringPi] / debian / rules
1 #!/usr/bin/make -f
2
3 .PHONY: build
4
5 VERSION:=$(shell cat VERSION)
6 export VERSION
7
8 soname:=$(shell echo $${VERSION%%.*})
9 WIRINGPI_SONAME_SUFFIX:=.$(soname)
10 export soname
11 export WIRINGPI_SONAME_SUFFIX
12
13 build:
14         dh $@
15
16 override_dh_auto_configure:
17
18 override_dh_prep:
19         dh_prep -Xdebian/tmp
20
21 dirs:
22         dh_installdirs -A
23         mkdir debian/tmp
24         set -e; for p in `dh_listpackages`; do \
25                 (cd debian/$$p; find -type d) | \
26                 (cd debian/tmp; xargs mkdir -p) \
27         done
28
29 override_dh_clean:
30         dh_clean
31         WIRINGPI_SUDO= bash -xe ./build clean
32
33 override_dh_auto_build: dirs
34         V=1 LDCONFIG=: WIRINGPI_SUDO= WIRINGPI_SUID=0 \
35             DESTDIR=`pwd`/debian/tmp/usr \
36             PREFIX= WIRINGPI_SUDO= \
37             bash -xe ./build
38
39 override_dh_auto_install:
40         dh_install
41         set -ex; for l in libwiringPi libwiringPiDev; do \
42                 ln -sf $$l.so.$${VERSION} \
43                         debian/libwiringpi$$soname/usr/lib/$$l.so.$$soname; \
44                 ln -sf $$l.so.$${VERSION} \
45                         debian/libwiringpi-dev/usr/lib/$$l.so; \
46         done
47
48 %:
49         dh $@