Skip to content

Commit 2768143

Browse files
fix(driver): missing dirname() and wrong RPATH separator on macOS (estkme-group#389)
* fix(driver): missing dirname() on macOS * fix(standalone): use semicolon-separated list so CMake convert to platform separator Colon-separated list is only supported by GNU/BSD. Signed-off-by: Coelacanthus <[email protected]>
1 parent 17b04e7 commit 2768143

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ endif()
6262
if(NOT CMAKE_INSTALL_RPATH)
6363
if (STANDALONE_MODE)
6464
cmake_policy(SET CMP0177 NEW)
65-
set(CMAKE_INSTALL_RPATH "${RPATH_BINARY_PATH}:${RPATH_BINARY_PATH}/lib")
65+
# SHALL use semicolon-separated list so CMake can convert to platform separator.
66+
set(CMAKE_INSTALL_RPATH "${RPATH_BINARY_PATH};${RPATH_BINARY_PATH}/lib")
6667
set(CMAKE_INSTALL_PREFIX "")
6768
set(CMAKE_INSTALL_BINDIR "executables")
6869
set(CMAKE_INSTALL_LIBDIR "executables/lib")

driver/euicc-driver-loader.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# include <sys/syslimits.h>
2727
#elif defined(__APPLE__) && defined(__MACH__)
2828
# include <dlfcn.h>
29+
# include <libgen.h>
2930
# include <mach-o/dyld.h>
3031
# include <sys/syslimits.h>
3132
#elif defined(_WIN32)
@@ -109,11 +110,10 @@ static char *get_origin() {
109110
static char *get_origin() {
110111
char *buf = (char *)calloc(PATH_MAX, sizeof(char));
111112
uint32_t size = PATH_MAX;
112-
if (_NSGetExecutablePath(buf, &size) == 0) {
113-
return buf;
114-
} else {
113+
if (_NSGetExecutablePath(buf, &size) != 0) {
115114
return NULL;
116115
}
116+
return strdup(dirname(buf));
117117
}
118118
#endif
119119

0 commit comments

Comments
 (0)