]> git.saurik.com Git - apt.git/blame - debian/rules
Fixed string parsing, Bug #100046
[apt.git] / debian / rules
CommitLineData
2d18d44e
AL
1#!/usr/bin/make -f
2# Made with the aid of dh_make, by Craig Small
3# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4# Some lines taken from debmake, by Christoph Lameter.
9b2e67eb 5# $Id: rules,v 1.33 2001/04/29 05:49:27 jgg Exp $
0f6b2443 6
1b955876
AL
7# LD_LIBRARY_PATH=pwd/debian/apt/usr/lib dh_shlibdeps -papt
8# dpkg: /home/jgg/work/apt2/debian/apt/usr/lib/libapt-pkg.so.2.9 not found.
0f6b2443
AL
9
10# For the deb builder, you can run 'debian/rules cvs-build', which does all
11# steps nescessary to produce a proper source tarball with the CVS/ removed.
12# It builds in debian/cvs-build/apt-<VER>/, and places files in
13# debian/cvs-build/. Optionally, you can run 'debian/rules cvs-mkul' to
14# create ../upload-<VER>, with all the files needed to be uploaded placed
15# in it.
2d18d44e 16
67c035b5 17export DH_COMPAT=2
90ebe30c 18
b2e465d6
AL
19# See below
20include build/environment.mak
21
22# Default rule
23build:
24
e356ae6b 25DEB_BUILD_PROG:=debuild -us -uc
3a42cc3c
AL
26APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
27APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
28
cf6371d0
AL
29# Determine the build directory to use
30BASE=.
31ifdef BUILD
32BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
33else
34BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build
35endif
36BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
37BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
38override BLD := $(BUILDX)
39
b024fa25
AL
40ifeq ($(words $(BLD)),0)
41override BLD := ./build
42endif
43
b2e465d6 44# Rebuild configure.in to have the correct version from the change log
3a42cc3c
AL
45ifneq ($(APT_DEBVER),$(APT_CONFVER))
46.PHONY: configure.in
47configure.in:
48 sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$;mv $@.$$$$ $@
49else
50configure.in:
51endif
2d18d44e 52
b2e465d6 53# APT Programs in apt-utils
fcc0e9d6 54APT_UTILS=ftparchive sortpkgs extracttemplates
b2e465d6 55
2d18d44e
AL
56# Uncomment this to turn on verbose mode.
57#export DH_VERBOSE=1
58
d153f53f 59# Find the libapt-pkg major version for use in other control files
b2e465d6
AL
60export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
61export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
a5b7cd82
AL
62
63# Determine which package we should provide in the control files
64LIBAPTPKG_PROVIDE=libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTPKG_MAJOR)
65LIBAPTINST_PROVIDE=libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTINST_MAJOR)
66
3fb71b27 67debian/shlibs.local: apt-pkg/makefile
a5b7cd82 68 # We have 3 shlibs.local files.. One for 'apt', one for 'apt-utils' and
b2e465d6
AL
69 # one for the rest of the packages. This ensures that each package gets
70 # the right overrides..
71 rm -rf $@ $@.apt $@.apt-utils
a5b7cd82 72 echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR)" > $@.apt
b2e465d6 73
a5b7cd82
AL
74 echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@.apt-utils
75 echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR)" >> $@.apt-utils
d153f53f 76
a5b7cd82
AL
77 echo "libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTPKG_MAJOR) $(LIBAPTPKG_PROVIDE)" > $@
78 echo "libapt-inst$(GLIBC_VER)$(LIBSTDCPP_VER) $(LIBAPTINST_MAJOR) $(LIBAPTINST_PROVIDE)" >> $@
b2e465d6
AL
79
80build: build/build-stamp
81
82# Note that this is unconditionally done first as part of loading environment.mak
83# The true is needed to force make to reload environment.mak after running
84# configure-stamp. Otherwise we can get stale or invalid, or missing config data.
85build/environment.mak: build/configure-stamp
86 @true
87
88configure: configure.in
89build/configure-stamp: configure
2d18d44e 90 dh_testdir
2ee6f3cb 91 -mkdir build
9b2e67eb 92 cp COPYING debian/copyright
3a42cc3c 93 (cd build; ../configure)
b2e465d6 94 touch $@
0b5c85b5 95
b2e465d6 96build/build-stamp: build/configure-stamp
2d18d44e 97 # Add here commands to compile the package.
b2e465d6 98 $(MAKE) -s
cf58a7e1 99 touch $@
2d18d44e
AL
100
101clean:
102 dh_testdir
103# dh_testroot
3fb71b27 104 rm -f build-stamp debian/shlibs.local
2d18d44e 105 rm -rf build
b2e465d6
AL
106 rm -f debian/shlibs.local.apt debian/shlibs.local.apt-utils
107
2d18d44e
AL
108 # Add here commands to clean up after the build process.
109 -$(MAKE) clean
110 -$(MAKE) distclean
111 dh_clean
112
c64bcd92 113binary-indep: libapt-pkg-doc
2d18d44e 114# Build architecture-independent files here.
c64bcd92
AL
115libapt-pkg-doc: build debian/shlibs.local
116 dh_testdir -p$@
117 dh_testroot -p$@
118 dh_clean -p$@ -k
119 dh_installdirs -p$@
3a42cc3c
AL
120#
121# libapt-pkg-doc install
0b5c85b5
AL
122#
123 dh_installdocs -p$@ $(BLD)/docs/cache* $(BLD)/docs/design* $(BLD)/docs/dpkg-tech* \
b2e465d6
AL
124 $(BLD)/docs/files* $(BLD)/docs/method* \
125 doc/libapt-pkg2_to_3.txt doc/style.txt
0b5c85b5 126
3fa81a4a
AL
127 -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/doc/libapt-pkg-doc/.dhelp
128 -cp -a debian/libapt-pkg-doc.dhelp debian/libapt-pkg-doc/usr/share/doc/libapt-pkg-doc/.dhelp
129
c64bcd92
AL
130 dh_installexamples -p$@
131# dh_installmenu -p$@
132# dh_installinit -p$@
133# dh_installcron -p$@
82297457 134# dh_installmanpages -p$@
c64bcd92
AL
135
136# dh_undocumented -p$@
137 dh_installchangelogs -p$@
138 dh_strip -p$@
139 dh_compress -p$@
140 dh_fixperms -p$@
141# dh_suidregister -p$@
142 dh_installdeb -p$@
a5b7cd82 143 dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
c64bcd92
AL
144 dh_md5sums -p$@
145 dh_builddeb -p$@
2d18d44e 146
2d18d44e 147
3a42cc3c 148# Build architecture-dependent files here.
3a42cc3c 149
b2e465d6 150binary-arch: apt libapt-pkg-dev apt-utils
c64bcd92
AL
151apt: build debian/shlibs.local
152 dh_testdir -p$@
153 dh_testroot -p$@
154 dh_clean -p$@ -k
155 dh_installdirs -p$@
3a42cc3c
AL
156#
157# apt install
158#
1b955876 159 cp $(BLD)/bin/apt-* debian/apt/usr/bin/
2553a569 160
b2e465d6 161 # Remove the bits that are in apt-utils
1b955876 162 rm $(addprefix debian/apt/usr/bin/apt-,$(APT_UTILS))
b2e465d6 163
2553a569 164 # install the shared libs
1b955876
AL
165 find $(BLD)/bin/ -type f -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
166 find $(BLD)/bin/ -type l -name "libapt-pkg*.so.*" -exec cp -a "{}" debian/apt/usr/lib/ \;
2553a569 167
1b955876 168 cp $(BLD)/bin/methods/* debian/apt/usr/lib/apt/methods/
2d18d44e 169
1b955876 170 cp $(BLD)/scripts/dselect/* debian/apt/usr/lib/dpkg/methods/apt/
2d18d44e 171
3fa81a4a 172 # Copy the guides
b2e465d6 173 dh_installdocs -p$@ $(BLD)/docs/guide*.text $(BLD)/docs/guide*.html \
3fa81a4a 174 $(BLD)/docs/offline.text $(BLD)/docs/offline.html
fc9d4b7b 175
3fa81a4a 176 # One or the other..
1b955876
AL
177 -cp -a debian/dhelp debian/apt/usr/doc/apt/.dhelp
178 -cp -a debian/dhelp debian/apt/usr/share/doc/apt/.dhelp
396f4b08 179
2d18d44e
AL
180# head -n 500 ChangeLog > debian/ChangeLog
181
3fb71b27 182 dh_installexamples -p$@ $(BLD)/docs/examples/*
90ebe30c 183 dh_installmanpages -p$@ apt-ftparchive.1 apt-sortpkgs.1 apt-extracttemplates.1
2d18d44e 184
c64bcd92
AL
185 dh_installchangelogs -p$@
186 dh_strip -p$@
187 dh_compress -p$@
188 dh_fixperms -p$@
c64bcd92 189 dh_installdeb -p$@
1b955876
AL
190 dh_shlibdeps -papt -l`pwd`/debian/apt/usr/lib -- -Ldebian/shlibs.local.apt
191# LD_LIBRARY_PATH=`pwd`/debian/apt/usr/lib dh_shlibdeps -papt
a5b7cd82
AL
192 dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
193 dh_makeshlibs -m$(LIBAPTPKG_MAJOR) -V '$(LIBAPTPKG_PROVIDE)' -papt
c64bcd92
AL
194 dh_md5sums -p$@
195 dh_builddeb -p$@
196
197libapt-pkg-dev: build debian/shlibs.local
198 dh_testdir -p$@
199 dh_testroot -p$@
200 dh_clean -p$@ -k
201 dh_installdirs -p$@
202#
203# libapt-pkg-dev install
204#
a5b7cd82
AL
205 cp -a $(BLD)/bin/libapt-pkg*.so debian/libapt-pkg-dev/usr/lib/
206 cp -a $(BLD)/bin/libapt-inst*.so debian/libapt-pkg-dev/usr/lib/
b2e465d6 207 #ln -s libapt-pkg.so.$(LIBAPTPKG_MAJOR) debian/libapt-pkg-dev/usr/lib/libapt-pkg.so
cf6371d0 208 cp $(BLD)/include/apt-pkg/*.h debian/libapt-pkg-dev/usr/include/apt-pkg/
c64bcd92
AL
209
210 dh_installdocs -p$@
3fb71b27
AL
211# dh_installmenu -p$@
212# dh_installinit -p$@
213# dh_installcron -p$@
82297457 214# dh_installmanpages -p$@
c64bcd92
AL
215
216 dh_installchangelogs -p$@
217 dh_strip -p$@
218 dh_compress -p$@
219 dh_fixperms -p$@
220# dh_suidregister -p$@
221 dh_installdeb -p$@
a5b7cd82 222 dh_gencontrol -p$@ -u -Vlibapt-pkg:provides=$(LIBAPTPKG_PROVIDE)
b2e465d6
AL
223 dh_md5sums -p$@
224 dh_builddeb -p$@
225
226apt-utils: build debian/shlibs.local
227 dh_testdir -p$@
228 dh_testroot -p$@
229 dh_clean -p$@ -k
230 dh_installdirs -p$@
231
232 # install the shared libs
a5b7cd82
AL
233 find $(BLD)/bin/ -type f -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
234 find $(BLD)/bin/ -type l -name "libapt-inst*.so.*" -exec cp -a "{}" debian/$@/usr/lib/ \;
b2e465d6
AL
235
236 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
237 dh_installdocs -p$@
238
239 # Install the man pages..
240 mkdir -p debian/$@/usr/share/man/man1
90ebe30c
AL
241 -cp doc/apt-sortpkgs.1 doc/apt-ftparchive.1 doc/apt-extracttemplates.1 debian/$@/usr/share/man/man1/
242
b2e465d6
AL
243 dh_installchangelogs -p$@
244 dh_strip -p$@
245 dh_compress -p$@
246 dh_fixperms -p$@
247 dh_installdeb -p$@
1b955876 248 LD_LIBRARY_PATH=`pwd`/debian/apt/usr/lib:`pwd`/debian/$@/usr/lib dh_shlibdeps -p$@ -- -Ldebian/shlibs.local.apt-utils
5d622d51 249 dh_gencontrol -p$@ -u -Vlibapt-inst:provides=$(LIBAPTINST_PROVIDE)
a5b7cd82 250 dh_makeshlibs -m$(LIBAPTINST_MAJOR) -V '$(LIBAPTINST_PROVIDE)' -p$@
c64bcd92
AL
251 dh_md5sums -p$@
252 dh_builddeb -p$@
2d18d44e 253
b2e465d6 254source diff:
2d18d44e
AL
255 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
256
257# Update from CVS
258l33ch: really-clean
259 cvs update
7bf6fd0c 260 buildlib/mkChangeLog
2d18d44e
AL
261
262# Update from CVS and then configure for build
263super-l33ch: l33ch Makefile.in
264
265configure:
1d9fd7a2 266 $(MAKE) configure
2d18d44e
AL
267
268l33ch-stamp: super-l33ch
cf58a7e1 269 touch $@
2d18d44e
AL
270
271really-clean: clean
272 -find -name Makefile.in -print0 | xargs -0r rm -f
273 find -name ChangeLog | xargs rm -f
274 rm -f l33ch-stamp
275
276binary: binary-indep binary-arch
c64bcd92 277.PHONY: build clean binary-indep binary-arch binary debian/shlibs.local
3a42cc3c
AL
278
279
280# Done by the uploader.
281#cvs update..
282#edit debian/changelog
283# configure.in has the version automatically updated now.
284# edit configure.in
285# debian/rules cvs-build
286
287cvs-build:
288 rm -rf debian/cvs-build
289 cvs update
1156d969 290 #buildlib/mkChangeLog
1d9fd7a2
AL
291 $(MAKE) startup
292 $(MAKE) doc
1156d969 293 tar c --exclude CVS --exclude cvs-build . |\
3a42cc3c
AL
294 (mkdir -p debian/cvs-build/apt-$(APT_DEBVER);cd debian/cvs-build/apt-$(APT_DEBVER);tar x)
295# The next line isn't needed, as debuild will make the .tar.gz for us.
296# (cd debian/cvs-build;tar zcf apt_$(APT_DEBVER).tar.gz apt-$(APT_DEBVER))
0f6b2443 297 (cd debian/cvs-build/apt-$(APT_DEBVER);$(DEB_BUILD_PROG))
1156d969 298 #rm ChangeLog
0f6b2443
AL
299
300cvs-mkul:
301 -mkdir -p ../upload-$(APT_DEBVER)
302 cp `find debian/cvs-build -maxdepth 1 -type f` ../upload-$(APT_DEBVER)