about summary refs log tree commit diff
path: root/pkgs/by-name/xe
diff options
context:
space:
mode:
authortoonn2024-06-28 15:33:22 +0200
committertoonn2024-07-30 00:17:14 +0200
commit2b430b6f10da043bf4297a302c90a61a2bf8630a (patch)
treeeadeb3f4af2309cf5332eb8e6686ec9e2265e879 /pkgs/by-name/xe
parent7a14a916f856dc4acda391a9febc3bfb37f2a732 (diff)
xevd: Fix Darwin build
Diffstat (limited to 'pkgs/by-name/xe')
-rw-r--r--pkgs/by-name/xe/xevd/package.nix61
1 files changed, 53 insertions, 8 deletions
diff --git a/pkgs/by-name/xe/xevd/package.nix b/pkgs/by-name/xe/xevd/package.nix
index 64e5a70d0e7e..d5ba1995bb14 100644
--- a/pkgs/by-name/xe/xevd/package.nix
+++ b/pkgs/by-name/xe/xevd/package.nix
@@ -19,12 +19,35 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-Dc2V77t+DrZo9252FAL0eczrmikrseU02ob2RLBdVvU=";
   };
 
-  patches = lib.optionals (!lib.versionOlder "0.5.0" finalAttrs.version) [
-    (fetchpatch2 {
-      url = "https://github.com/mpeg5/xevd/commit/7eda92a6ebb622189450f7b63cfd4dcd32fd6dff.patch?full_index=1";
-      hash = "sha256-Ru7jGk1b+Id5x1zaiGb7YKZGTNaTcArZGYyHbJURfgs=";
-    })
-  ];
+  patches = lib.optionals (!lib.versionOlder "0.5.0" finalAttrs.version) (
+    builtins.map fetchpatch2 [
+      # Upstream accepted patches, should be dropped on next version bump.
+      {
+        url = "https://github.com/mpeg5/xevd/commit/7eda92a6ebb622189450f7b63cfd4dcd32fd6dff.patch?full_index=1";
+        hash = "sha256-Ru7jGk1b+Id5x1zaiGb7YKZGTNaTcArZGYyHbJURfgs=";
+      }
+      {
+        url = "https://github.com/mpeg5/xevd/commit/499bc0153a99f8c8fd00143dd81fc0d858a5b509.patch?full_index=1";
+        hash = "sha256-3ExBNTeBhj/IBweYkgWZ2ZgUypFua4oSC24XXFmjxXA=";
+      }
+      {
+        url = "https://github.com/mpeg5/xevd/commit/b099623a09c09cddfe7f732fb795b2af8a020620.patch?full_index=1";
+        hash = "sha256-Ee/PQmsGpUCU7KUMbdGEXEEKOc8BHYcGF4mq+mmWb/w=";
+      }
+      {
+        url = "https://github.com/mpeg5/xevd/commit/2e6b24bf1f946c30d789b114dfd56e91b99039fe.patch?full_index=1";
+        hash = "sha256-thT0kVSKwWruyhIjDFBulyUNeyG9zQ8rQtpZVmRvYxI=";
+      }
+      {
+        url = "https://github.com/mpeg5/xevd/commit/c1f23a41b8def84ab006a8ce4e9221b2fff84a1a.patch?full_index=1";
+        hash = "sha256-MOJ9mU5txk6ISzJsQdK+TTb2dlWD8ofGZI0nfq9rsPo=";
+      }
+      {
+        url = "https://github.com/mpeg5/xevd/commit/adf1c45d6edb0d235997a40261689d7454b711c5.patch?full_index=1";
+        hash = "sha256-tGIPaswx9S1Oy8QF928RzV/AHr710kYxXfMRYg6SLR4=";
+      }
+    ]
+  );
 
   postPatch = ''
     echo v$version > version.txt
@@ -32,6 +55,29 @@ stdenv.mkDerivation (finalAttrs: {
 
   nativeBuildInputs = [ cmake ];
 
+  cmakeFlags =
+    let
+      inherit (lib) cmakeBool cmakeFeature optional;
+      inherit (stdenv.hostPlatform) isAarch64 isDarwin;
+    in
+    optional isAarch64 (cmakeBool "ARM" true)
+    ++ optional isDarwin (cmakeFeature "CMAKE_SYSTEM_NAME" "Darwin");
+
+  env.NIX_CFLAGS_COMPILE = builtins.toString (
+    builtins.map (w: "-Wno-" + w) (
+      [
+        # Evaluate on version bump whether still necessary.
+        "sometimes-uninitialized"
+        "unknown-warning-option"
+      ]
+      ++ (
+        # Fixed upstream in 325fd9f94f3fdf0231fa931a31ebb72e63dc3498 but might
+        # change behavior, therefore opted to leave it out for now.
+        lib.optional (!lib.versionOlder "0.5.0" finalAttrs.version) "for-loop-analysis"
+      )
+    )
+  );
+
   postInstall = ''
     ln $dev/include/xevd/* $dev/include/
   '';
@@ -53,7 +99,6 @@ stdenv.mkDerivation (finalAttrs: {
     pkgConfigModules = [ "xevd" ];
     maintainers = with lib.maintainers; [ jopejoe1 ];
     platforms = lib.platforms.all;
-    # 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.
-    broken = !stdenv.hostPlatform.isx86 || !stdenv.cc.isGNU;
+    broken = stdenv.isLinux && stdenv.isAarch64;
   };
 })