Skip to content

Commit eb50dcc

Browse files
bnarasclaude
andcommitted
Simplify macOS deployment target fix to one-line env var export
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8c621ae commit eb50dcc

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

configure

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,4 @@ fi
88

99
CC_ALONE=`$R_HOME/bin/R CMD config CC | awk '{print $1}'`
1010

11-
# On macOS, detect the deployment target so that C code compiled by the Rust
12-
# cc crate (e.g. savvy's unwind_protect_wrapper.c) uses the same target as
13-
# R's linker. Without this, the cc crate defaults to the host OS version,
14-
# which may be newer than R's deployment target, triggering linker warnings.
15-
MACOSX_DT=""
16-
if [ "$(uname)" = "Darwin" ]; then
17-
# 1) Environment variable (set by CRAN builders and R CMD INSTALL)
18-
if [ -n "${MACOSX_DEPLOYMENT_TARGET}" ]; then
19-
MACOSX_DT="${MACOSX_DEPLOYMENT_TARGET}"
20-
fi
21-
# 2) Fallback: extract -mmacosx-version-min from R's CC, CFLAGS, or LDFLAGS
22-
if [ -z "${MACOSX_DT}" ]; then
23-
for var in CC CFLAGS LDFLAGS; do
24-
MACOSX_DT=`"${R_HOME}/bin/R" CMD config $var | \
25-
sed -n 's/.*-mmacosx-version-min=\([^ ]*\).*/\1/p'`
26-
if [ -n "${MACOSX_DT}" ]; then break; fi
27-
done
28-
fi
29-
fi
30-
31-
sed -e "s/@TARGET@/${TARGET}/" \
32-
-e "s|@R_HOME@|${R_HOME}|" \
33-
-e "s|@CC_ALONE@|${CC_ALONE}|" \
34-
-e "s|@MACOSX_DT@|${MACOSX_DT}|" \
35-
src/Makevars.in > src/Makevars
11+
sed -e "s/@TARGET@/${TARGET}/" -e "s|@R_HOME@|${R_HOME}|" -e "s|@CC_ALONE@|${CC_ALONE}|" src/Makevars.in > src/Makevars

src/Makevars.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
TARGET = @TARGET@
22
R_HOME = @R_HOME@
33
CC_ALONE = @CC_ALONE@
4-
MACOSX_DT = @MACOSX_DT@
54
VENDORING = yes
65
VENDOR_SRC = ./rust/vendor.tar.xz
76
VENDOR_DIR = ./rust/vendor
@@ -38,7 +37,7 @@ $(STATLIB):
3837
export R_HOME=$(R_HOME); \
3938
export PATH="$(PATH):$(HOME)/.cargo/bin"; \
4039
export RUSTFLAGS="-C linker=${CC_ALONE}"; \
41-
if [ -n "$(MACOSX_DT)" ]; then export MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DT)"; fi; \
40+
export MACOSX_DEPLOYMENT_TARGET; \
4241
cargo build $(CARGO_BUILD_ARGS) --release --offline; \
4342
else \
4443
cargo build $(CARGO_BUILD_ARGS); \

0 commit comments

Comments
 (0)