Skip to content

Commit b8d0f63

Browse files
committed
macOS: Use .tbd files instead of reexported libraries
1 parent e1959c5 commit b8d0f63

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

cibw-build-mpi.sh

+13-10
Original file line numberDiff line numberDiff line change
@@ -746,20 +746,23 @@ if test "$(uname)" = Linux; then
746746
fi
747747

748748
if test "$(uname)" = Darwin; then
749+
tapi() { /Library/Developer/CommandLineTools/usr/bin/tapi "$@"; }
749750
for linklib in lib*mpi.dylib; do
750751
target=$(readlink "$linklib")
751752
unlink "$linklib"
752-
idname="@rpath/$target"
753-
ldname="@loader_path/$target"
754-
ldflags=("${build_ldflags[@]/-Wl,-dead_strip_dylibs}")
755-
ldflags+=("-Wl,-reexport_library,$target")
756-
cc -shared "${ldflags[@]}" -o "$linklib"
757-
install_name_tool -change "$idname" "$ldname" "$linklib"
758-
install_name_tool -id "$idname" "$linklib"
759-
if test "$(uname -m)" = arm64; then
760-
codesign --force --options linker-signed --sign - "$linklib"
761-
fi
753+
tapi stubify --filetype=tbd-v4 "$target"
754+
mv "${target/%.dylib/.tbd}" "${linklib/%.dylib/.tbd}"
762755
done
756+
if test "$mpiname" = "openmpi"; then
757+
wrapper_data_dir="${DESTDIR}${PREFIX}/share/openmpi"
758+
for cmd in mpicc mpic++ mpicxx mpiCC; do
759+
wrapper_data="$wrapper_data_dir/$cmd-wrapper-data.txt"
760+
test -e "$wrapper_data" || continue
761+
test ! -L "$wrapper_data" || continue
762+
sed -i.orig '/dyn_lib_file=/s|\.dylib|\.tbd|' "$wrapper_data"
763+
rm "$wrapper_data".orig
764+
done
765+
fi
763766
fi
764767

765768
} # fixup-mpi-library()

0 commit comments

Comments
 (0)