+ chmod ugo-x "${exe_file}"
+ done
+}
+
+Darwin::patchExe () {
+ local exe_file="${1}"
+
+ Multi::printLdd "${exe_file}" \
+ | Multi::filterLib \
+ | while read lib_file
+ do
+ new_path="$(echo "${lib_file}" | _sed -e 's|^/.*/lib/|@executable_path/lib/|')"
+ id_name="$(echo "${lib_file}" | _sed -e 's|.*/||g')"
+ chmod u+w,go-w "${exe_file}"
+ install_name_tool -change "${lib_file}" "${new_path}" "${exe_file}"
+ install_name_tool -id "${id_name}" "${exe_file}"
+ done
+}
+
+Darwin::patchLib () {
+ local lib_dir="${1}"
+ local exe_file
+
+ find "${lib_dir}" \
+ -type f \
+ \( \
+ -name '*.dylib' \
+ -o -name '*.so' \
+ \) \
+ | while read exe_file
+ do
+ Darwin::patchExe "${exe_file}"
+ chmod ugo-x "${exe_file}"