File: rules

package info (click to toggle)
gpsd 2.37-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,564 kB
  • ctags: 2,813
  • sloc: ansic: 20,476; sh: 9,233; xml: 2,910; python: 1,764; php: 472; makefile: 440; cpp: 121
file content (214 lines) | stat: -rwxr-xr-x 5,730 bytes parent folder | download
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
#!/usr/bin/make -f

include /usr/share/dpatch/dpatch.make

#uncomment if debhelper should be verbose
#export DH_VERBOSE=1

CONFFLAGS =
CONFENV =
CFLAGS =
LDFLAGS =
CPPFLAGS =

#python versions
PYVERS := $(shell pyversions -r)

#let's help configure to figure out our host/build system
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
else
  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif



#where our files go
PREFIX = /usr
MANDIR = $(PREFIX)/share/man
INFODIR = $(PREFIX)/share/info
CONFFLAGS += --prefix=$(PREFIX) --mandir=$(MANDIR) --infodir=$(INFODIR)



#let's take care of optimization + debug builds
CFLAGS += -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

#LDFLAGS
LDFLAGS +=  -Wl,-z,defs

CONFENV += LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"


#we build the python extension manually
CONFFLAGS += --disable-python

#support dbus
CONFFLAGS += --enable-dbus


#library versions
LIB_version := $(shell grep '^libgps_la_LDFLAGS' Makefile.am | \
	                   sed 's,^[^0-9]*,,g;s,\([0-9]*\):\([0-9]*\):\([0-9]*\),\1.\3.\2,g')
LIB_major := $(shell echo $(LIB_version) | sed 's,\..*,,g')



#package names
PACKAGE_GPSD := gpsd
PACKAGE_CLIENTS := gpsd-clients
PACKAGE_LIB := $(shell grep '^Package: libgps$(LIB_major)' debian/control | \
	               awk '{print $$2}')
PACKAGE_LIB_DEV := libgps-dev
PACKAGE_PY := python-gps



autotools-dev-stamp:
	dh_testdir

ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	touch $@


configure: config.status
config.status: patch-stamp autotools-dev-stamp
	dh_testdir
	$(CONFENV) ./configure $(CONFFLAGS)

build: build-gpsd build-python
build-gpsd: build-gpsd-stamp
build-python: build-python-stamp
build-gpsd-stamp: config.status
	dh_testdir
	$(MAKE)
	#this is a rather ugly hack to work around broken linebreaks
	#from docbook
	sed -i 's,^.BI "void gps_set_callback(struct,.warn .BI "void gps_set_callback(struct,' libgps.3
	cp INSTALL TROUBLESHOOTING
	touch $@
#unfortunately sbuild/pbilder don't support ptys
#ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
#	$(MAKE) testregress
#endif

build-python-stamp: build-gpsd-stamp
	dh_testdir
	$(MAKE) packet_names.h gpsfake.1 gpsprof.1
	set -e; \
	unset CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS ;\
	for py in $(PYVERS); do  \
	  $$py setup.py build; \
	done
	touch $@


install: install-gpsd install-python

install-gpsd: build-gpsd-stamp
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	cp INSTALL TROUBLESHOOTING
	#ldconfig link
	dh_link -p$(PACKAGE_LIB) usr/lib/libgps.so.$(LIB_version) \
	                         usr/lib/libgps.so.$(LIB_major)
	dh_link -p$(PACKAGE_LIB_DEV) usr/lib/libgps.so.$(LIB_major) \
	                             usr/lib/libgps.so
	#the build-system creates some really weird files here
	#(instead of not creating a file at all)
	rm -f $(CURDIR)/debian/tmp/usr/share/man/man1/cgps.1 \
	      $(CURDIR)/debian/tmp/usr/share/man/man1/cgpxlogger.1 \
	      $(CURDIR)/debian/tmp/usr/share/man/man1/gpxlogger.1
	dh_installman -p$(PACKAGE_CLIENTS) xgps.1
	dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
	                             usr/share/man/man1/cgps.1.gz
	dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
	                             usr/share/man/man1/xgpsspeed.1.gz
	dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
	                             usr/share/man/man1/cgpxlogger.1.gz
	dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
	                             usr/share/man/man1/gpxlogger.1.gz
	chmod 755 debian/gpsd.hotplug.wrapper
	install -d -m 755 debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults
	install -m 644 xgps.ad debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults/xgps
	install -m 644 xgpsspeed.ad debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults/xgpsspeed
	dh_install
	dh_install -p$(PACKAGE_LIB) debian/tmp/usr/lib/libgps.so.$(LIB_version)


install-python: build-python-stamp
	set -e ;\
	unset CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS ;\
	for py in $(PYVERS); do  \
	  $$py setup.py install --root=debian/$(PACKAGE_PY); \
	done

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	dh_clean
	#sanity check if debian/control lists the right package name
	grep -q '^Package: libgps$(LIB_major)' debian/control
	#update debconf po files
	debconf-updatepo
	rm -f autotools-dev-stamp
	rm -f build-gpsd-stamp build-python-stamp
	rm -f TROUBLESHOOTING
	[ ! -r setup.py ] || python setup.py clean
	rm -rf build
	[ ! -r Makefile ] || $(MAKE) distclean
	rm -f *.1 *.3 *.5 *.8 .1
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	rm -f config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	rm -f config.guess
endif



binary-indep: 
#nothing to do here.

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -s 
	dh_installdocs -s
	dh_installmenu -s
	dh_installdebconf -s
	dh_installinit -s
	dh_installexamples -s
	dh_pysupport -s
	chmod 755 debian/$(PACKAGE_PY)/usr/share/python-support/python-gps/gps.py
	dh_installudev -s
	dh_link -s
	dh_strip -s
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_installdeb -s
	dh_md5sums -s
	dh_builddeb -s

binary: binary-indep binary-arch


.PHONY: build build-gpsd build-python build-lib-static \
	clean clean-patched \
	binary-indep binary-arch binary install \
	install-python install-gpsd