summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/warp-lang/dynamic-link.patch
blob: 70a65c3d5fbab58f5c60bf5e8173d273971294d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/build_llvm.py b/build_llvm.py
index 1aa8631a..2304ce1f 100644
--- a/build_llvm.py
+++ b/build_llvm.py
@@ -346,34 +346,24 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
 
         clang_dll_path = os.path.join(build_path, f"bin/{lib_name}")
 
-        if args.build_llvm:
-            # obtain Clang and LLVM libraries from the local build
-            install_path = os.path.join(llvm_install_path, f"{args.mode}-{arch}")
-            libpath = os.path.join(install_path, "lib")
-        else:
-            # obtain Clang and LLVM libraries from packman
-            fetch_prebuilt_libraries(arch)
-            libpath = os.path.join(base_path, f"_build/host-deps/llvm-project/release-{arch}/lib")
-
-        libs = []
-
-        for _, _, libraries in os.walk(libpath):
-            libs.extend(libraries)
-            break  # just the top level contains library files
+        libs = ["LLVM", "clang-cpp"]
+        install_paths = ["@LLVM_LIB@", "@LIBCLANG_LIB@"]
+        libpaths = [os.path.join(install_path, "lib") for install_path in install_paths]
 
         if os.name == "nt":
             libs.append("Version.lib")
             libs.append("Ws2_32.lib")
             libs.append("ntdll.lib")
-            libs.append(f'/LIBPATH:"{libpath}"')
+            libs.extend(f'/LIBPATH:"{libpath}"' for libpath in libpaths)
         else:
-            libs = [f"-l{lib[3:-2]}" for lib in libs if os.path.splitext(lib)[1] == ".a"]
+            libs = [f"-l{lib}" for lib in libs]
             if sys.platform == "darwin":
                 libs += libs  # prevents unresolved symbols due to link order
             else:
                 libs.insert(0, "-Wl,--start-group")
                 libs.append("-Wl,--end-group")
-            libs.append(f"-L{libpath}")
+            libs.extend(f"-L{libpath}" for libpath in libpaths)
+            libs.append("-lz")
             libs.append("-lpthread")
             libs.append("-ldl")
             if sys.platform != "darwin":