diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-03-18 14:08:17 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-03-18 14:08:17 -0400 |
commit | 8848e4f55561dbae8d76d27ed5e168b17c69e85d (patch) | |
tree | 42fe127135e066114a41fce38a05b9b861f50910 | |
parent | e0171ac5d5b9b17e07c8e26160e602f4e4c32a20 (diff) | |
download | spmc-8848e4f55561dbae8d76d27ed5e168b17c69e85d.tar.gz |
Shared library search improvement
* Define platform dependent SPM_SHLIB_EXTENSION
* rpath_libraries_available() uses SPM_SHLIB_EXTENSION
-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); |