Towards 1.3.42
[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=4
13
14 CONFIG_FLAGS=--with-tclconfig=/usr/lib/tcl8.3 --with-yaz=/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_installdocs -p idzebra-doc debian/tmp/usr/share/doc/idzebra/*.html debian/tmp/usr/share/doc/idzebra/*.pdf debian/tmp/usr/share/doc/idzebra/*.png
76         dh_installchangelogs -p idzebra-doc
77         dh_link -p idzebra-doc
78         dh_strip -p idzebra-doc
79         dh_compress -p idzebra-doc
80         dh_fixperms -p idzebra-doc
81         dh_gencontrol -p idzebra-doc
82         dh_md5sums -p idzebra-doc
83
84         dh_builddeb -p idzebra-doc
85
86 # Build architecture-dependent files here.
87 binary-arch: build install
88         dh_testdir
89         dh_testroot
90         dh_movefiles -p idzebra usr/share/idzebra usr/bin
91
92         cp NEWS changelog
93         dh_installdocs --all README TODO changelog debian/copyright
94
95         dh_installchangelogs
96         dh_link
97
98         dh_installdeb -p idzebra
99         #dh_installman -p idzebra doc/zebraidx.1 doc/zebrasrv.8
100         dh_installman -p idzebra debian/tmp/usr/share/man/man1/zebraidx-1.3.1 debian/tmp/usr/share/man/man8/zebrasrv-1.3.8
101
102         dh_strip
103         dh_compress -a
104         dh_fixperms -a
105
106         dh_shlibdeps -p idzebra $(LOCAL_LINK) 
107
108         dh_gencontrol -p idzebra
109         dh_md5sums -p idzebra
110
111         # Go kill those CVS-dirs before build
112         -find debian/tmp -type d -name CVS | xargs rm -rf
113         # For some reason it is necessary to remove empty-dirs in doc
114         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
115                 debian/tmp/usr/share/idzebra
116
117         dh_builddeb -p idzebra
118
119 binary: binary-indep binary-arch
120 .PHONY: build clean binary-indep binary-arch binary install install-stamp configure
121
122 zebrarelease:
123         # Conveniency target for building zebra
124         dh_testdir
125         dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot