-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement get_executable_path() for macOS #5560
Conversation
@rom1v I tested the build from |
One more thing, the For example: $ ln -s scrcpy-linux-x86_64-v3.0/scrcpy aaa
$ ./aaa
./aaa: line 7: ./scrcpy_bin: No such file or directory On Linux, diff --git app/data/scrcpy_static_wrapper.sh app/data/scrcpy_static_wrapper.sh
index b31b4f1f4..9e765ca87 100755
--- app/data/scrcpy_static_wrapper.sh
+++ app/data/scrcpy_static_wrapper.sh
@@ -1,4 +1,4 @@
#!/bin/bash
-cd "$(dirname ${BASH_SOURCE[0]})"
+cd "$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
export ADB="${ADB:-./adb}"
./scrcpy_bin "$@" also in the case where it's a relative symlink pointing to a relative symlink (which does not work without However, on macOS, I think |
https://stackoverflow.com/questions/7665/how-to-resolve-symbolic-links-in-a-shell-script |
I added commits so that scrcpy uses the local adb in portable builds, and I removed the wrapper script completely. Please test/review 😉 |
Without For example: ln -s scrcpy-linux-x86_64-v3.0/scrcpy aaa
mkdir bbb
cd bbb
ln -s ../aaa ccc
./ccc |
Trying to build 39c3921 on macOS 10.15.7 fails with
|
@metayan Does this help: diff --git app/src/sys/unix/file.c app/src/sys/unix/file.c
index 60c806bb2..6123c788c 100644
--- app/src/sys/unix/file.c
+++ app/src/sys/unix/file.c
@@ -6,6 +6,9 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef __APPLE__
+# include <mach-o/dyld.h> // for _NSGetExecutablePath()
+#endif
#include "util/log.h"
? |
@rom1v |
@rom1v By the way, the release scripts are also excellent, taking care of the dependencies. Noticed this, though, unrelated to this PR, but appears when building on macOS:
|
🤷 |
Merged into I will probably publish a release 3.0.1 soon with the current |
You mean it checks for system wide |
By default, it uses the This can be changzd by setting the ADB envvar. For example: ADB=adb scrcpy It will use |
@metayan I would strongly suggest you to move to later macOS releases preferably latest 2 releases.Catalina ceased to get security updates in oct 2022 vulnerable to easy root exploits like dirtycow patched in dec 2022 or other tcc exploits. |
Implement the function to get the executable path on macOS, so that enabling
-Dportable=true
works on all platforms to findscrcpy-server
andicon.png
in the same directory as the executable.@Genxster1998 I stole this from your branch. Thank you 😉
Please review/test on macOS.