Source: torch3
Version: 3.1-2.2
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

torch3 fails to cross build from source, because it builds for the build
architecture. The packaging fails to pass a cross compiler to make. The
easiest way to fix that is using dh_auto_build. The upstream build
system is dependent on the kernel and detects it from uname. Thus we
need to pass OS into the build. The attached patch fixes both aspects.
Please consider applying it.

Helmut
diff -u torch3-3.1/debian/changelog torch3-3.1/debian/changelog
--- torch3-3.1/debian/changelog
+++ torch3-3.1/debian/changelog
@@ -1,3 +1,12 @@
+torch3 (3.1-2.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS:
+    + Let dh_auto_build pass cross compilers to make.
+    + Pass OS to make.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 14 Feb 2018 12:28:11 +0100
+
 torch3 (3.1-2.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -u torch3-3.1/debian/rules torch3-3.1/debian/rules
--- torch3-3.1/debian/rules
+++ torch3-3.1/debian/rules
@@ -5,6 +5,7 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/dpkg/architecture.mk
 
 CFLAGS = -Wall -g
 
@@ -17,6 +18,11 @@
        INSTALL_PROGRAM += -s
 endif
 
+OSMAP_linux = Linux
+OSMAP_kfreebsd = GNU_kFreeBSD
+OSMAP_hurd = GNU
+OS=$(OSMAP_$(DEB_HOST_ARCH_OS))
+
 package=libtorch3c2
 devpackage=libtorch3-dev
 
@@ -49,8 +55,8 @@
        dh_testdir
 
        # Add here commands to compile the package.
-       $(MAKE) depend PACKAGES="$(PACKAGES)"
-       $(MAKE) PACKAGES="$(PACKAGES)" 
+       dh_auto_build -- depend PACKAGES="$(PACKAGES)" OS="$(OS)"
+       dh_auto_build PACKAGES="$(PACKAGES)"
        #LIBTORCH="$(CURDIR)/lib/libtorch.a"
 
        touch build-stamp

Reply via email to