File: rules

package info (click to toggle)
connman 0.48%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,568 kB
  • ctags: 2,951
  • sloc: ansic: 26,761; python: 923; makefile: 261; xml: 118; sh: 113
file content (98 lines) | stat: -rwxr-xr-x 3,418 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
#!/usr/bin/make -f

GIT_URL := git://git.kernel.org/pub/scm/network/connman/connman.git
GIT_BRANCH := "master"
GIT_BRANCH_NAME := connman

DEB_SOURCE := $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //')
DEB_VERSION := $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //')
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//')
DEB_MAJOR_VERSION := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e 's/git.*//')

include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk

DEB_DESTDIR = $(CURDIR)/debian/tmp/

DEB_CONFIGURE_EXTRA_FLAGS += \
		--enable-dhclient \
		--enable-ethernet \
		--enable-loopback \
		--enable-pie \
		--enable-wifi \
		--enable-hso \
		--enable-bluetooth \
		--enable-udev \
		--disable-polkit \
		--enable-client \
                $(NULL)

DEB_DH_INSTALLINIT_ARGS = --only-scripts

DEB_DH_MAKESHLIBS_ARGS_ALL := -X/usr/lib/connman/

ifneq (,$(LOCAL_BRANCH))
LOCAL_REAL_BRANCH = $(realpath $(LOCAL_BRANCH))
endif

MAKE_DFSG_COMPLIANT = \
	echo "remove dfsg non-free files ..."; \
	rm -f doc/*.txt;

GET_SOURCE = \
	set -e; \
	tmpdir=`mktemp -d -t`; \
	cd $$tmpdir; \
		echo "cloning upstream repository ..."; \
		git clone $(if $(LOCAL_BRANCH),$(call LOCAL_REAL_BRANCH)/$(GIT_BRANCH_NAME),$(GIT_URL)) $(GIT_BRANCH_NAME); \
		echo "getting specific upstream revision/tag: $(1)"; \
		cd `ls | head -n 1`; git checkout -b orig $(1); \
		commit_id=`git log -n1 --abbrev-commit | grep '^commit ' | sed -e 's/commit //' | sed -e 's/\.\.\.$$//'`; \
		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"`; \
		version_suffix=`echo $(DEB_UPSTREAM_VERSION) | sed -e 's/.*git\(\(\.\?[a-z0-9]*\)*\)\([+~.].*\)/\3/'`; \
		if echo $(1) | grep -q -c "orig" || echo $(DEB_VERSION) | grep -q -c "git"; \
		then \
			upstream_version=$(DEB_MAJOR_VERSION)git.$$raw.$$commit_id$$version_suffix; \
		else \
			upstream_version=$(DEB_UPSTREAM_VERSION); \
		fi; \
		if echo $$version_suffix | grep -q -c 'dfsg'; \
		then \
			$(call MAKE_DFSG_COMPLIANT) \
		fi; \
		cd ..; tar --exclude=.git -czf $(CURDIR)/$(DEB_SOURCE)_$$upstream_version.orig.tar.gz `ls | head -n 1`; \
		cd $(CURDIR); rm -rf $$tmpdir; 

clean::
	@echo "cleaning up autotools caches (autom4te.cache) ...";
	rm -rf autom4te.cache;

pre-build:: bootstrap-stamp

bootstrap-stamp:
	@echo "gtkdocize ...";
	gtkdocize --copy --docdir doc;
	@echo "autotools bootstrapping ...";
	./bootstrap;
	touch $@

get-current-source:: $(if $(LOCAL_BRANCH),update-local-branch)
	set -e; if echo $(DEB_VERSION) | grep -q -c "git"; \
	then \
		git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
	else \
		git_version=`echo $(DEB_UPSTREAM_VERSION) | sed -e 's/+dfsg$$//'`; \
	fi; \
	$(call GET_SOURCE, $$git_version, "current")

get-orig-source:: $(if $(LOCAL_BRANCH),update-local-branch)
	$(call GET_SOURCE, $(GIT_BRANCH), "orig")
	
update-local-branch::
	@echo "updating local branch ($(LOCAL_BRANCH))"
	@set -e; if ! test -d $(LOCAL_BRANCH); then mkdir -p $(LOCAL_BRANCH); fi
	@set -e; if ! test -d $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); then git clone $(GIT_URL) $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); fi
	@set -e; cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); git pull -f
	@echo "updated local branch ($(LOCAL_BRANCH))"