dpkg (1.13.6) experimental; urgency=low
[dpkg.git] / debian / rules
blobcb9b41b01f40ee541cc5d94af89f2a1de1ec14ab
1 #!/usr/bin/make -f
2 # debian/rules for the dpkg suite.
3 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>
5 CFLAGS = -Wall -g
6 CXXFLAGS = -Wall -g
8 # Disable optimisations if ‘noopt’ found in $DEB_BUILD_OPTIONS
9 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
10 CFLAGS += -O0
11 CXXFLAGS += -O0
12 else
13 CFLAGS += -O2
14 CXXFLAGS += -O2
15 endif
17 # These are used for cross-compiling and for saving the configure script
18 # from having to guess our platform (since we know it already)
19 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
20 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
22 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
23 confflags += --build=$(DEB_HOST_GNU_TYPE)
24 else
25 confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
26 endif
29 # Create configure script if necessary, automake handles rebuilding it.
30 configure:
31 dh_testdir
33 autoreconf -v -i
35 # Configure the build tree
36 build-tree/config.status: configure
37 dh_testdir
39 install -d build-tree
40 cd build-tree && ../configure $(confflags) \
41 CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
42 --prefix=/usr \
43 --mandir=\$${datadir}/man \
44 --infodir=\$${datadir}/info \
45 --sysconfdir=/etc \
46 --localstatedir=/var/lib \
47 --with-zlib=static \
48 --with-bz2=static
50 # Build the package in build-tree
51 build: build-tree/build-stamp
52 build-tree/build-stamp: build-tree/config.status
53 dh_testdir
55 cd build-tree && $(MAKE)
56 touch $@
59 # Install the package underneath debian/tmp
60 install: build
61 dh_testdir
62 dh_testroot
63 dh_clean -k
64 dh_installdirs
66 cd build-tree && $(MAKE) DESTDIR="$(CURDIR)/debian/tmp" install
68 # Put together the dpkg and dselect packages
69 binary-arch: install
70 dh_testdir -a
71 dh_testroot -a
72 dh_install --sourcedir=debian/tmp -a
73 install -d debian/dpkg/etc/logrotate.d
74 install -m 644 debian/dpkg.logrotate debian/dpkg/etc/logrotate.d/dpkg
76 dh_installchangelogs -pdpkg ChangeLog
77 dh_installdocs -pdpkg
78 install -d debian/dselect/usr/share/doc
79 ln -s dpkg debian/dselect/usr/share/doc/dselect
81 dh_strip -a
82 dh_compress -a
83 dh_fixperms -a
84 dh_installdeb -a
85 dh_shlibdeps -a
86 dh_gencontrol -a
87 dh_md5sums -a
88 dh_builddeb -a
90 # Put together the dpkg-dev package
91 binary-indep: install
92 dh_testdir -i
93 dh_testroot -i
94 dh_install --sourcedir=debian/tmp -i
96 install -d debian/dpkg-dev/usr/share/doc
97 ln -s dpkg debian/dpkg-dev/usr/share/doc/dpkg-dev
99 dh_strip -i
100 dh_compress -i
101 dh_fixperms -i
102 dh_installdeb -i
103 dh_gencontrol -i
104 dh_md5sums -i
105 dh_builddeb -i
107 binary: binary-arch binary-indep
110 # Clean up the mess we made
111 clean:
112 dh_testdir
114 rm -rf build-tree
115 dh_clean
118 .PHONY: build install binary-arch binary-indep binary clean