Dont show navig titles for TKL
[yaz-moved-to-github.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Script for building YAZ from source to .deb-packages.
4 #
5 # Created by Morten Hendriksen <mgh@dbc.dk> based on sample
6 # debhelper script from Joey Hess. GPL copyright 1997 to 1999 by 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 YAZ_WITH_SSL?=1
15 CONFIG_FLAGS=--enable-static --enable-shared --enable-tcpd --prefix=/usr
16
17 # Enable parallel builds if CONCURRENCY_LEVEL is set
18 ifdef CONCURRENCY_LEVEL
19 MCFLAGS=-j$(CONCURRENCY_LEVEL)
20 else
21 MCFLAGS=
22 endif
23
24 ifeq ($(YAZ_WITH_SSL),1)
25 export BUILD_SSL=1
26 SSL_FLAGS=--with-openssl
27 else
28 SSL_FLAGS=
29 endif
30
31 YAZ_VERSION=1.9.1
32 YAZSRCDIR?=$(shell pwd)
33 # If this is not IndexData's release, then it is a cvs-checkout. Go cheat!
34 #   YAZ_VERSION:=$(YAZ_VERSION)-$(shell date -r$(YAZSRCDIR)/CVS +"CVS%Y%m%d")
35 export YAZ_VERSION
36
37 # Local library path for linking with right dependencies
38 LOCAL_LINK=-ldebian/yaz-runtime/usr/lib:debian/yaz-ssl/usr/lib
39
40 $(YAZSRCDIR)/configure: $(YAZSRCDIR)/configure.in
41         cd $(YAZSRCDIR); sh buildconf.sh
42
43 stamp-configure: $(YAZSRCDIR)/configure
44         dh_testdir
45
46         -rm -rf build
47         mkdir build
48         cd build; $(YAZSRCDIR)/configure $(CONFIG_FLAGS) $(SSL_FLAGS)
49         touch stamp-configure
50
51 build: stamp-build
52 stamp-build: stamp-configure
53         dh_testdir
54
55         # Add here commands to compile the package.
56         $(MAKE) -C build $(MCFLAGS)
57
58         touch stamp-build
59
60 clean:
61         dh_testdir
62         #dh_testroot
63         -rm -f stamp-*
64         -rm -rf build
65
66         dh_clean
67         -rm -rf debian/yaz-runtime debian/yaz-ssl debian/yaz-devel \
68                 debian/with-ssl debian/*.debhelper debian/substvars debian/shlibs.yaz-*
69
70 install: stamp-install
71 stamp-install: stamp-build
72         dh_testdir
73         dh_testroot
74         dh_clean -k -a
75         dh_installdirs -a
76
77         # Add here commands to install the package into debian/tmp.
78         -mkdirhier debian/tmp/usr
79         $(MAKE) -C build install prefix=`pwd`/debian/tmp/usr
80
81         touch stamp-install
82
83 # Build architecture-independent files here.
84 binary-indep: build install
85         dh_testdir
86         dh_testroot
87         dh_installdocs -p yaz-doc doc/*.html doc/*.pdf doc/*.png
88         dh_installchangelogs -p yaz-doc
89         dh_link -p yaz-doc
90         dh_strip -p yaz-doc
91         dh_compress -p yaz-doc
92         dh_fixperms -p yaz-doc
93         dh_gencontrol -p yaz-doc
94         dh_md5sums -p yaz-doc
95
96         dh_builddeb -p yaz-doc
97
98 # Build architecture-dependent files here.
99 binary-arch: build install
100         dh_testdir
101         dh_testroot
102 ifeq ($(YAZ_WITH_SSL),1)
103         dh_movefiles -p yaz-ssl usr/bin/*ssl usr/lib/libyazssl* 
104 endif
105         dh_movefiles -p yaz-devel  usr/share/aclocal usr/lib/*.a usr/lib/*.la usr/lib/*.so usr/include usr/bin/yaz-config usr/bin/yaz-comp
106         dh_movefiles -p yaz-runtime usr/lib usr/share/yaz usr/bin
107         dh_installexamples -p yaz-devel
108
109         cp LICENSE debian/copyright
110         cp CHANGELOG changelog
111         dh_installdocs --all README TODO changelog debian/copyright
112
113         dh_installchangelogs
114         dh_link
115         dh_strip
116         dh_compress -a
117         dh_fixperms -a
118
119         dh_installdeb -p yaz-runtime
120         dh_installdeb -p yaz-devel
121         dh_installman -p yaz-devel doc/yaz-config.1
122         dh_undocumented -p yaz-devel yaz-comp.1
123         dh_installman -p yaz-runtime doc/yaz-client.1 doc/yaz-ztest.8 doc/yaz.7 doc/zoomsh.1
124         echo "libyaz 1 yaz-runtime" > debian/yaz-runtime/DEBIAN/shlibs
125         echo "libyazthread 1 yaz-runtime" >> debian/yaz-runtime/DEBIAN/shlibs
126         echo "libyazmalloc 1 yaz-runtime" >> debian/yaz-runtime/DEBIAN/shlibs
127         chmod 644 debian/yaz-runtime/DEBIAN/shlibs
128         dh_shlibdeps -p yaz-runtime $(LOCAL_LINK) 
129 ifeq ($(YAZ_WITH_SSL),1)
130         dh_installdeb -p yaz-ssl
131         dh_installman -p yaz-ssl doc/yaz-client-ssl.1 doc/yaz-ztest-ssl.8
132         echo "libyazssl 1 yaz-ssl" >> debian/yaz-ssl/DEBIAN/shlibs
133         chmod 644 debian/yaz-ssl/DEBIAN/shlibs
134         dh_shlibdeps -p yaz-ssl $(LOCAL_LINK)
135         cat debian/postinst >> debian/yaz-ssl/DEBIAN/postinst
136 endif
137         cat debian/postinst >> debian/yaz-runtime/DEBIAN/postinst
138
139         dh_gencontrol -p yaz-runtime
140         dh_md5sums -p yaz-runtime
141
142         dh_gencontrol -p yaz-devel
143         dh_md5sums -p yaz-devel
144
145 ifeq ($(YAZ_WITH_SSL),1)
146         dh_gencontrol -p yaz-ssl
147         dh_md5sums -p yaz-ssl
148 endif
149         # Go kill those CVS-dirs before build
150         -find debian/tmp -type d -name CVS | xargs rm -rf
151         # For some reason it is necessary to remove empty-dirs in yaz-doc
152         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
153                 debian/tmp/usr/share/yaz
154
155         dh_builddeb -p yaz-runtime
156         dh_builddeb -p yaz-devel
157 ifeq ($(YAZ_WITH_SSL),1)
158         dh_builddeb -p yaz-ssl
159 endif
160
161
162 binary: binary-indep binary-arch
163 .PHONY: build clean binary-indep binary-arch binary install install-stamp configure
164
165 yazrelease:
166         # Conveniency target for building both SSL and non-ssl versions
167         dh_testdir
168         # Non-ssl version and source
169         dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot
170         # SSL version
171         -YAZ_WITH_SSL=1 dpkg-buildpackage $(EXTRA_OPTS) -rfakeroot -B