2021-09-29 11:53:34 +00:00
|
|
|
diff --git a/src/cpp/core/libclang/LibClang.cpp b/src/cpp/core/libclang/LibClang.cpp
|
|
|
|
index 1186f3a..58e8cc7 100644
|
|
|
|
--- a/src/cpp/core/libclang/LibClang.cpp
|
|
|
|
+++ b/src/cpp/core/libclang/LibClang.cpp
|
|
|
|
@@ -58,7 +58,7 @@ std::vector<std::string> defaultCompileArgs(LibraryVersion version)
|
2018-11-03 18:00:11 +00:00
|
|
|
|
|
|
|
// we need to add in the associated libclang headers as
|
|
|
|
// they are not discovered / used by default during compilation
|
2021-09-29 11:53:34 +00:00
|
|
|
- FilePath llvmPath = s_libraryPath.getParent().getParent();
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
+ FilePath llvmPath("@libclang@");
|
2018-11-03 18:00:11 +00:00
|
|
|
boost::format fmt("%1%/lib/clang/%2%/include");
|
2021-09-29 11:53:34 +00:00
|
|
|
fmt % llvmPath.getAbsolutePath() % version.asString();
|
2018-11-03 18:00:11 +00:00
|
|
|
std::string includePath = fmt.str();
|
2021-09-29 11:53:34 +00:00
|
|
|
@@ -70,46 +70,7 @@ std::vector<std::string> defaultCompileArgs(LibraryVersion version)
|
|
|
|
|
|
|
|
std::vector<std::string> systemClangVersions()
|
|
|
|
{
|
|
|
|
- std::vector<std::string> clangVersions;
|
|
|
|
-
|
|
|
|
-#if defined(__APPLE__)
|
|
|
|
- // NOTE: the version of libclang.dylib bundled with Xcode
|
|
|
|
- // doesn't seem to work well when loaded as a library
|
|
|
|
- // (there seems to be extra orchestration required to get
|
|
|
|
- // include paths set up; easier to just depend on command
|
|
|
|
- // line tools since we request their installation in other
|
|
|
|
- // contexts as well)
|
|
|
|
- clangVersions = {
|
|
|
|
- "/Library/Developer/CommandLineTools/usr/lib/libclang.dylib"
|
|
|
|
- };
|
|
|
|
-#elif defined(__unix__)
|
|
|
|
- // default set of versions
|
|
|
|
- clangVersions = {
|
2018-11-03 18:00:11 +00:00
|
|
|
- "/usr/lib/libclang.so",
|
|
|
|
- "/usr/lib/llvm/libclang.so",
|
|
|
|
- "/usr/lib64/libclang.so",
|
|
|
|
- "/usr/lib64/llvm/libclang.so",
|
2021-09-29 11:53:34 +00:00
|
|
|
- };
|
|
|
|
-
|
|
|
|
- // iterate through the set of available 'llvm' directories
|
|
|
|
- for (const char* prefix : {"/usr/lib", "/usr/lib64"})
|
|
|
|
- {
|
|
|
|
- FilePath prefixPath(prefix);
|
|
|
|
- if (!prefixPath.exists())
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
- std::vector<FilePath> directories;
|
|
|
|
- Error error = prefixPath.getChildren(directories);
|
|
|
|
- if (error)
|
|
|
|
- LOG_ERROR(error);
|
|
|
|
-
|
|
|
|
- // generate a path for each 'llvm' directory
|
|
|
|
- for (const FilePath& path : directories)
|
|
|
|
- if (path.getFilename().find("llvm") == 0)
|
|
|
|
- clangVersions.push_back(path.completePath("lib/libclang.so.1").getAbsolutePath());
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
+ std::vector<std::string> clangVersions = { "@libclang.so@" };
|
|
|
|
return clangVersions;
|
|
|
|
}
|
|
|
|
|