mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-08 19:32:39 +08:00
Do not assume architecture dir, specify by environment variable
This commit is contained in:
parent
07dc679fb6
commit
32149b0709
@ -60,9 +60,10 @@ dosbox-x.app: $(MACOS_BINARIES) contrib/macos/dosbox.icns src/tool/mach-o-matic
|
||||
done
|
||||
# Fix the linker search paths of the libraries we copied
|
||||
@for dir in dosbox-x.app/Contents/MacOS/arm64 dosbox-x.app/Contents/MacOS/x86_64; do \
|
||||
if [ `ls $$dir/*.dylib 2>/dev/null | wc -l` -gt 0 ]; then \
|
||||
if [ `ls $$dir/*.dylib 2>/dev/null | wc -l` -gt 0 ]; then \
|
||||
arpf=`basename $$dir`; \
|
||||
for dylib in $$dir/*.dylib; do \
|
||||
[ -f "$$dylib" ] && src/tool/mach-o-matic "$$dylib" || exit 1; \
|
||||
[ -f "$$dylib" ] && (ARCHPREF=$$arpf src/tool/mach-o-matic "$$dylib") || exit 1; \
|
||||
done; \
|
||||
fi; \
|
||||
done
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string arch_prefix = "arm64";
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool str_startswith(const char *str,const char *starts) {
|
||||
@ -40,25 +42,25 @@ string dylib_replace(string path) {
|
||||
fn = s;
|
||||
|
||||
if (str_startswith(s,"/opt/homebrew/"))
|
||||
return string("@executable_path/arm64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
if (str_startswith(s,"/usr/local/Homebrew/"))
|
||||
return string("@executable_path/x86_64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
if (str_startswith(s,"/usr/local/lib/"))
|
||||
return string("@executable_path/x86_64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
if (str_startswith(s,"/usr/local/opt/"))
|
||||
return string("@executable_path/x86_64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
if (str_startswith(s,"/usr/local/Cellar/"))
|
||||
return string("@executable_path/x86_64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
|
||||
if (str_startswith(s,"@loader_path/")) { /* often in Brew followed by ../../.. etc */
|
||||
s = fn;
|
||||
while (!strncmp(s,"../",3)) s += 3;
|
||||
printf("'%s' = '%s'\n",path.c_str(),s);
|
||||
return string("@executable_path/arm64/") + s;
|
||||
return string("@executable_path/") + arch_prefix + "/" + s;
|
||||
}
|
||||
|
||||
if (str_startswith(s,"@rpath/"))
|
||||
return string("@executable_path/arm64/") + fn;
|
||||
return string("@executable_path/") + arch_prefix + "/" + fn;
|
||||
|
||||
return path;
|
||||
}
|
||||
@ -104,6 +106,11 @@ int main(int argc,char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
char *x = getenv("ARCHPREF");
|
||||
if (x != NULL) arch_prefix = x;
|
||||
}
|
||||
|
||||
fpath = argv[1];
|
||||
if (lstat(fpath.c_str(),&st) != 0) {
|
||||
fprintf(stderr,"Cannot stat %s\n",fpath.c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user