diff options
-rw-r--r-- | include/shlib.h | 10 | ||||
-rw-r--r-- | src/rpath.c | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/shlib.h b/include/shlib.h index e4d0d08..a0b6aeb 100644 --- a/include/shlib.h +++ b/include/shlib.h @@ -1,12 +1,18 @@ #ifndef SPM_SHLIB_H #define SPM_SHLIB_H -#ifdef __APPLE__ +#if defined(_MSC_VER) +#define SPM_SHLIB_EXEC "dumpbin" +#define SPM_SHLIB_EXEC_ARGS "/dependents" +#define SPM_SHLIB_EXTENSION ".dll" +#elif defined(__APPLE__) && defined(__MACH__) #define SPM_SHLIB_EXEC "/usr/bin/otool" #define SPM_SHLIB_EXEC_ARGS "-l" -#else +#define SPM_SHLIB_EXTENSION ".dylib" +#else // linux (hopefully) #define SPM_SHLIB_EXEC "/usr/bin/objdump" #define SPM_SHLIB_EXEC_ARGS "-p" +#define SPM_SHLIB_EXTENSION ".so" #endif StrList *shlib_deps(const char *_filename); diff --git a/src/rpath.c b/src/rpath.c index 74ee28b..4d4d801 100644 --- a/src/rpath.c +++ b/src/rpath.c @@ -187,8 +187,7 @@ int rpath_autoset(const char *filename, FSTree *tree) { * @return `FSTree` */ FSTree *rpath_libraries_available(const char *root) { - // TODO: Darwin support - FSTree *tree = fstree(root, (char *[]) {".so", NULL}, SPM_FSTREE_FLT_CONTAINS | SPM_FSTREE_FLT_RELATIVE); + FSTree *tree = fstree(root, (char *[]) {SPM_SHLIB_EXTENSION, NULL}, SPM_FSTREE_FLT_CONTAINS | SPM_FSTREE_FLT_RELATIVE); if (tree == NULL) { perror(root); fprintf(SYSERROR); |