Devuan fork of gpsd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

215 lines
5.6 KiB

  1. #!/usr/bin/make -f
  2. include /usr/share/dpatch/dpatch.make
  3. #uncomment if debhelper should be verbose
  4. #export DH_VERBOSE=1
  5. CONFFLAGS =
  6. CONFENV =
  7. CFLAGS =
  8. LDFLAGS =
  9. CPPFLAGS =
  10. #python versions
  11. PYVERS := $(shell pyversions -r)
  12. #let's help configure to figure out our host/build system
  13. DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  14. DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  15. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  16. CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
  17. else
  18. CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  19. endif
  20. #where our files go
  21. PREFIX = /usr
  22. MANDIR = $(PREFIX)/share/man
  23. INFODIR = $(PREFIX)/share/info
  24. CONFFLAGS += --prefix=$(PREFIX) --mandir=$(MANDIR) --infodir=$(INFODIR)
  25. #let's take care of optimization + debug builds
  26. CFLAGS += -Wall -g
  27. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  28. CFLAGS += -O0
  29. else
  30. CFLAGS += -O2
  31. endif
  32. #LDFLAGS
  33. LDFLAGS += -Wl,-z,defs
  34. CONFENV += LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"
  35. #we build the python extension manually
  36. CONFFLAGS += --disable-python
  37. #support dbus
  38. CONFFLAGS += --enable-dbus
  39. #library versions
  40. LIB_version := $(shell grep '^libgps_la_LDFLAGS' Makefile.am | \
  41. sed 's,^[^0-9]*,,g;s,\([0-9]*\):\([0-9]*\):\([0-9]*\),\1.\3.\2,g')
  42. LIB_major := $(shell echo $(LIB_version) | sed 's,\..*,,g')
  43. #package names
  44. PACKAGE_GPSD := gpsd
  45. PACKAGE_CLIENTS := gpsd-clients
  46. PACKAGE_LIB := $(shell grep '^Package: libgps$(LIB_major)' debian/control | \
  47. awk '{print $$2}')
  48. PACKAGE_LIB_DEV := libgps-dev
  49. PACKAGE_PY := python-gps
  50. autotools-dev-stamp:
  51. dh_testdir
  52. ifneq "$(wildcard /usr/share/misc/config.sub)" ""
  53. cp -f /usr/share/misc/config.sub config.sub
  54. endif
  55. ifneq "$(wildcard /usr/share/misc/config.guess)" ""
  56. cp -f /usr/share/misc/config.guess config.guess
  57. endif
  58. touch $@
  59. configure: config.status
  60. config.status: patch-stamp autotools-dev-stamp
  61. dh_testdir
  62. $(CONFENV) ./configure $(CONFFLAGS)
  63. build: build-gpsd build-python
  64. build-gpsd: build-gpsd-stamp
  65. build-python: build-python-stamp
  66. build-gpsd-stamp: config.status
  67. dh_testdir
  68. $(MAKE)
  69. #this is a rather ugly hack to work around broken linebreaks
  70. #from docbook
  71. sed -i 's,^.BI "void gps_set_callback(struct,.warn .BI "void gps_set_callback(struct,' libgps.3
  72. cp INSTALL TROUBLESHOOTING
  73. touch $@
  74. #unfortunately sbuild/pbilder don't support ptys
  75. #ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  76. # $(MAKE) testregress
  77. #endif
  78. build-python-stamp: build-gpsd-stamp
  79. dh_testdir
  80. $(MAKE) packet_names.h gpsfake.1 gpsprof.1
  81. set -e; \
  82. unset CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS ;\
  83. for py in $(PYVERS); do \
  84. $$py setup.py build; \
  85. done
  86. touch $@
  87. install: install-gpsd install-python
  88. install-gpsd: build-gpsd-stamp
  89. $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
  90. cp INSTALL TROUBLESHOOTING
  91. #ldconfig link
  92. dh_link -p$(PACKAGE_LIB) usr/lib/libgps.so.$(LIB_version) \
  93. usr/lib/libgps.so.$(LIB_major)
  94. dh_link -p$(PACKAGE_LIB_DEV) usr/lib/libgps.so.$(LIB_major) \
  95. usr/lib/libgps.so
  96. #the build-system creates some really weird files here
  97. #(instead of not creating a file at all)
  98. rm -f $(CURDIR)/debian/tmp/usr/share/man/man1/cgps.1 \
  99. $(CURDIR)/debian/tmp/usr/share/man/man1/cgpxlogger.1 \
  100. $(CURDIR)/debian/tmp/usr/share/man/man1/gpxlogger.1
  101. dh_installman -p$(PACKAGE_CLIENTS) xgps.1
  102. dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
  103. usr/share/man/man1/cgps.1.gz
  104. dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
  105. usr/share/man/man1/xgpsspeed.1.gz
  106. dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
  107. usr/share/man/man1/cgpxlogger.1.gz
  108. dh_link -p$(PACKAGE_CLIENTS) usr/share/man/man1/xgps.1.gz \
  109. usr/share/man/man1/gpxlogger.1.gz
  110. chmod 755 debian/gpsd.hotplug.wrapper
  111. install -d -m 755 debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults
  112. install -m 644 xgps.ad debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults/xgps
  113. install -m 644 xgpsspeed.ad debian/$(PACKAGE_CLIENTS)/etc/X11/app-defaults/xgpsspeed
  114. dh_install
  115. dh_install -p$(PACKAGE_LIB) debian/tmp/usr/lib/libgps.so.$(LIB_version)
  116. install-python: build-python-stamp
  117. set -e ;\
  118. unset CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS ;\
  119. for py in $(PYVERS); do \
  120. $$py setup.py install --root=debian/$(PACKAGE_PY); \
  121. done
  122. clean: clean-patched unpatch
  123. clean-patched:
  124. dh_testdir
  125. dh_testroot
  126. dh_clean
  127. #sanity check if debian/control lists the right package name
  128. grep -q '^Package: libgps$(LIB_major)' debian/control
  129. #update debconf po files
  130. debconf-updatepo
  131. rm -f autotools-dev-stamp
  132. rm -f build-gpsd-stamp build-python-stamp
  133. rm -f TROUBLESHOOTING
  134. [ ! -r setup.py ] || python setup.py clean
  135. rm -rf build
  136. [ ! -r Makefile ] || $(MAKE) distclean
  137. rm -f *.1 *.3 *.5 *.8 .1
  138. ifneq "$(wildcard /usr/share/misc/config.sub)" ""
  139. rm -f config.sub
  140. endif
  141. ifneq "$(wildcard /usr/share/misc/config.guess)" ""
  142. rm -f config.guess
  143. endif
  144. binary-indep:
  145. #nothing to do here.
  146. binary-arch: build install
  147. dh_testdir
  148. dh_testroot
  149. dh_installchangelogs -s
  150. dh_installdocs -s
  151. dh_installmenu -s
  152. dh_installdebconf -s
  153. dh_installinit -s
  154. dh_installexamples -s
  155. dh_pysupport -s
  156. chmod 755 debian/$(PACKAGE_PY)/usr/share/python-support/python-gps/gps.py
  157. dh_installudev -s
  158. dh_link -s
  159. dh_strip -s
  160. dh_compress -s
  161. dh_fixperms -s
  162. dh_makeshlibs -s
  163. dh_shlibdeps -s
  164. dh_gencontrol -s
  165. dh_installdeb -s
  166. dh_md5sums -s
  167. dh_builddeb -s
  168. binary: binary-indep binary-arch
  169. .PHONY: build build-gpsd build-python build-lib-static \
  170. clean clean-patched \
  171. binary-indep binary-arch binary install \
  172. install-python install-gpsd