Package: slof
Version: 20151103+dfsg-1
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu xenial ubuntu-patch

Hi Aurelien,

The slof package in Debian currently is only buildable on a powerpc host
system.  Now that cross-compilers are more generally available in Debian, it
would be useful for the package to support cross-building.  It would also be
useful for the Architecture: all package to declare its architecture
affinity, so that it can be autobuilt on Debian buildds when necessary. 
There is a proposed field for this, XS-Build-Indep-Architecture, which is
supported already in Launchpad (support status in dak/wanna-build is unknown
to me).

The attached patch adjusts the packaging of slof, so that it:

 - declares that it should be built on powerpc for autobuilding
 - can be cross-built on any system, provided the gcc-powerpc-linux-gnu
   package is installed.

I assume that you want to preserve the ability to build this package
natively on powerpc, rather than just make it always build on amd64.
Therefore, I have not added a build-dependency on gcc-powerpc-linux-gnu
because that package is only available on *not* powerpc architectures.  If
you prefer, it is certainly possible to uncomment the build-dependency and
drop the XS-Build-Indep-Architecture field instead, now that
gcc-powerpc-linux-gnu is available; this would also solve the auto-building
problem.  But unfortunately there is no solution today that will support
both native and cross autobuilding in the archive for packages of this kind.

With either of these solutions deployed, however, the Debian slof package
will be autobuildable in Launchpad (and, provided the necessary
infrastructure changes have been implemented, also in Debian), allowing us
to drop the delta for slof completely in Ubuntu.

Thanks for considering this patch!

P.S. the Debian git repository for this package appears to be about 6 months
out of date...

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru slof-20151103+dfsg/debian/control slof-20151103+dfsg/debian/control
--- slof-20151103+dfsg/debian/control	2016-01-08 17:16:49.000000000 -0800
+++ slof-20151103+dfsg/debian/control	2016-01-29 10:56:57.000000000 -0800
@@ -4,10 +4,14 @@
 Section: misc
 Priority: extra
 Build-Depends: debhelper (>= 8)
+# needed for cross-building, but no way to express this correctly together
+# with XS-Build-Indep-Architecture since we're building an Arch: all package
+## gcc-powerpc-linux-gnu
 Standards-Version: 3.9.6
 Vcs-Browser: http://anonscm.debian.org/?p=pkg-qemu/slof.git
 Vcs-Git: git://anonscm.debian.org/git/pkg-qemu/slof.git
 Homepage: https://github.com/aik/SLOF
+XS-Build-Indep-Architecture: powerpc
 
 Package: qemu-slof
 Architecture: all
diff -Nru slof-20151103+dfsg/debian/rules slof-20151103+dfsg/debian/rules
--- slof-20151103+dfsg/debian/rules	2016-01-08 16:48:52.000000000 -0800
+++ slof-20151103+dfsg/debian/rules	2016-01-29 10:31:30.000000000 -0800
@@ -1,6 +1,11 @@
 #!/usr/bin/make -f
 
 DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
+ifneq ($(DEB_BUILD_ARCH_CPU),powerpc)
+CROSS=powerpc-linux-gnu-
+else
+CROSS=
+endif
 
 %:
 	dh $@ --parallel
@@ -11,12 +16,8 @@
 	$(MAKE) -C $(CURDIR)/debian/spapr-rtas clean
 
 override_dh_auto_build-indep:
-ifneq ($(DEB_BUILD_ARCH_CPU),powerpc)
-	@echo "This package must be built on a PowerPC machine"
-	@false
-endif
-	dh_auto_build -- qemu CROSS=""
-	$(MAKE) -C $(CURDIR)/debian/spapr-rtas
+	dh_auto_build -- qemu CROSS="$(CROSS)"
+	$(MAKE) -C $(CURDIR)/debian/spapr-rtas CROSS="$(CROSS)"
 
 override_dh_auto_install-indep:
 	mkdir -p $(CURDIR)/debian/qemu-slof/usr/share/slof
diff -Nru slof-20151103+dfsg/debian/spapr-rtas/Makefile slof-20151103+dfsg/debian/spapr-rtas/Makefile
--- slof-20151103+dfsg/debian/spapr-rtas/Makefile	2016-01-08 16:48:52.000000000 -0800
+++ slof-20151103+dfsg/debian/spapr-rtas/Makefile	2016-01-08 20:42:24.000000000 -0800
@@ -1,13 +1,13 @@
 all: spapr-rtas.bin
 
 %.o: %.S
-	gcc -Wall -O2 -g -o $@ -c $<
+	$(CROSS)gcc -Wall -O2 -g -o $@ -c $<
 
 %.img: %.o
-	gcc -nostdlib -o $@ $<
+	$(CROSS)gcc -nostdlib -o $@ $<
 
 %.bin: %.img
-	objcopy -O binary -j .text $< $@
+	$(CROSS)objcopy -O binary -j .text $< $@
 
 clean:
 	rm -f *.o *.img *.bin

Reply via email to