aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-11-18 14:16:44 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-11-18 14:16:44 -0500
commit85b4e5388bfe10ebfde994b084d438d5bfb1878a (patch)
treecd2b885ebd77fd5839c951c058d8716e45deaca2
parentaa7e99e130b47caebaacd24e6d9e4f89f42cd213 (diff)
downloadspm-85b4e5388bfe10ebfde994b084d438d5bfb1878a.tar.gz
Fix rpath bug
-rwxr-xr-xspm18
1 files changed, 15 insertions, 3 deletions
diff --git a/spm b/spm
index b69d4d7..9754ae8 100755
--- a/spm
+++ b/spm
@@ -50,10 +50,15 @@ function spm_rpath_nearest() {
local install_root="${destdir}/${prefix_placeholder}"
# Determine if package produced its own "lib" directory. If not, generate a symlink
- # pointing back to the build's runtime environment.
+ # pointing back to the build's runtime environment, or create a placeholder.
if [[ ! -d ${install_root}/lib ]] && [[ ! -L ${install_root}/lib ]]; then
pushd "${install_root}" &>/dev/null
- ln -sf "${build_runtime}"/lib
+ if [[ -d ${build_runtime}/lib ]]; then
+ ln -sf "${build_runtime}"/lib
+ else
+ mkdir -p "${install_root}"/lib
+ fi
+
popd &>/dev/null
lib_forced=1
fi
@@ -69,14 +74,21 @@ function spm_rpath_nearest() {
while [[ $(pwd) != / ]]
do
result+="../"
+ echo "spm_rpath_nearest(): @ $(pwd)" >&2
if [[ -d $(pwd)/lib/ ]]; then
+
+ echo "spm_rpath_nearest(): found lib directory" >&2
# There are edge cases when the lib directory one level above an executable
# doesn't contain any shared libraries (i.e. binutils)
- if (( ! $(find . -type f -name "*.so" 2>/dev/null | wc -l) )); then
+ if (( ! $(find $(pwd)/lib/ -type f \
+ \( -name "*.so" -o -name "*.dylib" -o -name "*.a" \) \
+ 2>/dev/null | wc -l) )); then
cd ..
+ echo "spm_rpath_nearest(): lib directory was not useful" >&2
continue
fi
result+="lib"
+ echo "spm_rpath_nearest(): lib directory was useful" >&2
break
fi
cd ..