debian get-orig-source: Build rsyncable tarball
[xz/debian.git] / debian / rules
blob97c6d41e8fcad1c1745ba7cf3276d933d248f611
1 #!/usr/bin/make -f
3 build clean install binary-arch binary-indep binary:
4 +dh --parallel $(opt_no_act) $@
6 override_dh_auto_clean:
7 dh_auto_clean --builddirectory debian/xzdec-build
8 dh_auto_clean --builddirectory debian/normal-build
9 sh debian/clean.sh
11 override_dh_auto_configure:
12 autoreconf -fis
13 dh_auto_configure --builddirectory debian/normal-build -- \
14 $(opt_optimize) $(opt_quiet) --enable-dynamic
15 dh_auto_configure --builddirectory debian/xzdec-build -- \
16 --disable-shared --disable-nls --disable-encoders \
17 --enable-small --disable-threads \
18 $(opt_optimize_small) $(opt_quiet)
20 override_dh_auto_build:
21 dh_auto_build --builddirectory debian/normal-build
22 $(MAKE) -C debian/xzdec-build/src/liblzma
23 $(MAKE) -C debian/xzdec-build/src/xzdec
24 : 'Work around bug #478524'
25 set -e; if type doxygen >/dev/null 2>/dev/null; \
26 then \
27 cd debian/normal-build; \
28 doxygen Doxyfile; \
31 override_dh_auto_test:
32 $(MAKE) -C debian/normal-build check
34 override_dh_auto_install:
35 dh_auto_install --builddirectory debian/normal-build
36 $(MAKE) -C debian/xzdec-build/src/xzdec install \
37 DESTDIR=$$(pwd)/debian/tmp
39 override_dh_installchangelogs:
40 dh_installchangelogs debian/changelog.upstream
42 opt_optimize = CFLAGS="-g -O2"
43 opt_optimize_small = CFLAGS="-g -Os"
44 opt_no_act =
45 opt_quiet =
47 # Unless noopt is set, use optimized CRC32 routine on the Hurd.
48 ifeq (hurd,$(shell dpkg-architecture -qDEB_HOST_ARCH_OS))
49 cputype := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
50 ifeq (i386,$(cputype))
51 opt_optimize += --enable-assembler=x86
52 opt_optimize_small += --enable-assembler=x86
53 endif
54 ifeq (amd64,$(cputype))
55 opt_optimize += --enable-assembler=x86_64
56 opt_optimize_small += --enable-assembler=x86_64
57 endif
58 endif
60 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
61 opt_optimize = --disable-assembler CFLAGS="-g -O0"
62 opt_optimize_small = --disable-assembler CFLAGS="-g -O0"
63 endif
65 ifneq (,$(findstring n,$(MAKEFLAGS)))
66 opt_no_act = --no-act
67 endif
69 ifneq (,$(filter quiet,$(DEB_BUILD_OPTIONS)))
70 opt_quiet = --quiet
71 MAKEFLAGS += --quiet
72 endif
74 # Build a tarball with the latest upstream version.
75 # This is made complicated by the need to choose a nice version number.
76 REPO = git://ctrl.tukaani.org/xz.git
77 BRANCH = master
78 get-orig-source:
79 mkdir debian-orig-source
80 -set -e; cd debian-orig-source; \
81 : Fetch latest upstream version.; \
82 git init -q; \
83 git fetch -q --tags $(REPO); \
84 git fetch -q $(REPO) $(BRANCH); \
85 : Determine version number.; \
86 commit_name=$$(git describe FETCH_HEAD); \
87 release=$${commit_name%%-*}; \
88 date=$$(date --utc --date="$$( \
89 git log -1 --pretty=format:%cD "$$commit_name" \
90 )" "+%Y%m%d"); \
91 if test "$$commit_name" = "$$release"; \
92 then upstream_version=$${commit_name#v}; \
93 else upstream_version="$${release#v}+$${date}"; \
94 fi; \
95 : Generate tarball.; \
96 echo "packaging $$commit_name"; \
97 git archive --format=tar "$$commit_name" \
98 --prefix="xz-utils-$$upstream_version/" | \
99 gzip -n --rsyncable -9 \
100 > "../xz-utils_$$upstream_version.orig.tar.gz"
101 rm -fr debian-orig-source