summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Hall <tahall256@protonmail.ch>2018-08-18 19:18:32 +0100
committerTom Hall <tahall256@protonmail.ch>2018-08-18 20:45:34 +0100
commit73ac45108a2dcd4e133e0abbede1dbf154c3f14b (patch)
treeeae94ac82787a322ae983200f58e5ebd3f42e725
parent955f391e29ada1d3a0ca4b345dae7ddef64167ec (diff)
downloadnixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar.gz
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar.bz2
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar.lz
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar.xz
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.tar.zst
nixpkgs-73ac45108a2dcd4e133e0abbede1dbf154c3f14b.zip
qtcreator: enable on aarch64 and armv7
Patch (from https://bugreports.qt.io/browse/QTCREATORBUG-8107) to allow botan to build on arm.
-rw-r--r--pkgs/development/tools/qtcreator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch94
-rw-r--r--pkgs/development/tools/qtcreator/default.nix4
2 files changed, 97 insertions, 1 deletions
diff --git a/pkgs/development/tools/qtcreator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch b/pkgs/development/tools/qtcreator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch
new file mode 100644
index 00000000000..84e26871291
--- /dev/null
+++ b/pkgs/development/tools/qtcreator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch
@@ -0,0 +1,94 @@
+From c6d02dba2911d93e2379cfb5e550b93558dd51bf Mon Sep 17 00:00:00 2001
+From: Greg Nietsky <gregory@distrotech.co.za>
+Date: Tue, 4 Mar 2014 11:33:40 +0200
+Subject: [PATCH] Fix: Allow qt-creator to build on arm aarch32 and aarch64
+
+Botan is imported hardwired for x86 this small patch allows it
+too operate on arm other platforms could be added.
+
+Task-number: QTCREATORBUG-8107
+Change-Id: Iddea28f21c9fa1afd2fdd5d16a44e6c96a516a7a
+---
+ src/libs/3rdparty/botan/botan.cpp | 16 +++++++++++++++-
+ src/libs/3rdparty/botan/botan.h   |  2 ++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp
+index 917c385..4364a2e 100644
+--- a/src/libs/3rdparty/botan/botan.cpp
++++ b/src/libs/3rdparty/botan/botan.cpp
+@@ -1101,6 +1101,8 @@ class Montgomery_Exponentiator : public Modular_Exponentiator
+ 
+ #if (BOTAN_MP_WORD_BITS != 32)
+    #error The mp_x86_32 module requires that BOTAN_MP_WORD_BITS == 32
++#elif !defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
++typedef Botan::u64bit dword;
+ #endif
+ 
+ #ifdef Q_OS_UNIX
+@@ -1118,6 +1120,7 @@ extern "C" {
+ */
+ inline word word_madd2(word a, word b, word* c)
+    {
++#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
+    asm(
+       ASM("mull %[b]")
+       ASM("addl %[c],%[a]")
+@@ -1127,6 +1130,11 @@ inline word word_madd2(word a, word b, word* c)
+       : "0"(a), "1"(b), [c]"g"(*c) : "cc");
+ 
+    return a;
++#else
++   dword z = (dword)a * b + *c;
++   *c = (word)(z >> BOTAN_MP_WORD_BITS);
++   return (word)z;
++#endif
+    }
+ 
+ /*
+@@ -1134,6 +1142,7 @@ inline word word_madd2(word a, word b, word* c)
+ */
+ inline word word_madd3(word a, word b, word c, word* d)
+    {
++#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
+    asm(
+       ASM("mull %[b]")
+ 
+@@ -1147,6 +1156,11 @@ inline word word_madd3(word a, word b, word c, word* d)
+       : "0"(a), "1"(b), [c]"g"(c), [d]"g"(*d) : "cc");
+ 
+    return a;
++#else
++   dword z = (dword)a * b + c + *d;
++   *d = (word)(z >> BOTAN_MP_WORD_BITS);
++   return (word)z;
++#endif
+    }
+ 
+ }
+@@ -2315,7 +2329,7 @@ namespace Botan {
+ 
+ extern "C" {
+ 
+-#ifdef Q_OS_UNIX
++#if defined(Q_OS_UNIX) && defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
+ /*
+ * Helper Macros for x86 Assembly
+ */
+diff --git a/src/libs/3rdparty/botan/botan.h b/src/libs/3rdparty/botan/botan.h
+index 6a9cbe0..3bfdbc2 100644
+--- a/src/libs/3rdparty/botan/botan.h
++++ b/src/libs/3rdparty/botan/botan.h
+@@ -81,7 +81,9 @@
+ #endif
+ 
+ #define BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN
++#if !defined(__arm__) && !defined(__aarch64__)
+ #define BOTAN_TARGET_CPU_IS_X86_FAMILY
++#endif
+ #define BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK 1
+ 
+ #if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) || \
+-- 
+2.3.0
+
diff --git a/pkgs/development/tools/qtcreator/default.nix b/pkgs/development/tools/qtcreator/default.nix
index 38d385d1d55..24191e3a129 100644
--- a/pkgs/development/tools/qtcreator/default.nix
+++ b/pkgs/development/tools/qtcreator/default.nix
@@ -23,6 +23,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ qmake makeWrapper ];
 
+  patches = optional (stdenv.isAarch64 || stdenv.isAarch32) ./0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch;
+
   doCheck = true;
 
   enableParallelBuilding = true;
@@ -55,6 +57,6 @@ stdenv.mkDerivation rec {
     homepage = https://wiki.qt.io/Category:Tools::QtCreator;
     license = "LGPL";
     maintainers = [ maintainers.akaWolf ];
-    platforms = [ "i686-linux" "x86_64-linux" ];
+    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
   };
 }