Package: alljoyn-core-1504
Version: 15.04b-4
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch




In Ubuntu, the attached patch was applied to achieve the following:

  * debian/rules: Consider x32 a different "CPU", since x86 builds with the
    -m32 ABI, x86_64 with the -m64 ABI, and x32 needs the -mx32 ABI.
  * debian/patches/more-native-cpus.patch: Add x32 to allowed native arches.

Ubuntu doesn't actually ship x32, so I haven't tested this patch, but I
noticed your fix in passing when I was syncing back.

Basically, x86 has 3 ABIs:

-m32 (i386)
-m64 (amd64)
-mx32 (x32)

The last two ABIs use the same CPU (x86_64), which confuses things a bit
when selecting ABI based on CPU.

The SConscript snippets in alljoyn* define x86 as -m32 and x86_64 as -m64,
which exacerbates this issue, and led to your attempted workaround.

My patch is one (though, not the *best*, IMO) option.  Basically, what this
patch does is define a new "x32" CPU, so that compiler defaults get used
for it instead of -m32 (x86) or -m64 (x86_64).

The other option would be to clean the x86 and x86_64 targets, the same way
we do for ARM, as the compiler defaults should, in theory, be correct, and
manually setting the ABI is redundant on Debian.

Also, this patch does s/BUILD/HOST/ to your dpkg-arch variable handling, as
you got those backwards.  BUILD is the machine you're building on, HOST is
the machine you're building for (the one that will host the binaries).  Yes,
amazingly confusing, but I didn't invent the names. :P

... Adam


-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety
  APT policy: (500, 'yakkety')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-24-lowlatency (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru alljoyn-core-1504-15.04b/debian/patches/more-native-cpus.patch alljoyn-core-1504-15.04b/debian/patches/more-native-cpus.patch
--- alljoyn-core-1504-15.04b/debian/patches/more-native-cpus.patch	2016-06-13 11:09:07.000000000 -0600
+++ alljoyn-core-1504-15.04b/debian/patches/more-native-cpus.patch	2016-06-14 00:39:57.000000000 -0600
@@ -9,7 +9,7 @@
      else:
          default_target_cpu = 'x86'
 -    allowed_target_cpus = ('x86', 'x86_64', 'arm', 'openwrt')
-+    allowed_target_cpus = ('x86', 'x86_64', 'arm', 'openwrt', 's390x', 'aarch64', 'arm64', 'armhf', 'i386', 'mips', 'mipsel', 'powerpc', 'powerpc64le', 'alpha', 'hppa', 'm68k', 'mips64el', 'powerpcspe', 'powerpc64', 'sh4', 'sparc64')
++    allowed_target_cpus = ('x86', 'x86_64', 'arm', 'openwrt', 'x32', 's390x', 'aarch64', 'arm64', 'armhf', 'i386', 'mips', 'mipsel', 'powerpc', 'powerpc64le', 'alpha', 'hppa', 'm68k', 'mips64el', 'powerpcspe', 'powerpc64', 'sh4', 'sparc64')
  
      default_msvc_version = None
  
diff -Nru alljoyn-core-1504-15.04b/debian/rules alljoyn-core-1504-15.04b/debian/rules
--- alljoyn-core-1504-15.04b/debian/rules	2016-06-13 11:09:07.000000000 -0600
+++ alljoyn-core-1504-15.04b/debian/rules	2016-06-14 00:39:17.000000000 -0600
@@ -12,10 +12,10 @@
 
 # mapping all i.86 to x86 for Alljoyn
 CPU=$(shell dpkg-architecture -qDEB_HOST_GNU_CPU | sed -e 's/i.86/x86/')
-BUILDARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
-# in case of X32, we might want to set x86 as well
-ifeq ($(BUILDARCH),x32) 
-  export CPU = "x86"
+HOSTARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+# x32 is x86_64 CPU, but the ABI is different (-mx32 instead of -m64)
+ifeq ($(HOSTARCH),x32) 
+  export CPU = "x32"
 endif
 OS=linux
 

Reply via email to