summary refs log tree commit diff
path: root/pkgs/servers/foundationdb
diff options
context:
space:
mode:
authorJente Hidskes Ankarberg <jente@griffin.sh>2023-02-13 23:32:39 +0100
committerJente Hidskes Ankarberg <jente@griffin.sh>2023-03-30 16:01:18 +0200
commit73ca83e965a2036ea0a17681273c040ed4aff99a (patch)
treeafea17b25a838953f8535e0ecf78f25a9c1db0d7 /pkgs/servers/foundationdb
parent6fc2ba036ab77c647ea897b2aa26d38d540c4046 (diff)
downloadnixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar.gz
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar.bz2
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar.lz
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar.xz
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.tar.zst
nixpkgs-73ca83e965a2036ea0a17681273c040ed4aff99a.zip
foundationdb: build on aarch64-linux
Diffstat (limited to 'pkgs/servers/foundationdb')
-rw-r--r--pkgs/servers/foundationdb/cmake.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/servers/foundationdb/cmake.nix b/pkgs/servers/foundationdb/cmake.nix
index dcaa9f3e6f8..d46502601c2 100644
--- a/pkgs/servers/foundationdb/cmake.nix
+++ b/pkgs/servers/foundationdb/cmake.nix
@@ -14,6 +14,13 @@ let
 
   tests = builtins.replaceStrings [ "\n" ] [ " " ] (lib.fileContents ./test-list.txt);
 
+  # Only even numbered versions compile on aarch64; odd numbered versions have avx enabled.
+  avxEnabled = version:
+    let
+      isOdd = n: lib.trivial.mod n 2 != 0;
+      patch = lib.toInt (lib.versions.patch version);
+    in isOdd patch;
+
   makeFdb =
     { version
     , sha256
@@ -81,6 +88,8 @@ let
         env.NIX_CFLAGS_COMPILE = toString [
           # Needed with GCC 12
           "-Wno-error=missing-template-keyword"
+          # Needed to compile on aarch64
+          (lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc")
         ];
 
         inherit patches;
@@ -132,7 +141,8 @@ let
           description = "Open source, distributed, transactional key-value store";
           homepage    = "https://www.foundationdb.org";
           license     = licenses.asl20;
-          platforms   = [ "x86_64-linux" ];
+          platforms   = [ "x86_64-linux" ]
+            ++ lib.optionals (lib.versionAtLeast version "7.1.0" && !(avxEnabled version)) [ "aarch64-linux" ];
           maintainers = with maintainers; [ thoughtpolice lostnet ];
        };
     };