qtcreator: enable on aarch64 and armv7

Patch (from https://bugreports.qt.io/browse/QTCREATORBUG-8107) to allow botan to build on arm.

Tom Hall 73ac4510 955f391e

+97 -1
+94
pkgs/development/tools/qtcreator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch
···
··· 1 + From c6d02dba2911d93e2379cfb5e550b93558dd51bf Mon Sep 17 00:00:00 2001 2 + From: Greg Nietsky <gregory@distrotech.co.za> 3 + Date: Tue, 4 Mar 2014 11:33:40 +0200 4 + Subject: [PATCH] Fix: Allow qt-creator to build on arm aarch32 and aarch64 5 + 6 + Botan is imported hardwired for x86 this small patch allows it 7 + too operate on arm other platforms could be added. 8 + 9 + Task-number: QTCREATORBUG-8107 10 + Change-Id: Iddea28f21c9fa1afd2fdd5d16a44e6c96a516a7a 11 + --- 12 + src/libs/3rdparty/botan/botan.cpp | 16 +++++++++++++++- 13 + src/libs/3rdparty/botan/botan.h | 2 ++ 14 + 2 files changed, 17 insertions(+), 1 deletion(-) 15 + 16 + diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp 17 + index 917c385..4364a2e 100644 18 + --- a/src/libs/3rdparty/botan/botan.cpp 19 + +++ b/src/libs/3rdparty/botan/botan.cpp 20 + @@ -1101,6 +1101,8 @@ class Montgomery_Exponentiator : public Modular_Exponentiator 21 + 22 + #if (BOTAN_MP_WORD_BITS != 32) 23 + #error The mp_x86_32 module requires that BOTAN_MP_WORD_BITS == 32 24 + +#elif !defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) 25 + +typedef Botan::u64bit dword; 26 + #endif 27 + 28 + #ifdef Q_OS_UNIX 29 + @@ -1118,6 +1120,7 @@ extern "C" { 30 + */ 31 + inline word word_madd2(word a, word b, word* c) 32 + { 33 + +#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) 34 + asm( 35 + ASM("mull %[b]") 36 + ASM("addl %[c],%[a]") 37 + @@ -1127,6 +1130,11 @@ inline word word_madd2(word a, word b, word* c) 38 + : "0"(a), "1"(b), [c]"g"(*c) : "cc"); 39 + 40 + return a; 41 + +#else 42 + + dword z = (dword)a * b + *c; 43 + + *c = (word)(z >> BOTAN_MP_WORD_BITS); 44 + + return (word)z; 45 + +#endif 46 + } 47 + 48 + /* 49 + @@ -1134,6 +1142,7 @@ inline word word_madd2(word a, word b, word* c) 50 + */ 51 + inline word word_madd3(word a, word b, word c, word* d) 52 + { 53 + +#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) 54 + asm( 55 + ASM("mull %[b]") 56 + 57 + @@ -1147,6 +1156,11 @@ inline word word_madd3(word a, word b, word c, word* d) 58 + : "0"(a), "1"(b), [c]"g"(c), [d]"g"(*d) : "cc"); 59 + 60 + return a; 61 + +#else 62 + + dword z = (dword)a * b + c + *d; 63 + + *d = (word)(z >> BOTAN_MP_WORD_BITS); 64 + + return (word)z; 65 + +#endif 66 + } 67 + 68 + } 69 + @@ -2315,7 +2329,7 @@ namespace Botan { 70 + 71 + extern "C" { 72 + 73 + -#ifdef Q_OS_UNIX 74 + +#if defined(Q_OS_UNIX) && defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) 75 + /* 76 + * Helper Macros for x86 Assembly 77 + */ 78 + diff --git a/src/libs/3rdparty/botan/botan.h b/src/libs/3rdparty/botan/botan.h 79 + index 6a9cbe0..3bfdbc2 100644 80 + --- a/src/libs/3rdparty/botan/botan.h 81 + +++ b/src/libs/3rdparty/botan/botan.h 82 + @@ -81,7 +81,9 @@ 83 + #endif 84 + 85 + #define BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN 86 + +#if !defined(__arm__) && !defined(__aarch64__) 87 + #define BOTAN_TARGET_CPU_IS_X86_FAMILY 88 + +#endif 89 + #define BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK 1 90 + 91 + #if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) || \ 92 + -- 93 + 2.3.0 94 +
+3 -1
pkgs/development/tools/qtcreator/default.nix
··· 23 24 nativeBuildInputs = [ qmake makeWrapper ]; 25 26 doCheck = true; 27 28 enableParallelBuilding = true; ··· 55 homepage = https://wiki.qt.io/Category:Tools::QtCreator; 56 license = "LGPL"; 57 maintainers = [ maintainers.akaWolf ]; 58 - platforms = [ "i686-linux" "x86_64-linux" ]; 59 }; 60 }
··· 23 24 nativeBuildInputs = [ qmake makeWrapper ]; 25 26 + patches = optional (stdenv.isAarch64 || stdenv.isAarch32) ./0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch; 27 + 28 doCheck = true; 29 30 enableParallelBuilding = true; ··· 57 homepage = https://wiki.qt.io/Category:Tools::QtCreator; 58 license = "LGPL"; 59 maintainers = [ maintainers.akaWolf ]; 60 + platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ]; 61 }; 62 }