Source: gem Version: 1:0.93.3-13 Tags: patch User: helm...@debian.org Usertags: rebootstrap
gem fails to cross build from source. I figured some aspects and present them here, but ultimately what I figured doesn't make gem cross build. Please close this bug anyway after fixing the bits reported here. The first thing to notice is that gem configures for the build architecture since it does not pass --host to ./configure. The easiest way to fix that is using dh_auto_configure. configure.patch demonstrates how to do that. While doing so, I noticed that debian/rules confuses "build" and "host". These terms are explained in man dpkg-architecture. build_host.patch fixes that up as well. Then it is still missing Pd, but this time because it cannot determine the version from running a compiled binary. That's not surprising as we cannot expect to run compiled stuff during cross compilation. Fortunately, what needs to be computed is just two integers and that can be done with AC_COMPUTE_INT even during cross compilation. Doing so actually simplifis the code as can be seen in cross.patch. And that's about the bits that I managed to fix. It somehow fails some ImageMagick stuff then, but couldn't figure that part out yet. Let's not be concerned about that here and fix the other things first. Can you take these patches? Helmut
--- gem-0.93.3/debian/rules 2018-02-01 22:58:19.000000000 +0100 +++ gem-0.93.3/debian/rules 2018-03-20 20:28:36.000000000 +0100 @@ -20,7 +20,6 @@ archconfflags := \ - --prefix=/usr \ --with-pd=/usr/include/pd \ --with-extension=pd_linux \ --enable-mmx \ @@ -55,9 +54,9 @@ override_dh_auto_configure: ifeq ($(BUILD_ARCH_CPU), ppc64el) - CXXFLAGS="$(CXXFLAGS) -m64 -mcpu=powerpc" CFLAGS="$(CFLAGS) -m64 -mcpu=powerpc" ./configure $(archconfflags) + CXXFLAGS="$(CXXFLAGS) -m64 -mcpu=powerpc" CFLAGS="$(CFLAGS) -m64 -mcpu=powerpc" dh_auto_configure -- $(archconfflags) else - CXXFLAGS="$(CXXFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(archconfflags) + CXXFLAGS="$(CXXFLAGS)" CFLAGS="$(CFLAGS)" dh_auto_configure -- $(archconfflags) endif override_dh_auto_test:
--- gem-0.93.3/debian/rules 2018-02-01 22:58:19.000000000 +0100 +++ gem-0.93.3/debian/rules 2018-03-20 20:28:36.000000000 +0100 @@ -10,7 +10,7 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk -BUILD_ARCH_CPU := $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU) +include /usr/share/dpkg/architecture.mk DATE_FMT = %Y/%m/%d at %H:%M:%S UTC ifdef SOURCE_DATE_EPOCH BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)") @@ -54,7 +53,7 @@ dh $@ override_dh_auto_configure: -ifeq ($(BUILD_ARCH_CPU), ppc64el) +ifeq ($(DEB_HOST_ARCH_CPU), ppc64el) CXXFLAGS="$(CXXFLAGS) -m64 -mcpu=powerpc" CFLAGS="$(CFLAGS) -m64 -mcpu=powerpc" ./configure $(archconfflags) else CXXFLAGS="$(CXXFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(archconfflags)
Index: gem-0.93.3/m4/gem.m4 =================================================================== --- gem-0.93.3.orig/m4/gem.m4 +++ gem-0.93.3/m4/gem.m4 @@ -424,26 +424,14 @@ if test "x$with_pdversion" != "x"; then PD_VERSION="$with_pdversion" + PD_MAJORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f1) )) + PD_MINORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f2) )) else AC_MSG_CHECKING([for Pd-version]) -cat > conftest.c << EOF -#include <stdio.h> -#include "m_pd.h" -int main(){ - printf("%d.%d\n", PD_MAJOR_VERSION, PD_MINOR_VERSION); - return 0; -} -EOF - if $CXX $CFLAGS -o conftest.o conftest.c > /dev/null 2>&1; then - PD_VERSION=`./conftest.o` - else - PD_VERSION="" - fi + AC_COMPUTE_INT([PD_MAJORVERSION],[PD_MAJOR_VERSION],[#include "m_pd.h"]) + AC_COMPUTE_INT([PD_MINORVERSION],[PD_MINOR_VERSION],[#include "m_pd.h"]) + PD_VERSION="$PD_MAJORVERSION.$PD_MINORVERSION" fi - -PD_MAJORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f1) )) -PD_MINORVERSION=$(( $(echo $PD_VERSION | cut -d"." -f2) )) - if test "$PD_MAJORVERSION" -gt 0 -o "$PD_MINORVERSION" -ge 37; then GEM_RTE_REFERENCEPATH=extra/Gem else