about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/opencl-clang
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
commit99fcaeccb89621dd492203ce1f2d551c06f228ed (patch)
tree41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/libraries/opencl-clang
parent59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff)
parent75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff)
downloadnixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/config/console.nix
	nixpkgs/nixos/modules/services/mail/mailman.nix
	nixpkgs/nixos/modules/services/mail/public-inbox.nix
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/default.nix
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/interpreters/python/default.nix
	nixpkgs/pkgs/development/node-packages/overrides.nix
	nixpkgs/pkgs/development/tools/b4/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix
	nixpkgs/pkgs/servers/mail/public-inbox/default.nix
	nixpkgs/pkgs/tools/security/pinentry/default.nix
	nixpkgs/pkgs/tools/text/unoconv/default.nix
	nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/opencl-clang')
-rw-r--r--nixpkgs/pkgs/development/libraries/opencl-clang/default.nix44
1 files changed, 18 insertions, 26 deletions
diff --git a/nixpkgs/pkgs/development/libraries/opencl-clang/default.nix b/nixpkgs/pkgs/development/libraries/opencl-clang/default.nix
index f4897331c938..58307198f727 100644
--- a/nixpkgs/pkgs/development/libraries/opencl-clang/default.nix
+++ b/nixpkgs/pkgs/development/libraries/opencl-clang/default.nix
@@ -4,10 +4,8 @@
 , fetchpatch
 , cmake
 , git
-
 , llvmPackages_11
 , spirv-llvm-translator
-
 , buildWithPatches ? true
 }:
 
@@ -16,32 +14,25 @@ let
     inherit spirv-llvm-translator;
   };
 
-  inherit (lib) getVersion;
-
-  addPatches = component: pkg:
-    with builtins; with lib;
-    let path = "${passthru.patchesOut}/${component}";
-    in pkg.overrideAttrs (super: {
-      postPatch = (if super ? postPatch then super.postPatch + "\n" else "") + ''
-        for p in ${path}/*
-        do
-          patch -p1 -i "$p"
-        done
-      '';
-    });
+  addPatches = component: pkg: pkg.overrideAttrs (oldAttrs: {
+    postPatch = oldAttrs.postPatch or "" + ''
+      for p in ${passthru.patchesOut}/${component}/*; do
+        patch -p1 -i "$p"
+      done
+    '';
+  });
 
   passthru = rec {
-    spirv-llvm-translator = llvmPkgs.spirv-llvm-translator;
+    spirv-llvm-translator = llvmPkgs.spirv-llvm-translator.override { llvm = llvmPackages_11.llvm; };
     llvm = addPatches "llvm" llvmPkgs.llvm;
     libclang = addPatches "clang" llvmPkgs.libclang;
 
     clang-unwrapped = libclang.out;
-
     clang = llvmPkgs.clang.override {
       cc = clang-unwrapped;
     };
 
-    patchesOut = stdenv.mkDerivation rec {
+    patchesOut = stdenv.mkDerivation {
       pname = "opencl-clang-patches";
       inherit (library) version src patches;
       # Clang patches assume the root is the llvm root dir
@@ -62,14 +53,13 @@ let
   };
 
   library = let
-    inherit (llvmPkgs) llvm;
+    inherit (llvmPackages_11) llvm;
     inherit (if buildWithPatches then passthru else llvmPkgs) libclang spirv-llvm-translator;
   in
-    stdenv.mkDerivation rec {
+    stdenv.mkDerivation {
       pname = "opencl-clang";
       version = "unstable-2022-03-16";
 
-      inherit passthru;
 
       src = fetchFromGitHub {
         owner = "intel";
@@ -79,8 +69,8 @@ let
       };
 
       patches = [
-      # Build script tries to find Clang OpenCL headers under ${llvm}
-      # Work around it by specifying that directory manually.
+        # Build script tries to find Clang OpenCL headers under ${llvm}
+        # Work around it by specifying that directory manually.
         ./opencl-headers-dir.patch
       ];
 
@@ -96,19 +86,21 @@ let
       buildInputs = [ libclang llvm spirv-llvm-translator ];
 
       cmakeFlags = [
-        "-DPREFERRED_LLVM_VERSION=${getVersion llvm}"
-        "-DOPENCL_HEADERS_DIR=${libclang.lib}/lib/clang/${getVersion libclang}/include/"
+        "-DPREFERRED_LLVM_VERSION=${lib.getVersion llvm}"
+        "-DOPENCL_HEADERS_DIR=${libclang.lib}/lib/clang/${lib.getVersion libclang}/include/"
 
         "-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF"
         "-DSPIRV_TRANSLATOR_DIR=${spirv-llvm-translator}"
       ];
 
+      inherit passthru;
+
       meta = with lib; {
         homepage    = "https://github.com/intel/opencl-clang/";
         description = "A clang wrapper library with an OpenCL-oriented API and the ability to compile OpenCL C kernels to SPIR-V modules";
         license     = licenses.ncsa;
         platforms   = platforms.all;
-        maintainers = with maintainers; [ gloaming ];
+        maintainers = with maintainers; [ SuperSandro2000 ];
       };
     };
 in