Version 1.8.
[yaz-moved-to-github.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GPL copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # This is the debhelper compatability version to use.
9 export DH_COMPAT=1
10
11 export YAZ_WITH_SSL=1
12 CONFIG_FLAGS=--enable-static --enable-shared --enable-tcpd --prefix=/usr
13
14 # Enable parallel builds if CONCURRENCY_LEVEL is set
15 ifdef CONCURRENCY_LEVEL
16 MCFLAGS=-j$(CONCURRENCY_LEVEL)
17 else
18 MCFLAGS=
19 endif
20
21 ifeq ($(YAZ_WITH_SSL),1)
22 BUILD_SSL=1
23 SSL_FLAGS=--with-openssl
24 DEVEL_NAME=yaz-devel-ssl
25 RUNTIME_NAME=yaz-runtime-ssl
26 else
27 SSL_FLAGS=
28 DEVEL_NAME=yaz-devel
29 RUNTIME_NAME=yaz-runtime
30 endif
31
32 ifdef DEB_YAZ_USE_CVS
33 YAZSRCDIR=$(shell pwd)
34 YAZ_VERSION=$(shell date -r$(YAZSRCDIR)/CVS +"CVS%Y%m%d")
35 else
36 YAZSRCDIR=$(shell pwd)
37 YAZ_VERSION=1.8
38 endif
39
40 configure: stamp-configure
41 stamp-configure:
42 ifeq ($(BUILD_SSL),1)
43         cat debian/control.templ | sed -e "s/@YAZ_RUNTIME@/yaz-runtime-ssl/g; s/@YAZ_DEVEL@/yaz-devel-ssl/g; s/@YAZ_VERSION@/$(YAZ_VERSION)/g" > debian/control
44 else
45         cat debian/control.templ | sed -e "s/@YAZ_RUNTIME@/yaz-runtime/g; s/@YAZ_DEVEL@/yaz-devel/g; s/@YAZ_VERSION@/$(YAZ_VERSION)/g" > debian/control
46 endif
47         touch stamp-configure
48         dh_testdir
49
50         -rm -rf build
51         mkdir build
52         cd build; $(YAZSRCDIR)/configure $(CONFIG_FLAGS) $(SSL_FLAGS)
53
54 ifdef DEB_YAZ_USE_CVS
55         @echo "Now configured for using YAZ-CVS checkout with datestamp $(YAZ_VERSION)"
56 endif
57
58
59 build: stamp-build
60 stamp-build: stamp-configure
61         dh_testdir
62
63         # Add here commands to compile the package.
64         $(MAKE) -C build $(MCFLAGS)
65
66         touch stamp-build
67
68 clean:
69 ifeq ($(BUILD_SSL),1)
70         cat debian/control.templ | sed -e "s/@YAZ_RUNTIME@/yaz-runtime-ssl/g; s/@YAZ_DEVEL@/yaz-devel-ssl/g; s/@YAZ_VERSION@/$(YAZ_VERSION)/g" > debian/control
71 else
72         cat debian/control.templ | sed -e "s/@YAZ_RUNTIME@/yaz-runtime/g; s/@YAZ_DEVEL@/yaz-devel/g; s/@YAZ_VERSION@/$(YAZ_VERSION)/g" > debian/control
73 endif
74         dh_testdir
75         #dh_testroot
76         -rm -f stamp-*
77         -rm -rf build
78
79         dh_clean
80         -rm -rf debian/yaz-runtime debian/yaz-runtime-ssl debian/yaz-devel \
81                 debian/with-ssl debian/*.debhelper debian/substvars debian/shlibs.yaz-*
82
83 install: stamp-install
84 stamp-install: stamp-build
85         dh_testdir
86         dh_testroot
87         dh_clean -k -a
88         dh_installdirs -a
89
90         # Add here commands to install the package into debian/tmp.
91         -mkdirhier debian/tmp/usr
92         $(MAKE) -C build install prefix=`pwd`/debian/tmp/usr
93
94         touch stamp-install
95
96 # Build architecture-independent files here.
97 binary-indep: build install
98 # We have nothing to do by default.
99
100 # Build architecture-dependent files here.
101 binary-arch: build install
102         dh_testdir
103         dh_testroot
104         dh_movefiles -p $(DEVEL_NAME)  usr/share/aclocal usr/lib/*.a usr/include usr/bin
105         dh_movefiles -p $(RUNTIME_NAME) usr/lib usr/share/yaz
106         dh_installexamples -p $(DEVEL_NAME)
107
108         dh_installdocs -p yaz-doc doc/
109         dh_installdocs --all README TODO LICENSE CHANGELOG
110         dh_installchangelogs
111         dh_link
112         dh_strip
113         dh_compress -a
114         dh_fixperms -a
115
116 ifeq ($(BUILD_SSL),1)
117         dh_installdeb -a
118         #dh_makeshlibs -p $(RUNTIME_NAME) -V'libyaz 1 yaz-runtime-ssl' -V'libyazthread 1 yaz-runtime-ssl'
119         dh_shlibdeps -p $(RUNTIME_NAME) -- debian/$(RUNTIME_NAME)/usr/lib/*.so
120         dh_shlibdeps -p $(DEVEL_NAME) -- debian/$(DEVEL_NAME)/usr/bin/*
121         echo "libyaz 1 $(RUNTIME_NAME)" > debian/$(RUNTIME_NAME)/DEBIAN/shlibs
122         echo "libyazthread 1 $(RUNTIME_NAME)" >> debian/$(RUNTIME_NAME)/DEBIAN/shlibs
123         chmod 644 debian/$(RUNTIME_NAME)/DEBIAN/shlibs
124
125 #       dh_shlibdeps -a -- debian/yaz-runtime-ssl/usr/lib/*.so debian/yaz-runtime-ssl/usr/bin/*
126         dh_gencontrol -p $(DEVEL_NAME) -u-DDepends="$(RUNTIME_NAME)"
127         dh_gencontrol -p $(RUNTIME_NAME) -u-DConflicts=yaz-runtime
128         dh_gencontrol -a
129
130 else
131         dh_installdeb -a
132
133         #dh_makeshlibs -p $(RUNTIME_NAME) -V'libyaz 1 yaz-runtime' -V'libyazthread 1 yaz-runtime'
134         dh_makeshlibs -p $(RUNTIME_NAME) 
135         dh_shlibdeps -a
136
137         dh_gencontrol -a
138         dh_gencontrol -p $(RUNTIME_NAME) -u-DConflicts=yaz-runtime-ssl
139 endif
140         dh_md5sums -a
141         # Go kill those CVS-dirs before build
142         -find debian/tmp -type d -name CVS | xargs rm -rf
143         # For some reason it is necessary to remove empty-dirs in yaz-doc
144         -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
145                 debian/tmp/usr/share/yaz
146
147         dh_builddeb
148
149
150 binary: binary-indep binary-arch
151 .PHONY: build clean binary-indep binary-arch binary install install-stamp