rules 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/make -f
  2. GIT_URL = git://github.com/danfruehauf/NetworkManager-ssh.git
  3. GIT_BRANCH := "master"
  4. GIT_BRANCH_NAME := network-manager-ssh
  5. ifneq (,$(LOCAL_BRANCH))
  6. LOCAL_REAL_BRANCH = $(realpath $(LOCAL_BRANCH))
  7. endif
  8. DEB_SOURCE := $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //')
  9. DEB_VERSION := $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //')
  10. DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//')
  11. DEB_MAJOR_VERSION := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e 's/git.*//')
  12. export DEB_CFLAGS_MAINT_APPEND = -Wno-deprecated-declarations
  13. DPKG_EXPORT_BUILDFLAGS = 1
  14. include /usr/share/dpkg/buildflags.mk
  15. %:
  16. dh $@ --with autoreconf
  17. override_dh_auto_configure:
  18. dh_auto_configure -- \
  19. --libexecdir=/usr/lib/NetworkManager \
  20. --disable-static \
  21. --with-gtkver=3
  22. override_dh_makeshlibs:
  23. dh_makeshlibs -X/usr/lib/NetworkManager/
  24. override_dh_auto_clean:
  25. rm -f po/*.gmo
  26. # echo "# empty file" > aclocal.m4
  27. override_dh_autoreconf:
  28. intltoolize -f -c
  29. # stuff for get-orig-source / git snapshot handling
  30. GET_SOURCE = \
  31. set -e; \
  32. tmpdir=`mktemp -d -t`; \
  33. cd $$tmpdir; \
  34. echo "cloning upstream repository ..."; \
  35. git clone $(if $(LOCAL_BRANCH),$(call LOCAL_REAL_BRANCH)/$(GIT_BRANCH_NAME),$(GIT_URL)) $(GIT_BRANCH_NAME); \
  36. echo "getting specific upstream revision/tag: $(1)"; \
  37. cd `ls | head -n 1`; git checkout -b orig $(1); \
  38. commit_id=`git log -n1 --abbrev-commit | grep '^commit ' | sed -e 's/commit //' | sed -e 's/\.\.\.$$//'`; \
  39. raw=`date --utc --date="$$(git log --pretty=fuller -n1 --date=rfc | grep CommitDate: | sed -e 's/CommitDate:[^0-9]*//')" "+%Y%m%dt%H%M%S"`; \
  40. if echo $(1) | grep -q -c "orig" || echo $(DEB_VERSION) | grep -q -c "git"; \
  41. then \
  42. upstream_version=$(DEB_MAJOR_VERSION)git.$$raw.$$commit_id; \
  43. else \
  44. upstream_version=$(DEB_UPSTREAM_VERSION); \
  45. fi; \
  46. cd ..; tar --exclude=.git -czf $(CURDIR)/$(DEB_SOURCE)_$$upstream_version.orig.tar.gz `ls | head -n 1`; \
  47. cd $(CURDIR); rm -rf $$tmpdir;
  48. get-current-source:: $(if $(LOCAL_BRANCH),update-local-branch)
  49. set -e; if echo $(DEB_VERSION) | grep -q -c "git"; \
  50. then \
  51. git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
  52. elif echo $(DEB_VERSION) | grep -q -c "rc1"; \
  53. then \
  54. git_version="0.0.4"; \
  55. else \
  56. git_version=$(DEB_UPSTREAM_VERSION); \
  57. fi; \
  58. $(call GET_SOURCE, $$git_version, "current")
  59. get-orig-source:: $(if $(LOCAL_BRANCH),update-local-branch)
  60. $(call GET_SOURCE, $(GIT_BRANCH), "orig")
  61. update-local-branch::
  62. @echo "updating local branch ($(LOCAL_BRANCH))"
  63. @set -e; if ! test -d $(LOCAL_BRANCH); then mkdir -p $(LOCAL_BRANCH); fi
  64. @set -e; if ! test -d $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); then git clone $(GIT_URL) $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); fi
  65. @set -e; cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); git pull -f
  66. @echo "updated local branch ($(LOCAL_BRANCH))"
  67. get-snapshot-info:: $(if $(LOCAL_BRANCH),update-local-branch)
  68. @set -e; \
  69. git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
  70. cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); \
  71. raw=`date --utc --date="$$(git log --pretty=fuller -n1 --date=rfc $$git_version | grep CommitDate: | sed -e 's/CommitDate:[^0-9]*//')" "+%Y-%m-%d %H:%M:%S (GMT)"`; \
  72. git log -n1 $$git_version --format="%n%s%n%n * upstream snapshot $$raw%n + %H%n";