54a2bc2ad079e6dc4bb930340799a0a0635d3891
[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 --with-yazconfig=/usr/bin --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 ZEBRASRCDIR?=$(shell pwd)
24
25 # Local library path for linking with right dependencies
26 LOCAL_LINK=-ldebian/idzebra/usr/lib
27
28 $(ZEBRASRCDIR)/configure: $(ZEBRASRCDIR)/configure.in
29         cd $(ZEBRASRCDIR); sh buildconf.sh
30
31 stamp-configure: $(ZEBRASRCDIR)/configure
32         dh_testdir
33
34         -rm -rf build
35         mkdir build
36         cd build; $(ZEBRASRCDIR)/configure $(CONFIG_FLAGS)
37         touch stamp-configure
38
39 build: stamp-build
40 stamp-build: stamp-configure
41         dh_testdir
42
43         # Add here commands to compile the package.
44         $(MAKE) -C build $(MCFLAGS)
45
46         touch stamp-build
47
48 clean:
49         dh_testdir
50         #dh_testroot
51         -rm -f stamp-*
52         -rm -rf build
53
54         dh_clean
55         -rm -rf debian/idzebra debian/*.debhelper debian/substvars
56
57 install: stamp-install
58 stamp-install: stamp-build
59         dh_testdir
60         dh_testroot
61         dh_clean -k -a
62         dh_installdirs -a
63
64         # Add here commands to install the package into debian/tmp.
65         -mkdirhier debian/tmp/usr
66         $(MAKE) -C build install prefix=`pwd`/debian/tmp/usr
67
68         touch stamp-install
69
70 # Build architecture-independent files here.
71 binary-indep: build install
72         dh_testdir
73         dh_testroot
74         dh_installdocs -p idzebra-doc doc/*.html doc/*.pdf doc/*.png
75         dh_installchangelogs -p idzebra-doc
76         dh_link -p idzebra-doc
77         dh_strip -p idzebra-doc
78         dh_compress -p idzebra-doc
79         dh_fixperms -p idzebra-doc
80         dh_gencontrol -p idzebra-doc
81         dh_md5sums -p idzebra-doc
82
83         dh_builddeb -p idzebra-doc
84
85 # Build architecture-dependent files here.
86 binary-arch: build install
87         dh_testdir
88         dh_testroot
89         dh_movefiles -p idzebra usr/share/idzebra usr/bin
90
91         cp CHANGELOG changelog
92         dh_installdocs --all README TODO changelog debian/copyright
93
94         dh_installchangelogs
95         dh_link
96
97         dh_installdeb -p idzebra
98         dh_installman -p idzebra doc/zebraidx.1 doc/zebrasrv.8
99
100         dh_strip
101         dh_compress -a
102         dh_fixperms -a
103
104         dh_shlibdeps -p idzebra $(LOCAL_LINK) 
105
106         cat debian/postinst >> debian/idzebra/DEBIAN/postinst
107         chmod +x debian/idzebra/DEBIAN/postinst
108
109         dh_gencontrol -p idzebra
110         dh_md5sums -p idzebra
111
112         # Go kill those CVS-dirs before build
113         -find debian/tmp -type d -name CVS | xargs rm -rf
114         # For some reason it is necessary to remove empty-dirs in doc
115         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
116                 debian/tmp/usr/share/idzebra
117
118         dh_builddeb -p idzebra
119
120 binary: binary-indep binary-arch
121 .PHONY: build clean binary-indep binary-arch binary install install-stamp configure
122
123 zebrarelease:
124         # Conveniency target for building zebra
125         dh_testdir
126         dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot