Make proper copyright file for Debian
[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 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/idzebra/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/idzebra 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 idzebra-doc doc/
80         dh_installchangelogs -p idzebra-doc
81         dh_link -p idzebra-doc
82         dh_strip -p idzebra-doc
83         dh_compress -p idzebra-doc
84         dh_fixperms -p idzebra-doc
85         dh_gencontrol -p idzebra-doc
86         dh_md5sums -p idzebra-doc
87
88         dh_builddeb -p idzebra-doc
89
90 # Build architecture-dependent files here.
91 binary-arch: build install
92         dh_testdir
93         dh_testroot
94         dh_movefiles -p idzebra usr/share/idzebra usr/bin
95
96         cp CHANGELOG changelog
97         dh_installdocs --all README TODO changelog debian/copyright
98
99         dh_installchangelogs
100         dh_link
101         dh_strip
102         dh_compress -a
103         dh_fixperms -a
104
105         dh_installdeb -p idzebra
106         dh_undocumented -p idzebra zebraidx.1 zebrasrv.1
107         dh_shlibdeps -p idzebra $(LOCAL_LINK) 
108
109         # Ugh Ugly hack
110         cat debian/postinst >> debian/idzebra/DEBIAN/postinst
111
112         dh_gencontrol -p idzebra
113         dh_md5sums -p idzebra
114
115         # Go kill those CVS-dirs before build
116         -find debian/tmp -type d -name CVS | xargs rm -rf
117         # For some reason it is necessary to remove empty-dirs in doc
118         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
119                 debian/tmp/usr/share/idzebra
120
121         dh_builddeb -p idzebra
122
123
124 binary: binary-indep binary-arch
125 .PHONY: build clean binary-indep binary-arch binary install install-stamp configure
126
127 zebrarelease:
128         # Conveniency target for building zebra
129         dh_testdir
130         dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot