Summary: This is mostly a partial revert of D19022905 and D19272627 for only the part of it concerned with "install-with-libs". Fixes #1260. Reviewed By: skcho Differential Revision: D21998484 fbshipit-source-id: ed884e772master
parent
7df439c814
commit
2a68099640
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
# Usage: set_libso_path.sh [LIBSO_DIR] [TARGET]
|
||||
#
|
||||
# This changes MacOSX's executable [TARGET] to use shared libraries in
|
||||
# [LIBSO_DIR] when rpath has been set to [LIBSO_DIR].
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
LIBSO_DIR=$1
|
||||
TARGET=$2
|
||||
|
||||
TMP=$( mktemp )
|
||||
trap "rm $TMP" EXIT
|
||||
|
||||
otool -L "$TARGET" | tail -n +2 > "$TMP"
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
LIB_PATH=$( echo $line | awk '{print $1}' )
|
||||
LIB_FILE=$( basename "${LIB_PATH}" )
|
||||
if [ -f "${LIBSO_DIR}/${LIB_FILE}" ]; then
|
||||
install_name_tool -change "${LIB_PATH}" "@rpath/${LIB_FILE}" "$TARGET"
|
||||
fi
|
||||
done < "$TMP"
|
Loading…
Reference in new issue