~indicator-network-developers/connman/flimflam.packaging

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: ubuntu.builder at gmail
  • Date: 2011-04-12 09:36:20 UTC
  • Revision ID: ubuntu.builder@gmail.com-20110412093620-n20g97rv4v5m02ql
Add flimflam packaging

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make -f
 
2
 
 
3
GIT_URL := http://git.chromium.org/git/flimflam.git
 
4
GIT_BRANCH := "master"
 
5
GIT_BRANCH_NAME := flimflam
 
6
 
 
7
DEB_SOURCE := $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //')
 
8
DEB_VERSION := $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //')
 
9
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//')
 
10
DEB_MAJOR_VERSION := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e 's/git.*//')
 
11
 
 
12
include /usr/share/cdbs/1/class/autotools.mk
 
13
include /usr/share/cdbs/1/rules/debhelper.mk
 
14
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
 
15
 
 
16
DEB_CONFIGURE_EXTRA_FLAGS += \
 
17
        --enable-udev \
 
18
        --enable-newwifi=builtin \
 
19
        --enable-ethernet=builtin \
 
20
        --enable-dhcpcd=builtin \
 
21
        --enable-modemmgr=builtin \
 
22
        --enable-ppp=builtin \
 
23
        --enable-resolvfiles=builtin \
 
24
        --enable-loopback=builtin \
 
25
        --enable-rot47=builtin \
 
26
        --enable-descbc=builtin \
 
27
        --enable-debug \
 
28
        CFLAGS="-w" \
 
29
        $(NULL)
 
30
 
 
31
DEB_DH_INSTALLINIT_ARGS = --restart-after-upgrade
 
32
 
 
33
DEB_DH_MAKESHLIBS_ARGS_ALL := -X/usr/lib/flimflam/
 
34
 
 
35
pre-build:: bootstrap-stamp
 
36
 
 
37
bootstrap-stamp:
 
38
        @echo "autotools bootstrapping ...";
 
39
        autoreconf --install
 
40
        touch $@
 
41
 
 
42
MAKE_DFSG_COMPLIANT = \
 
43
        echo "remove dfsg non-free files ..."; \
 
44
        echo "none removed";
 
45
 
 
46
GET_SOURCE = \
 
47
        set -e; \
 
48
        tmpdir=`mktemp -d -t`; \
 
49
        cd $$tmpdir; \
 
50
                echo "cloning upstream repository ..."; \
 
51
                git clone -b $(GIT_BRANCH) $(if $(LOCAL_BRANCH),$(call LOCAL_REAL_BRANCH)/$(GIT_BRANCH_NAME),$(GIT_URL)) $(GIT_BRANCH_NAME); \
 
52
                echo "getting specific upstream revision/tag: $(1)"; \
 
53
                cd `ls | head -n 1`; git checkout -b orig $(1); \
 
54
                commit_id=`git log -n1 --abbrev-commit | grep '^commit ' | sed -e 's/commit //' | sed -e 's/\.\.\.$$//'`; \
 
55
                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"`; \
 
56
                version_suffix=`echo $(DEB_UPSTREAM_VERSION) | sed -e 's/.*git\(\(\.\?[a-z0-9]*\)*\)\([+~.].*\)/\3/'`; \
 
57
                if echo $(1) | grep -q -c "orig" || echo $(DEB_VERSION) | grep -q -c "git"; \
 
58
                then \
 
59
                        upstream_version=$(DEB_MAJOR_VERSION)git.$$raw.$$commit_id$$version_suffix; \
 
60
                else \
 
61
                        upstream_version=$(DEB_UPSTREAM_VERSION); \
 
62
                fi; \
 
63
                if echo $$version_suffix | grep -q -c 'dfsg'; \
 
64
                then \
 
65
                        $(call MAKE_DFSG_COMPLIANT) \
 
66
                fi; \
 
67
                cd ..; tar --exclude=.git -czf $(CURDIR)/$(DEB_SOURCE)_$$upstream_version.orig.tar.gz `ls | head -n 1`; \
 
68
                cd $(CURDIR); rm -rf $$tmpdir; 
 
69
 
 
70
pre-build:: bootstrap-stamp
 
71
 
 
72
get-current-source:: $(if $(LOCAL_BRANCH),update-local-branch)
 
73
        set -e; if echo $(DEB_VERSION) | grep -q -c "git"; \
 
74
        then \
 
75
                git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)-.*$$/\2/g'`; \
 
76
        else \
 
77
                git_version=`echo $(DEB_UPSTREAM_VERSION) | sed -e 's/+dfsg$$//'`; \
 
78
        fi; \
 
79
        $(call GET_SOURCE, $$git_version, "current")
 
80
 
 
81
get-orig-source:: $(if $(LOCAL_BRANCH),update-local-branch)
 
82
        $(call GET_SOURCE, $(GIT_BRANCH), "orig")
 
83
 
 
84
update-local-branch::
 
85
        @echo "updating local branch ($(LOCAL_BRANCH))"
 
86
        @set -e; if ! test -d $(LOCAL_BRANCH); then mkdir -p $(LOCAL_BRANCH); fi
 
87
        @set -e; if ! test -d $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); then git clone $(GIT_URL) $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); fi
 
88
        @set -e; cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); if ! `git branch | grep -q -c "$(GIT_BRANCH)"`; then git branch $(GIT_BRANCH) remotes/origin/$(GIT_BRANCH); fi
 
89
        @set -e; cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); git pull -f
 
90
        @echo "updated local branch ($(LOCAL_BRANCH))"
 
91
 
 
92
get-snapshot-info:: $(if $(LOCAL_BRANCH),update-local-branch)
 
93
        @set -e; \
 
94
        git_version=`echo $(DEB_VERSION) | sed -e 's/^.*git\.*\([0-9t]*\)\.\(.*\)+dfsg-.*$$/\2/g'`; \
 
95
        cd $(LOCAL_BRANCH)/$(GIT_BRANCH_NAME); \
 
96
        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)"`; \
 
97
        git log -n1 $$git_version --format="%n%s%n%n  * upstream snapshot $$raw%n    + %H%n";