rules 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. dh_autoreconf
  30. # stuff for get-orig-source / git snapshot handling
  31. GET_SOURCE = \
  32. set -e; \
  33. tmpdir=`mktemp -d -t`; \
  34. cd $$tmpdir; \
  35. echo "cloning upstream repository ..."; \
  36. git clone $(if $(LOCAL_BRANCH),$(call LOCAL_REAL_BRANCH)/$(GIT_BRANCH_NAME),$(GIT_URL)) $(GIT_BRANCH_NAME); \
  37. echo "getting specific upstream revision/tag: $(1)"; \
  38. cd `ls | head -n 1`; git checkout -b orig $(1); \
  39. commit_id=`git log -n1 --abbrev-commit | grep '^commit ' | sed -e 's/commit //' | sed -e 's/\.\.\.$$//'`; \
  40. 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"`; \
  41. if echo $(1) | grep -q -c "orig" || echo $(DEB_VERSION) | grep -q -c "git"; \
  42. then \
  43. upstream_version=$(DEB_MAJOR_VERSION)git.$$raw.$$commit_id; \
  44. else \
  45. upstream_version=$(DEB_UPSTREAM_VERSION); \
  46. fi; \
  47. cd ..; tar --exclude=.git -czf $(CURDIR)/$(DEB_SOURCE)_$$upstream_version.orig.tar.gz `ls | head -n 1`; \
  48. cd $(CURDIR); rm -rf $$tmpdir;
  49. get-current-source:: $(if $(LOCAL_BRANCH),update-local-branch)
  50. set -e; if echo $(DEB_VERSION) | grep -q -c "git"; \
  51. then \
  52. git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
  53. elif echo $(DEB_VERSION) | grep -q -c "rc1"; \
  54. then \
  55. git_version="0.0.4"; \
  56. else \
  57. git_version=$(DEB_UPSTREAM_VERSION); \
  58. fi; \
  59. $(call GET_SOURCE, $$git_version, "current")
  60. get-orig-source:: $(if $(LOCAL_BRANCH),update-local-branch)
  61. $(call GET_SOURCE, $(GIT_BRANCH), "orig")
  62. update-local-branch::
  63. @echo "updating local branch ($(LOCAL_BRANCH))"
  64. @set -e; if ! test -d $(LOCAL_BRANCH); then mkdir -p $(LOCAL_BRANCH); fi
  65. @set -e; if ! test -d $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); then git clone $(GIT_URL) $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); fi
  66. @set -e; cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); git pull -f
  67. @echo "updated local branch ($(LOCAL_BRANCH))"
  68. get-snapshot-info:: $(if $(LOCAL_BRANCH),update-local-branch)
  69. @set -e; \
  70. git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
  71. cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); \
  72. 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)"`; \
  73. git log -n1 $$git_version --format="%n%s%n%n * upstream snapshot $$raw%n + %H%n";