xeve: Fix Darwin build

toonn d95b9673 2b430b6f

+113 -8
+27
pkgs/by-name/xe/xeve/0001-CMakeLists.txt-Disable-static-linking-on-Darwin.patch
···
··· 1 + From f3927c3cb05ffc77f62026bafd7cea1d25de1e72 Mon Sep 17 00:00:00 2001 2 + From: toonn <toonn@toonn.io> 3 + Date: Tue, 2 Jul 2024 19:23:11 +0200 4 + Subject: [PATCH 1/2] CMakeLists.txt: Disable static linking on Darwin 5 + 6 + --- 7 + CMakeLists.txt | 4 +++- 8 + 1 file changed, 3 insertions(+), 1 deletion(-) 9 + 10 + diff --git a/CMakeLists.txt b/CMakeLists.txt 11 + index e0873d5..1d639c4 100644 12 + --- a/CMakeLists.txt 13 + +++ b/CMakeLists.txt 14 + @@ -64,7 +64,9 @@ if(NOT ARM) 15 + else() 16 + add_definitions(-DARM=1) 17 + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flax-vector-conversions") 18 + - set(CMAKE_EXE_LINKER_FLAGS "-static") 19 + + if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") 20 + + set(CMAKE_EXE_LINKER_FLAGS "-static") 21 + + endif() 22 + endif() 23 + message("ARM=${ARM}") 24 + 25 + -- 26 + 2.44.1 27 +
+27
pkgs/by-name/xe/xeve/0002-sse2neon-Cast-to-variable-type.patch
···
··· 1 + From d1a480867c0778ee46ff0213e2b1e494afcb67fc Mon Sep 17 00:00:00 2001 2 + From: toonn <toonn@toonn.io> 3 + Date: Mon, 1 Jul 2024 15:19:37 +0200 4 + Subject: [PATCH 2/2] sse2neon: Cast to variable type 5 + 6 + The `__m128d` type corresponds to `float32x4_t` or `float64x2_t` 7 + depending on the platform. The cast cannot explicitly use either type. 8 + --- 9 + src_base/neon/sse2neon.h | 2 +- 10 + 1 file changed, 1 insertion(+), 1 deletion(-) 11 + 12 + diff --git a/src_base/neon/sse2neon.h b/src_base/neon/sse2neon.h 13 + index 490c0a4..3290fa3 100644 14 + --- a/src_base/neon/sse2neon.h 15 + +++ b/src_base/neon/sse2neon.h 16 + @@ -6003,7 +6003,7 @@ FORCE_INLINE void _mm_storeu_si32(void *p, __m128i a) 17 + FORCE_INLINE void _mm_stream_pd(double *p, __m128d a) 18 + { 19 + #if __has_builtin(__builtin_nontemporal_store) 20 + - __builtin_nontemporal_store(a, (float32x4_t *) p); 21 + + __builtin_nontemporal_store(a, (__m128d *) p); 22 + #elif defined(__aarch64__) 23 + vst1q_f64(p, vreinterpretq_f64_m128d(a)); 24 + #else 25 + -- 26 + 2.44.1 27 +
+59 -8
pkgs/by-name/xe/xeve/package.nix
··· 18 hash = "sha256-8jXntm/yFme9ZPImdW54jAr11hEsU1K+N5/7RLmITPs="; 19 }; 20 21 - patches = lib.optionals (!lib.versionOlder "0.5.0" finalAttrs.version) [ 22 - (fetchpatch2 { 23 - url = "https://github.com/mpeg5/xeve/commit/954ed6e0494cd2438fd15c717c0146e88e582b33.patch?full_index=1"; 24 - hash = "sha256-//NtOUm1fqPFvOM955N6gF+QgmOdmuVunwx/3s/G/J8="; 25 - }) 26 - ]; 27 28 postPatch = '' 29 echo v$version > version.txt ··· 31 32 nativeBuildInputs = [ cmake ]; 33 34 postInstall = '' 35 ln $dev/include/xeve/* $dev/include/ 36 ''; ··· 50 mainProgram = "xeve_app"; 51 maintainers = with lib.maintainers; [ jopejoe1 ]; 52 platforms = lib.platforms.all; 53 - # Currently only supports gcc and msvc as compiler, the limitation for clang gets removed in the next release, but that does not fix building on darwin. 54 - broken = !stdenv.hostPlatform.isx86 || !stdenv.cc.isGNU; 55 }; 56 })
··· 18 hash = "sha256-8jXntm/yFme9ZPImdW54jAr11hEsU1K+N5/7RLmITPs="; 19 }; 20 21 + patches = 22 + lib.optionals (!lib.versionOlder "0.5.0" finalAttrs.version) ( 23 + builtins.map fetchpatch2 [ 24 + { 25 + url = "https://github.com/mpeg5/xeve/commit/954ed6e0494cd2438fd15c717c0146e88e582b33.patch?full_index=1"; 26 + hash = "sha256-//NtOUm1fqPFvOM955N6gF+QgmOdmuVunwx/3s/G/J8="; 27 + } 28 + { 29 + url = "https://github.com/mpeg5/xeve/commit/07a6f2a6d13dfaa0f73c3752f8cd802c251d8252.patch?full_index=1"; 30 + hash = "sha256-P9J7Y9O/lb/MSa5oCfft7z764AbLBLZnMmrmPEZPcws="; 31 + } 32 + { 33 + url = "https://github.com/mpeg5/xeve/commit/0a0f3bd397161253b606bdbeaa518fbe019d24e1.patch?full_index=1"; 34 + hash = "sha256-PoZpE64gWkTUS4Q+SK+DH1I1Ac0UEzwwnlvpYN16hsI="; 35 + } 36 + { 37 + url = "https://github.com/mpeg5/xeve/commit/e029f1619ecedbda152b8680641fa10eea9eeace.patch?full_index=1"; 38 + hash = "sha256-ooIBzNtGSjDgYvTzA8T0KB+QzsUiy14mPpoRqrHF3Pg="; 39 + } 40 + ] 41 + ++ [ 42 + # Backport to 0.5.0 of upstream patch c564ac77c103dbba472df3e13f4733691fd499ed 43 + ./0001-CMakeLists.txt-Disable-static-linking-on-Darwin.patch 44 + ] 45 + ) 46 + ++ [ 47 + # Rejected upstream, can be dropped when a fix for 48 + # https://github.com/mpeg5/xeve/pull/123 is in a version bump. 49 + ./0002-sse2neon-Cast-to-variable-type.patch 50 + ]; 51 52 postPatch = '' 53 echo v$version > version.txt ··· 55 56 nativeBuildInputs = [ cmake ]; 57 58 + cmakeFlags = 59 + let 60 + inherit (lib) cmakeBool cmakeFeature optional; 61 + inherit (stdenv.hostPlatform) isAarch64 isDarwin; 62 + in 63 + optional isAarch64 (cmakeBool "ARM" true) 64 + ++ optional isDarwin (cmakeFeature "CMAKE_SYSTEM_NAME" "Darwin"); 65 + 66 + env.NIX_CFLAGS_COMPILE = builtins.toString ( 67 + builtins.map (w: "-Wno-" + w) ( 68 + [ 69 + # Patch addressing an if without a body was rejected upstream, third 70 + # line-based comment in this thread, https://github.com/mpeg5/xeve/pull/122#pullrequestreview-2187744305 71 + # Evaluate on version bump whether still necessary. 72 + "empty-body" 73 + 74 + # Evaluate on version bump whether still necessary. 75 + "parentheses-equality" 76 + "unknown-warning-option" 77 + ] 78 + ++ ( 79 + # Fixed upstream in 325fd9f94f3fdf0231fa931a31ebb72e63dc3498 but might 80 + # change behavior, therefore opted to leave it out for now. 81 + lib.optional (!lib.versionOlder "0.5.0" finalAttrs.version) "for-loop-analysis" 82 + ) 83 + ) 84 + ); 85 + 86 postInstall = '' 87 ln $dev/include/xeve/* $dev/include/ 88 ''; ··· 102 mainProgram = "xeve_app"; 103 maintainers = with lib.maintainers; [ jopejoe1 ]; 104 platforms = lib.platforms.all; 105 + broken = stdenv.isLinux && stdenv.isAarch64; 106 }; 107 })