Files
macports-ports/devel/cctools/files/cctools-829-lto.patch
a079d1b3fb cctools: move to github
+ stealth update for changed distfile
+ tweak patches to apply cleanly

Closes: https://trac.macports.org/ticket/66436

Co-Authored-By: Michael Dickens <michaelld@macports.org>
2023-04-30 19:53:10 -04:00

40 lines
1.1 KiB
Diff

--- libstuff/lto.c.orig
+++ libstuff/lto.c
@@ -115,13 +115,21 @@
lto_path = makestr(prefix, "../lib/libLTO.dylib", NULL);
lto_handle = dlopen(lto_path, RTLD_NOW);
+ free(lto_path);
+ lto_path = NULL;
if(lto_handle == NULL){
- free(lto_path);
- lto_path = NULL;
- lto_handle = dlopen("/Applications/Xcode.app/Contents/"
- "Developer/Toolchains/XcodeDefault."
- "xctoolchain/usr/lib/libLTO.dylib",
- RTLD_NOW);
+ const char *lto_paths[] = {
+ "@@LLVM_LIBDIR@@/libLTO.dylib",
+ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib",
+ "/usr/lib/libLTO.dylib",
+ "/Applications/Xcode.app/usr/lib/libLTO.dylib",
+ "/Developer/usr/lib/libLTO.dylib",
+ NULL
+ };
+ const char **p;
+ for(p = lto_paths; *p && !lto_handle ; p++) {
+ lto_handle = dlopen(*p, RTLD_NOW);
+ }
}
if(lto_handle == NULL)
return(0);
@@ -147,8 +155,6 @@
lto_get_sym_attr == NULL ||
lto_get_sym_name == NULL){
dlclose(lto_handle);
- if(lto_path != NULL)
- free(lto_path);
return(0);
}
}