Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 35 lines 1.4 kB view raw
1From 2751c5de5c61c90b56e3e392a41847f4c47258fd Mon Sep 17 00:00:00 2001 2From: SomeoneSerge <else+aalto@someonex.net> 3Date: Sun, 13 Oct 2024 14:16:48 +0000 4Subject: [PATCH 1/3] _build: allow extra cc flags 5 6--- 7 python/triton/runtime/build.py | 10 +++++++++- 8 1 file changed, 9 insertions(+), 1 deletion(-) 9 10diff --git a/python/triton/runtime/build.py b/python/triton/runtime/build.py 11index d7baeb286..d334dce77 100644 12--- a/python/triton/runtime/build.py 13+++ b/python/triton/runtime/build.py 14@@ -42,9 +42,17 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries): 15 py_include_dir = sysconfig.get_paths(scheme=scheme)["include"] 16 include_dirs = include_dirs + [srcdir, py_include_dir] 17 cc_cmd = [cc, src, "-O3", "-shared", "-fPIC", "-o", so] 18+ 19+ # Nixpkgs support branch 20+ # Allows passing e.g. extra -Wl,-rpath 21+ cc_cmd_extra_flags = "@ccCmdExtraFlags@" 22+ if cc_cmd_extra_flags != ("@" + "ccCmdExtraFlags@"): # substituteAll hack 23+ import shlex 24+ cc_cmd.extend(shlex.split(cc_cmd_extra_flags)) 25+ 26 cc_cmd += [f'-l{lib}' for lib in libraries] 27 cc_cmd += [f"-L{dir}" for dir in library_dirs] 28- cc_cmd += [f"-I{dir}" for dir in include_dirs] 29+ cc_cmd += [f"-I{dir}" for dir in include_dirs if dir is not None] 30 ret = subprocess.check_call(cc_cmd) 31 if ret == 0: 32 return so 33-- 342.46.0 35