Zebra Debian packages. Towards 1.3.2
[idzebra-moved-to-github.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Script for building Zebra from source to .deb-packages.
4 #
5 # Created by Adam Dickmeiss, based on script by
6 # Morten Hendriksen <mgh@dbc.dk>  and from Joey Hess.
7
8 # Uncomment this to turn on verbose mode.
9 #export DH_VERBOSE=1
10
11 # This is the debhelper compatability version to use.
12 export DH_COMPAT=2
13
14 CONFIG_FLAGS=--with-tclconfig=/usr/lib/tcl8.3 --prefix=/usr
15
16 # Enable parallel builds if CONCURRENCY_LEVEL is set
17 ifdef CONCURRENCY_LEVEL
18 MCFLAGS=-j$(CONCURRENCY_LEVEL)
19 else
20 MCFLAGS=
21 endif
22
23 ZEBRA_VERSION=1.3.2
24 ZEBRASRCDIR?=$(shell pwd)
25 # If this is not IndexData's release, then it is a cvs-checkout. Go cheat!
26 #   YAZ_VERSION:=$(YAZ_VERSION)-$(shell date -r$(YAZSRCDIR)/CVS +"CVS%Y%m%d")
27 export ZEBRA_VERSION
28
29 # Local library path for linking with right dependencies
30 LOCAL_LINK=-ldebian/zebra-runtime/usr/lib
31
32 $(ZEBRASRCDIR)/configure: $(ZEBRASRCDIR)/configure.in
33         cd $(ZEBRASRCDIR); sh buildconf.sh
34
35 configure: stamp-configure
36 stamp-configure: $(ZEBRASRCDIR)/configure
37         dh_testdir
38
39         -rm -rf build
40         mkdir build
41         cd build; $(ZEBRASRCDIR)/configure $(CONFIG_FLAGS)
42         touch stamp-configure
43
44 build: stamp-build
45 stamp-build: stamp-configure
46         dh_testdir
47
48         # Add here commands to compile the package.
49         $(MAKE) -C build $(MCFLAGS)
50
51         touch stamp-build
52
53 clean:
54         dh_testdir
55         #dh_testroot
56         -rm -f stamp-*
57         -rm -rf build
58
59         dh_clean
60         -rm -rf debian/zebra-runtime debian/*.debhelper debian/substvars
61
62 install: stamp-install
63 stamp-install: stamp-build
64         dh_testdir
65         dh_testroot
66         dh_clean -k -a
67         dh_installdirs -a
68
69         # Add here commands to install the package into debian/tmp.
70         -mkdirhier debian/tmp/usr
71         $(MAKE) -C build install prefix=`pwd`/debian/tmp/usr
72
73         touch stamp-install
74
75 # Build architecture-independent files here.
76 binary-indep: build install
77         dh_testdir
78         dh_testroot
79         dh_installdocs -p zebra-doc doc/
80         dh_installchangelogs -p zebra-doc
81         dh_link -p zebra-doc
82         dh_strip -p zebra-doc
83         dh_compress -p zebra-doc
84         dh_fixperms -p zebra-doc
85         dh_gencontrol -p zebra-doc
86         dh_md5sums -p zebra-doc
87
88         dh_builddeb -p zebra-doc
89
90 # Build architecture-dependent files here.
91 binary-arch: build install
92         dh_testdir
93         dh_testroot
94         dh_movefiles -p zebra-runtime usr/share/zebra usr/bin
95
96         cp LICENSE.zebra debian/copyright
97         cp CHANGELOG changelog
98         dh_installdocs --all README TODO changelog debian/copyright
99
100         dh_installchangelogs
101         dh_link
102         dh_strip
103         dh_compress -a
104         dh_fixperms -a
105
106         dh_installdeb -p zebra-runtime
107         dh_installdeb -p zebra-devel
108         dh_undocumented -p zebra-runtime zebraidx.1 zebrasrv.1
109         dh_shlibdeps -p zebra-runtime $(LOCAL_LINK) 
110
111         # Ugh Ugly hack
112         cat debian/postinst >> debian/zebra-runtime/DEBIAN/postinst
113
114         dh_gencontrol -p zebra-runtime
115         dh_md5sums -p zebra-runtime
116
117         # Go kill those CVS-dirs before build
118         -find debian/tmp -type d -name CVS | xargs rm -rf
119         # For some reason it is necessary to remove empty-dirs in zebra-doc
120         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
121                 debian/tmp/usr/share/zebra
122
123         dh_builddeb -p zebra-runtime
124
125
126 binary: binary-indep binary-arch
127 .PHONY: build clean binary-indep binary-arch binary install install-stamp configure
128
129 zebrarelease:
130         # Conveniency target for building zebra
131         dh_testdir
132         dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot