diff options
Diffstat (limited to 'debian/rules')
| -rwxr-xr-x | debian/rules | 142 | 
1 files changed, 142 insertions, 0 deletions
| diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..062c99d --- /dev/null +++ b/debian/rules @@ -0,0 +1,142 @@ +#!/usr/bin/make -f +#export DH_VERBOSE=1 + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) + +ifeq ($(DEB_HOST_ARCH_OS),) +  DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)) +  ifeq ($(DEB_HOST_ARCH_OS),gnu) +      DEB_HOST_ARCH_OS := hurd +  endif +endif + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) +	CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +	INSTALL_PROGRAM += -s +	INSTALL_STRIP_FLAG = "" +	STRIP = "" +endif + +VERSION = $(shell head -n1 debian/changelog | sed -e 's/.*(//;s/-.*).*//;s/\+/\-/') + +%: +	dh $@ --parallel --with autotools_dev,systemd + +override_dh_auto_configure: +	autoconf +	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ +		--prefix=/usr \ +		--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ +		--sysconfdir=/etc \ +		--localstatedir=/var \ +		--datadir=\$${prefix}/share \ +		--mandir=\$${prefix}/share/man \ +		--with-docdir=\$${prefix}/share/doc/libsane \ +		--disable-locking \ +		--enable-static \ +		--enable-pthread \ +		--with-gphoto2 \ +		--enable-translations \ +		--enable-avahi \ +		--enable-libusb_1_0 \ +		--enable-pnm-backend \ +		--without-v4l + +override_dh_auto_build: +	# generate POT file for translators +	(cd po && make sane-backends.pot) +	$(MAKE) + +override_dh_auto_clean: +	# Autoconf-generated files +	$(RM) include/byteorder.h include/_stdint.h +	# Add here commands to clean up after the build process. +	[ ! -f Makefile ] || $(MAKE) distclean +	$(RM) debian/libsane-common.install +	$(RM) debian/libsane.udev +	dh_auto_clean + +override_dh_auto_install: +	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp +	# remove /usr/lib/sane/libsane.so.1 (libtool side-effect ?) +	$(RM) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sane/libsane.so.1 +	# remove libsane-dll, same as regular libsane +	$(RM) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sane/libsane-dll.* +	# install only the manpages for the backends which have been built +	cp debian/libsane-common.install.in debian/libsane-common.install +	ls debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sane/*.so | sed -e \ +		"s#.*/lib\([^.]\+\)[.]so#usr/share/man/man5/\1.5#" | { while read mp; do \ +		test -e debian/tmp/$$mp && echo $$mp >> debian/libsane-common.install; done } +	# Empty dependency_libs in all .la files +	find debian/tmp/usr -name "*.la" -type f -exec sed -e "s,^dependency_libs=.*,dependency_libs=''," -i {} \; +	 + +override_dh_install: +	dh_install +	# Install HAL fdi file +	mkdir -p $(CURDIR)/debian/libsane-common/usr/share/hal/fdi/preprobe/10osvendor +	$(CURDIR)/tools/sane-desc -s $(CURDIR)/doc/descriptions -m hal-new > \ +	$(CURDIR)/debian/libsane-common/usr/share/hal/fdi/preprobe/10osvendor/20-libsane.fdi +	# Install the pkg-config file +	mkdir -p debian/libsane-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/ +	cp tools/sane-backends.pc debian/libsane-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/ +	# +	mkdir -p $(CURDIR)/debian//sane-utils/usr/share/man/man5/ +	cp $(CURDIR)/doc/sane-umax_pp.man $(CURDIR)/debian/sane-utils/usr/share/man/man5/umax_pp.5 + +override_dh_installdocs: +	dh_installdocs +	# move files that belong to libsane-dev +	mv debian/tmp/usr/share/doc/libsane/sane.ps debian/libsane-dev/usr/share/doc/libsane-dev/ +	mv debian/tmp/usr/share/doc/libsane/backend-writing.txt debian/libsane-dev/usr/share/doc/libsane-dev/ +	# Platform-specific documentation +	# move the html files into html/ +	install -d debian/libsane-common/usr/share/doc/libsane/html +	mv debian/tmp/usr/share/doc/libsane/*.html debian/libsane-common/usr/share/doc/libsane/html/ +	# create the /etc/sane.d/dll.d directory in libsane-common +	install -d debian/libsane-common/etc/sane.d/dll.d +	$(RM) debian/libsane-common/etc/sane.d/saned.conf +ifeq (kfreebsd,$(DEB_HOST_ARCH_OS)) +	cp README.freebsd debian/libsane-common/usr/share/doc/libsane/ +endif +ifeq (linux,$(DEB_HOST_ARCH_OS)) +	cp README.linux debian/libsane-common/usr/share/doc/libsane/ +endif +	$(RM) $(CURDIR)/debian/libsane-common/usr/share/doc/libsane/*.html +	$(RM) $(CURDIR)/debian/tmp/usr/share/doc/libsane/*.html + +override_dh_installudev: +ifeq (linux,$(DEB_HOST_ARCH_OS)) +	# udev support +	# Generate the udev rules file +	$(CURDIR)/tools/sane-desc -s $(CURDIR)/doc/descriptions -m udev+acl > $(CURDIR)/debian/libsane.udev +	dh_installudev +endif + +	# remove rpath from the binaries (wonderful tool !) +	chrpath -d debian/sane-utils/usr/sbin/saned +	chrpath -d debian/sane-utils/usr/bin/scanimage +	chrpath -d debian/sane-utils/usr/bin/sane-find-scanner + +override_dh_installinit: +	dh_installinit -psane-utils --name=saned --error-handler=saned_eh + +override_dh_systemd_enable: +	dh_systemd_enable --no-enable saned.socket + +override_dh_strip: +	dh_strip --dbg-package=libsane-dbg + +UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -n '/\(Version:\)/{s/^Version:[[:space:]]\+\([0-9]\+:\)\?\(.*\)/\2/p}' | rev | cut -d- -f 2- | rev) + +override_dh_makeshlibs: +	dh_makeshlibs -- -c0 -v$(UPSTREAM_VERSION) -Pdebian/libsane -plibsane | 
