Skip to content

Commit 025f3fc

Browse files
committed
Modify cdylib suffix on macOS
1 parent e24aa53 commit 025f3fc

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ CARGO_TARGET_DIR=@CARGO_TARGET_DIR@
6363
CARGO_PROFILE=@CARGO_PROFILE@
6464
CARGO_TARGET=@CARGO_TARGET@
6565
CARGO_TARGET_LINKER_ENV=@CARGO_TARGET_LINKER_ENV@
66+
CARGO_DYLIB_SUFFIX=@CARGO_DYLIB_SUFFIX@
6667
RUST_STATICLIB_DEP=@RUST_STATICLIB_DEP@
6768

6869
GNULD= @GNULD@

Modules/makesetup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
301301
# Shared build: build each Rust module as a cdylib (.so)
302302
for mod in $mods
303303
do
304-
rust_shared="target/\$(if \$(CARGO_TARGET),\$(CARGO_TARGET)/\$(CARGO_TARGET_DIR),\$(CARGO_TARGET_DIR))/lib$mod\$(SHLIB_SUFFIX)"
304+
rust_shared="target/\$(if \$(CARGO_TARGET),\$(CARGO_TARGET)/\$(CARGO_TARGET_DIR),\$(CARGO_TARGET_DIR))/lib$mod\$(CARGO_DYLIB_SUFFIX)"
305305
file="$srcdir/$mod\$(EXT_SUFFIX)"
306306
SHAREDMODS="$SHAREDMODS $file"
307307
BUILT_SHARED="$BUILT_SHARED $mod"

configure

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4371,11 +4371,19 @@ if test -n "$CARGO_TARGET"; then
43714371
else
43724372
CARGO_TARGET_LINKER_ENV=""
43734373
fi
4374+
dnl Cargo's cdylib crate type uses the platform's native shared library
4375+
dnl extension, which differs from CPython's SHLIB_SUFFIX on macOS/iOS
4376+
dnl (CPython uses .so, Cargo uses .dylib).
4377+
case "$host" in
4378+
*-apple-*) CARGO_DYLIB_SUFFIX=".dylib";;
4379+
*) CARGO_DYLIB_SUFFIX="$SHLIB_SUFFIX";;
4380+
esac
43744381
AC_SUBST([CARGO_HOME])
43754382
AC_SUBST([CARGO_TARGET_DIR])
43764383
AC_SUBST([CARGO_PROFILE])
43774384
AC_SUBST([CARGO_TARGET])
43784385
AC_SUBST([CARGO_TARGET_LINKER_ENV])
4386+
AC_SUBST([CARGO_DYLIB_SUFFIX])
43794387

43804388

43814389
dnl detect sqlite3 from Emscripten emport

0 commit comments

Comments
 (0)