nixpkgs/pkgs/development/python-modules/triton/0001-_build-allow-extra-cc-flags.patch
2025-07-04 13:43:54 -07:00

19 lines
804 B
Diff

diff --git a/python/triton/runtime/build.py b/python/triton/runtime/build.py
index 1b76548d4..2756dccdb 100644
--- a/python/triton/runtime/build.py
+++ b/python/triton/runtime/build.py
@@ -33,5 +33,13 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries):
cc_cmd += [f'-l{lib}' for lib in libraries]
cc_cmd += [f"-L{dir}" for dir in library_dirs]
cc_cmd += [f"-I{dir}" for dir in include_dirs if dir is not None]
+
+ # Nixpkgs support branch
+ # Allows passing e.g. extra -Wl,-rpath
+ cc_cmd_extra_flags = "@ccCmdExtraFlags@"
+ if cc_cmd_extra_flags != ("@" + "ccCmdExtraFlags@"): # substituteAll hack
+ import shlex
+ cc_cmd.extend(shlex.split(cc_cmd_extra_flags))
+
subprocess.check_call(cc_cmd, stdout=subprocess.DEVNULL)
return so