Version 4.0.12
[yaz-moved-to-github.git] / debian / rules
index 4344344..a6854cf 100755 (executable)
@@ -1,97 +1,72 @@
 #!/usr/bin/make -f
+# -*- makefile -*-
 # Sample debian/rules that uses debhelper.
-# GPL copyright 1997 to 1999 by Joey Hess.
+# GNU copyright 1997 to 1999 by Joey Hess.
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-# This is the debhelper compatability version to use.
-export DH_COMPAT=1
+# Force compat level four
+export DH_COMPAT=4
 
-export YAZ_WITH_SSL=1
-CONFIG_FLAGS=--enable-static --enable-shared --enable-tcpd --prefix=/usr
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-# Enable parallel builds if CONCURRENCY_LEVEL is set
-ifdef CONCURRENCY_LEVEL
-MCFLAGS=-j$(CONCURRENCY_LEVEL)
-else
-MCFLAGS=
-endif
 
-ifeq ($(YAZ_WITH_SSL),1)
-BUILD_SSL=1
-SSL_FLAGS=--with-openssl
-DEVEL_NAME=yaz-devel-ssl
-RUNTIME_NAME=yaz-runtime-ssl
-else
-SSL_FLAGS=
-DEVEL_NAME=yaz-devel
-RUNTIME_NAME=yaz-runtime
-endif
+CFLAGS = -Wall -g
 
-ifdef DEB_YAZ_USE_CVS
-YAZSRCDIR=$(shell pwd)
-YAZ_VERSION=$(shell date -r$(YAZSRCDIR)/CVS +"CVS%Y%m%d")
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
 else
-YAZSRCDIR=$(shell pwd)
-YAZ_VERSION=1.8
+       CFLAGS += -O2
 endif
-
-configure: stamp-configure
-stamp-configure:
-ifeq ($(BUILD_SSL),1)
-       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
-else
-       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
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+       INSTALL_PROGRAM += -s
 endif
-       touch stamp-configure
-       dh_testdir
 
-       -rm -rf build
-       mkdir build
-       cd build; $(YAZSRCDIR)/configure $(CONFIG_FLAGS) $(SSL_FLAGS)
 
-ifdef DEB_YAZ_USE_CVS
-       @echo "Now configured for using YAZ-CVS checkout with datestamp $(YAZ_VERSION)"
-endif
+config.status: configure
+       dh_testdir
+       # Add here commands to configure the package.
+       CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-shared --enable-static --enable-tcpd --with-xslt --with-gnutls --with-icu
 
 
-build: stamp-build
-stamp-build: stamp-configure
+build: build-stamp
+build-stamp:  config.status
        dh_testdir
 
        # Add here commands to compile the package.
-       $(MAKE) -C build $(MCFLAGS)
+       $(MAKE)
 
-       touch stamp-build
+       touch build-stamp
 
 clean:
-ifeq ($(BUILD_SSL),1)
-       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
-else
-       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
-endif
        dh_testdir
-       #dh_testroot
-       -rm -f stamp-*
-       -rm -rf build
+       dh_testroot
+       rm -f build-stamp 
 
-       dh_clean
-       -rm -rf debian/yaz-runtime debian/yaz-runtime-ssl debian/yaz-devel \
-               debian/with-ssl debian/*.debhelper debian/substvars debian/shlibs.yaz-*
+       # Add here commands to clean up after the build process.
+       -$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+       -cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+       -cp -f /usr/share/misc/config.guess config.guess
+endif
+
+       dh_clean 
 
-install: stamp-install
-stamp-install: stamp-build
+install: build
        dh_testdir
        dh_testroot
-       dh_clean -k -a
-       dh_installdirs -a
+       dh_clean -k 
+       dh_installdirs
 
-       # Add here commands to install the package into debian/tmp.
-       -mkdirhier debian/tmp/usr
-       $(MAKE) -C build install prefix=`pwd`/debian/tmp/usr
+       # Add here commands to install the package into debian/tmp
+       $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
 
-       touch stamp-install
 
 # Build architecture-independent files here.
 binary-indep: build install
@@ -101,51 +76,34 @@ binary-indep: build install
 binary-arch: build install
        dh_testdir
        dh_testroot
-       dh_movefiles -p $(DEVEL_NAME)  usr/share/aclocal usr/lib/*.a usr/include usr/bin
-       dh_movefiles -p $(RUNTIME_NAME) usr/lib usr/share/yaz
-       dh_installexamples -p $(DEVEL_NAME)
-
-       dh_installdocs -p yaz-doc doc/
-       dh_installdocs --all README TODO LICENSE CHANGELOG
-       dh_installchangelogs
+       cp LICENSE debian/copyright
+       dh_installdocs -A README
+       dh_installchangelogs 
+       dh_installexamples
+       mv debian/tmp/usr/share/doc/yaz debian/tmp/usr/share/doc/yaz-doc
+       dh_install 
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
        dh_link
        dh_strip
-       dh_compress -a
-       dh_fixperms -a
-
-ifeq ($(BUILD_SSL),1)
-       dh_installdeb -a
-       #dh_makeshlibs -p $(RUNTIME_NAME) -V'libyaz 1 yaz-runtime-ssl' -V'libyazthread 1 yaz-runtime-ssl'
-       dh_shlibdeps -p $(RUNTIME_NAME) -- debian/$(RUNTIME_NAME)/usr/lib/*.so
-       dh_shlibdeps -p $(DEVEL_NAME) -- debian/$(DEVEL_NAME)/usr/bin/*
-       echo "libyaz 1 $(RUNTIME_NAME)" > debian/$(RUNTIME_NAME)/DEBIAN/shlibs
-       echo "libyazthread 1 $(RUNTIME_NAME)" >> debian/$(RUNTIME_NAME)/DEBIAN/shlibs
-       chmod 644 debian/$(RUNTIME_NAME)/DEBIAN/shlibs
-
-#      dh_shlibdeps -a -- debian/yaz-runtime-ssl/usr/lib/*.so debian/yaz-runtime-ssl/usr/bin/*
-       dh_gencontrol -p $(DEVEL_NAME) -u-DDepends="$(RUNTIME_NAME)"
-       dh_gencontrol -p $(RUNTIME_NAME) -u-DConflicts=yaz-runtime
-       dh_gencontrol -a
-
-else
-       dh_installdeb -a
-
-       #dh_makeshlibs -p $(RUNTIME_NAME) -V'libyaz 1 yaz-runtime' -V'libyazthread 1 yaz-runtime'
-       dh_makeshlibs -p $(RUNTIME_NAME) 
-       dh_shlibdeps -a
-
-       dh_gencontrol -a
-       dh_gencontrol -p $(RUNTIME_NAME) -u-DConflicts=yaz-runtime-ssl
-endif
-       dh_md5sums -a
-       # Go kill those CVS-dirs before build
-       -find debian/tmp -type d -name CVS | xargs rm -rf
-       # For some reason it is necessary to remove empty-dirs in yaz-doc
-       -rm -rf debian/tmp/usr/include debian/tmp/usr/share/aclocal debian/tmp/usr/lib debian/tmp/usr/bin \
-               debian/tmp/usr/share/yaz
-
+       dh_compress
+       dh_fixperms
+#      dh_perl
+#      dh_python
+       dh_makeshlibs -V 'libyaz4 (>= 4.0.12)'
+       dh_installdeb
+       dh_shlibdeps  -l debian/libyaz4/usr/lib
+       dh_gencontrol
+       dh_md5sums
        dh_builddeb
 
-
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install install-stamp
+.PHONY: build clean binary-indep binary-arch binary install