aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cpp')
-rwxr-xr-xtools/cpp/osx_cc_wrapper.sh13
-rw-r--r--tools/cpp/osx_cc_wrapper.sh.tpl13
2 files changed, 22 insertions, 4 deletions
diff --git a/tools/cpp/osx_cc_wrapper.sh b/tools/cpp/osx_cc_wrapper.sh
index 8aba869443..9438567d73 100755
--- a/tools/cpp/osx_cc_wrapper.sh
+++ b/tools/cpp/osx_cc_wrapper.sh
@@ -57,6 +57,8 @@ function get_library_path() {
for libdir in ${LIB_DIRS}; do
if [ -f ${libdir}/lib$1.so ]; then
echo "${libdir}/lib$1.so"
+ elif [ -f ${libdir}/lib$1.dylib ]; then
+ echo "${libdir}/lib$1.dylib"
fi
done
}
@@ -82,11 +84,18 @@ function get_otool_path() {
# Do replacements in the output
for rpath in ${RPATHS}; do
for lib in ${LIBS}; do
- if [ -f "`dirname ${OUTPUT}`/${rpath}/lib${lib}.so" ]; then
+ if [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.so" ]; then
+ libname="lib${lib}.so"
+ elif [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.dylib" ]; then
+ libname="lib${lib}.dylib"
+ fi
+ # ${libname-} --> return $libname if defined, or undefined otherwise. This is to make
+ # this set -e friendly
+ if [[ -n "${libname-}" ]]; then
libpath=$(get_library_path ${lib})
if [ -n "${libpath}" ]; then
${INSTALL_NAME_TOOL} -change $(get_otool_path "${libpath}") \
- "@loader_path/${rpath}/lib${lib}.so" "${OUTPUT}"
+ "@loader_path/${rpath}/${libname}" "${OUTPUT}"
fi
fi
done
diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl
index fb32e1e6b9..713c71117d 100644
--- a/tools/cpp/osx_cc_wrapper.sh.tpl
+++ b/tools/cpp/osx_cc_wrapper.sh.tpl
@@ -59,6 +59,8 @@ function get_library_path() {
for libdir in ${LIB_DIRS}; do
if [ -f ${libdir}/lib$1.so ]; then
echo "${libdir}/lib$1.so"
+ elif [ -f ${libdir}/lib$1.dylib ]; then
+ echo "${libdir}/lib$1.dylib"
fi
done
}
@@ -84,11 +86,18 @@ function get_otool_path() {
# Do replacements in the output
for rpath in ${RPATHS}; do
for lib in ${LIBS}; do
- if [ -f "`dirname ${OUTPUT}`/${rpath}/lib${lib}.so" ]; then
+ if [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.so" ]; then
+ libname="lib${lib}.so"
+ elif [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.dylib" ]; then
+ libname="lib${lib}.dylib"
+ fi
+ # ${libname-} --> return $libname if defined, or undefined otherwise. This is to make
+ # this set -e friendly
+ if [[ -n "${libname-}" ]]; then
libpath=$(get_library_path ${lib})
if [ -n "${libpath}" ]; then
${INSTALL_NAME_TOOL} -change $(get_otool_path "${libpath}") \
- "@loader_path/${rpath}/lib${lib}.so" "${OUTPUT}"
+ "@loader_path/${rpath}/${libname}" "${OUTPUT}"
fi
fi
done