summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules24
1 files changed, 20 insertions, 4 deletions
diff --git a/debian/rules b/debian/rules
index 4d9b6e1..d798b9e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,10 +23,24 @@ endif
%:
dh $@
+ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+SANE_DESC = $(CURDIR)/tools/sane-desc
+else
+SANE_DESC = $(CURDIR)/debian/sane-desc
+endif
+
override_dh_auto_configure:
autoconf
- dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE) \
- --build=$(DEB_BUILD_GNU_TYPE) \
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+ dpkg-architecture -f "-a$(DEB_BUILD_ARCH)" -c dh_auto_configure
+ $(MAKE) -C $(CURDIR)/lib liblib.la
+ $(MAKE) -C $(CURDIR)/sanei libsanei.la
+ $(MAKE) -C $(CURDIR)/tools sane-desc
+ mv $(CURDIR)/tools/sane-desc $(CURDIR)/debian/sane-desc
+ $(RM) include/byteorder.h include/_stdint.h
+ dh_auto_clean
+endif
+ dh_auto_configure -- \
--prefix=/usr \
--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
--sysconfdir=/etc \
@@ -59,6 +73,7 @@ override_dh_auto_clean:
[ ! -f Makefile ] || $(MAKE) distclean
$(RM) debian/libsane1.udev
dh_auto_clean
+ $(RM) $(SANE_DESC)
override_dh_auto_install-arch:
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
@@ -117,8 +132,9 @@ override_dh_installudev-arch:
ifeq (linux,$(DEB_HOST_ARCH_OS))
# udev support
# Generate the udev rules file
- $(CURDIR)/tools/sane-desc -s $(CURDIR)/doc/descriptions -m udev+hwdb > $(CURDIR)/debian/libsane1.udev
- $(CURDIR)/tools/sane-desc -s $(CURDIR)/doc/descriptions -m hwdb > $(CURDIR)/debian/20-sane.hwdb
+ $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m udev+hwdb > $(CURDIR)/debian/libsane1.udev
+ $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m hwdb > $(CURDIR)/debian/20-sane.hwdb
+
cp $(CURDIR)/debian/20-sane.hwdb $(CURDIR)/debian/libsane1/lib/udev/hwdb.d/
dh_installudev
endif