From ea2ca5e6394a6bd63c068675addc151cf13a6e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Sat, 22 Oct 2022 11:43:23 -0300 Subject: [PATCH 1/2] spirv-llvm-translator: version depends on llvm version --- .../spirv-llvm-translator/default.nix | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/spirv-llvm-translator/default.nix b/pkgs/development/compilers/spirv-llvm-translator/default.nix index ace6c773770a..a268dafbdef0 100644 --- a/pkgs/development/compilers/spirv-llvm-translator/default.nix +++ b/pkgs/development/compilers/spirv-llvm-translator/default.nix @@ -3,31 +3,40 @@ , cmake , pkg-config , lit -, llvm_11 +, llvm , spirv-headers , spirv-tools }: +let + llvmMajor = lib.versions.major llvm.version; + + branch = + if llvmMajor == "11" then { + version = "unstable-2022-05-04"; + rev = "99420daab98998a7e36858befac9c5ed109d4920"; # 265 commits ahead of v11.0.0 + hash = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg="; + } else throw "Incompatible LLVM version."; +in stdenv.mkDerivation rec { pname = "SPIRV-LLVM-Translator"; - version = "unstable-2022-05-04"; + inherit (branch) version; src = fetchFromGitHub { owner = "KhronosGroup"; repo = "SPIRV-LLVM-Translator"; - rev = "99420daab98998a7e36858befac9c5ed109d4920"; - sha256 = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg="; + inherit (branch) rev hash; }; - nativeBuildInputs = [ pkg-config cmake llvm_11.dev spirv-tools ]; + nativeBuildInputs = [ pkg-config cmake llvm.dev spirv-tools ]; - buildInputs = [ spirv-headers llvm_11 ]; + buildInputs = [ spirv-headers llvm ]; checkInputs = [ lit ]; cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=ON" - "-DLLVM_DIR=${llvm_11.dev}" + "-DLLVM_DIR=${llvm.dev}" "-DBUILD_SHARED_LIBS=YES" "-DLLVM_SPIRV_BUILD_EXTERNAL=YES" # RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/ From 40ee116f25a11632263f5dd2f824170b58daa085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Sat, 22 Oct 2022 11:46:23 -0300 Subject: [PATCH 2/2] spirv-llvm-translator_14: init at 14.0.0 --- .../compilers/spirv-llvm-translator/default.nix | 12 ++++++++++-- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/spirv-llvm-translator/default.nix b/pkgs/development/compilers/spirv-llvm-translator/default.nix index a268dafbdef0..2100c7d9070a 100644 --- a/pkgs/development/compilers/spirv-llvm-translator/default.nix +++ b/pkgs/development/compilers/spirv-llvm-translator/default.nix @@ -12,7 +12,15 @@ let llvmMajor = lib.versions.major llvm.version; branch = - if llvmMajor == "11" then { + if llvmMajor == "15" then rec { + version = "15.0.0"; + rev = "v${version}"; + hash = "sha256-111yL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg="; + } else if llvmMajor == "14" then rec{ + version = "14.0.0"; + rev = "v${version}"; + hash = "sha256-BhNAApgZ/w/92XjpoDY6ZEIhSTwgJ4D3/EfNvPmNM2o="; + } else if llvmMajor == "11" then { version = "unstable-2022-05-04"; rev = "99420daab98998a7e36858befac9c5ed109d4920"; # 265 commits ahead of v11.0.0 hash = "sha256-/vUyL6Wh8hykoGz1QmT1F7lfGDEmG4U3iqmqrJxizOg="; @@ -41,7 +49,7 @@ stdenv.mkDerivation rec { "-DLLVM_SPIRV_BUILD_EXTERNAL=YES" # RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/ "-DCMAKE_SKIP_BUILD_RPATH=ON" - ]; + ] ++ lib.optionals (llvmMajor != "11") [ "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${spirv-headers.src}" ]; # FIXME: CMake tries to run "/llvm-lit" which of course doesn't exist doCheck = false; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 791d48213915..ba857b10e94f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15134,6 +15134,8 @@ with pkgs; spirv-llvm-translator = callPackage ../development/compilers/spirv-llvm-translator { }; + spirv-llvm-translator_14 = callPackage ../development/compilers/spirv-llvm-translator { llvm = llvm_14; }; + sqldeveloper = callPackage ../development/tools/database/sqldeveloper { jdk = oraclejdk; };