Unverified Commit 8d99307d authored by kilyanni's avatar kilyanni
Browse files

intel-llvm: fix linking for consumers using strictDeps

parent 4f2c6ff7
Loading
Loading
Loading
Loading
+30 −16
Original line number Diff line number Diff line
@@ -24,6 +24,19 @@ let
  #      .override { .. }
  #      .overrideAttrs { .. }
  #  })
  #
  # Note that this package does not support cross-compilation at the moment.
  #
  # TODO: Support cross
  #  The easiest path for this will likely be to use standalone packaging,
  #  and use the existing LLVM derivation with overrides. Though that won't
  #  be very workable until upstream support for standalone improves,
  #  see https://github.com/intel/llvm/issues/21877 for that.
  #
  #  Due to the multi-stage build, at several times during compilation
  #  the package runs binaries that were just compiled, and for cross these
  #  would need to be compiled for the host and not target platform,
  #  which is non-trivial to configure.
  scope = lib.makeScope newScope (self: {
    # == Parameters for overriding ==

@@ -89,8 +102,7 @@ let
        ;
    };

    wrapper =
      (wrapCCWith {
    wrapper = wrapCCWith {
      cc = self.unwrapped;
      # This is needed for tools like clang-scan-deps to find headers.
      # The build commands here are the same as the vanilla LLVM derivation.
@@ -100,11 +112,13 @@ let
        echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
        ln -s "${lib.getLib self.unwrapped}/lib/clang/${self.llvmMajorVersion}/include" "$rsrc"
      '';
      }).overrideAttrs
        (old: {
          # OpenCL needs to be passed through
          propagatedBuildInputs = old.propagatedBuildInputs ++ self.unwrapped.propagatedBuildInputs;
        });

      extraPackages =
        # We need to explicitly link to the dev package to get headers like sycl.hpp
        [ self.unwrapped.dev ] # TODO: This needs to be from targetPackages once the package gets cross support
        # OpenCL and such need to be passed through
        ++ self.unwrapped.propagatedBuildInputs;
    };

    clang-tools-wrapper = callPackage ./clang-tools.nix {
      inherit (self) unwrapped wrapper;