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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
#uncomment if debhelper should be verbose
#export DH_VERBOSE=1
LIBGPS_SONAME := $(strip $(shell grep -E '^libgps_version_current' SConscript | sed 's,.*=[^0-9]*\([0-9]*\).*,\1,'))
export QT_SELECT=qt5
LIBGPS_DEBIAN_FILE_SOURCES := $(strip $(shell ls -1 debian/*LIBGPSSONAME* ))
LIBGPS_DEBIAN_FILE_TARGETS := $(strip $(shell echo $(LIBGPS_DEBIAN_FILE_SOURCES) | sed 's,LIBGPSSONAME,$(LIBGPS_SONAME),g'))
#python versions
#PYTHON3 := $(shell py3versions -d)
PYTHON3 := python3
#debhelper version and settings needed for udev
DH_VERSION := $(shell dpkg -s debhelper | grep '^Version' | awk '{print $$2}')
LSB_RELEASE := $(shell lsb_release -si)
UDEV_BREAKS =
ifeq (Debian,$(strip $(LSB_RELEASE))) ## debian ##
ifeq (0, $(strip $(shell dpkg --compare-versions $(DH_VERSION) ge 7.3.15; echo $$?)))
UDEV_BREAKS = 125
endif
else ## not debian ##
ifeq (Ubuntu,$(strip $(LSB_RELEASE))) ## ubuntu ##
ifeq (0, $(strip $(shell dpkg --compare-versions $(DH_VERSION) ge 7.0.17ubuntu2; echo $$?)))
UDEV_BREAKS = 136-1
endif
endif ## ubuntu ##
endif ## debian ##
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
SCONSOPTS = \
prefix=/usr \
systemd=yes \
nostrip=yes \
dbus_export=yes \
docdir=/usr/share/doc/gpsd \
libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
gpsd_user=gpsd \
gpsd_group=dialout \
qt_versioned=5 \
python_libdir=/usr/lib/python3/dist-packages
ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
SCONSOPTS += manbuild=no
else
SCONSOPTS += manbuild=yes
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
SCONSOPTS += debug=yes
else
SCONSOPTS += debug=no
endif
#package names
PACKAGE_GPSD := gpsd
PACKAGE_CLIENTS := gpsd-clients
PACKAGE_TOOLS := gpsd-tools
PACKAGE_LIB := libgps$(LIB_soname)
PACKAGE_QTLIB := libqgpsmm$(LIB_soname)
PACKAGE_LIB_DEV := libgps-dev
PACKAGE_QTLIB_DEV := libqgpsmm-dev
PACKAGE_PY := python-gps
PACKAGE_PY3 := python3-gps
cflags := $(shell dpkg-buildflags --get CFLAGS)
cppflags := $(shell dpkg-buildflags --get CPPFLAGS)
cxxflags := $(shell dpkg-buildflags --get CXXFLAGS)
ldflags := $(shell dpkg-buildflags --get LDFLAGS)
SCONS_ENV := set -e ;\
export LDFLAGS="$(ldflags)" ;\
export CFLAGS="$(cflags)" ;\
export CXXFLAGS="$(cxxflags)" ;\
export CPPFLAGS="$(cppflags)";
$(LIBGPS_DEBIAN_FILE_TARGETS): $(LIBGPS_DEBIAN_FILE_SOURCES)
for source in $(LIBGPS_DEBIAN_FILE_SOURCES); do \
target=$$(echo "$$source" | sed 's,LIBGPSSONAME,$(LIBGPS_SONAME),g') ;\
sed 's,LIBGPSSONAME,$(LIBGPS_SONAME),g' "$$source" > "$$target" ;\
done
debian/control: debian/control.in
rm -f $@
sed 's,LIBGPSSONAME,$(LIBGPS_SONAME),g' $< > $@
if which git 1>/dev/null && [ -d .git ]; then \
git add debian/control ;\
git commit -m 'Updating debian/control from debian/control.in' debian/control ;\
fi ;\
SConscript.deb_revision: SConscript
if [ ! -f $@ ]; then \
cp $< $@ ;\
sed -i '/^revision=/s/%(.*)/%("$(DEB_VERSION)",)/' $< ;\
fi
touch $@
build-indep: build
build-arch: build
build: build-stamp
build-stamp: SConscript.deb_revision build-static-stamp
$(SCONS_ENV) $(PYTHON3) /usr/bin/scons shared=yes $(SCONSOPTS) target_python=$(PYTHON3)
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
# disable tests on hurd due to weird ipv6 errors
# http://deb.li/4C46AEAC.7040906@bzed.de
ifeq (,$(findstring hurd,$(DEB_HOST_ARCH_OS)))
-$(SCONS_ENV) $(PYTHON3) /usr/bin/scons check
endif
endif
touch $@
build-static-stamp: SConscript.deb_revision
$(SCONS_ENV) $(PYTHON3) /usr/bin/scons shared=no $(SCONSOPTS) target_python=$(PYTHON3)
cp gpsd-*/libgps.a libgps.a
rm -rf gpsd-*
touch $@
clean: debian/control
dh_testdir
dh_testroot
# revert revision changes in SConscript
if [ -f SConscript.deb_revision ]; then \
mv SConscript.deb_revision SConscript; \
fi
dh_clean
rm -rf \
buildtmp \
gpsd-* \
.sconf_temp \
.scons-option-cache \
.sconsign.dblite \
.sconsign.*.dblite \
gps/*.pyc \
TROUBLESHOOTING \
debian/buildinfo.gz \
config.log \
debian/shlibs.local \
leapsecond.pyc \
libgps.a \
$(LIBGPS_DEBIAN_FILE_TARGETS) \
__pycache__
: install-stamp
install-stamp: build-stamp build-static-stamp $(LIBGPS_DEBIAN_FILE_TARGETS)
dh_testdir
dh_testroot
dh_prep
$(SCONS_ENV) DESTDIR=`pwd`/debian/tmp $(PYTHON3) /usr/bin/scons install $(SCONSOPTS) target_python=$(PYTHON3)
$(SCONS_ENV) DESTDIR=`pwd`/debian/tmp $(PYTHON3) /usr/bin/scons systemd_install $(SCONSOPTS) target_python=$(PYTHON3)
# install static lib
cp libgps.a debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
cp INSTALL.adoc TROUBLESHOOTING.adoc
# we collect our own documentation
rm -rf debian/tmp/usr/share/doc/gpsd
# install everything
dh_install
# quirk to avoid issues by broken fakeroot misdetecting links as files and
# then breaking dh_install -> cp -a fatally
ln -s libgps.so.$(LIBGPS_SONAME).0.0 debian/libgps$(LIBGPS_SONAME)/usr/lib/$(DEB_HOST_MULTIARCH)/libgps.so.$(LIBGPS_SONAME)
rm debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgps.so.$(LIBGPS_SONAME)
dh_missing --fail-missing
touch $@
: install
install-arch: install
binary: install-stamp
dh_testdir
dh_testroot
dh_installchangelogs NEWS
dh_installdocs
dh_installman
dh_installmenu
dh_apparmor --profile-name=usr.sbin.gpsd -pgpsd
dh_installsystemd -pgpsd --restart-after-upgrade gpsdctl@.service gpsd.socket
dh_installsystemd -pgpsd --no-enable --no-start gpsd.service
dh_installinit --no-start
dh_installsystemd -pgpsd --restart-after-upgrade
chmod 755 debian/$(PACKAGE_PY3)/usr/lib/python3*/*-packages/gps/gps.py
dh_python3 -Ngpsd-clients
dh_python3 -pgpsd-clients usr/bin
dh_python3 -pgpsd lib/udev/
cp $(CURDIR)/gpsd-*/gpsd.rules $(CURDIR)/debian/gpsd.udev
dh_installudev
dh_link
dh_strip --dbgsym-migration='gpsd-dbg (<< 3.16-4~)'
dh_compress
dh_fixperms -Xgpsd.hotplug
dh_lintian
ifeq (,$(DEB_BUILD_OPTIONS))
dh_makeshlibs -Nlibqgpsmm$(LIBGPS_SONAME) -- -c4
dh_makeshlibs -plibqgpsmm$(LIBGPS_SONAME) -- -c1
else
dh_makeshlibs
endif
dh_shlibdeps
ifneq (,$(UDEV_BREAKS))
echo "gpsd:Breaks=udev (<< $(UDEV_BREAKS))" >> $(CURDIR)/debian/gpsd.substvars
endif
dh_gencontrol
dh_installdeb
dh_md5sums
dh_builddeb
binary-indep: binary
binary-arch: binary
.PHONY: binary binary-indep binary-arch \
install install-arch install-indep \
clean \
build debian/control
|