Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation committed Feb 5, 2024
1 parent 93e78a7 commit 5e753bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

# Handle webR
if [ "$(uname)" = "Emscripten" ]; then
WEBR="yes"
TARGET="wasm32-unknown-emscripten"
# If it's on CRAN, a package is not allowed to write in any other place than the
# temporary directory on installation. So, we need to tweak Makevars to make the
# compilation happen only within the package directory (i.e. `$(PWD)`).
Expand All @@ -41,7 +41,7 @@ sed \
-e "s|@AFTER_CARGO_BUILD@|${AFTER_CARGO_BUILD}|" \
-e "s|@VENDORING@|${VENDORING}|" \
-e "s|@OFFLINE_OPTION@|${OFFLINE_OPTION}|" \
-e "s|@WEBR@|${WEBR}|" \
-e "s|@TARGET@|${TARGET}|" \
src/Makevars.in > src/Makevars

# Uncomment this to debug
Expand Down
8 changes: 4 additions & 4 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
WEBR = @WEBR@
TARGET = @TARGET@

VENDORING = @VENDORING@
OFFLINE_OPTION = @OFFLINE_OPTION@

LIBDIR = ./rust/target/release
LIBDIR = ./rust/target/$(TARGET)/release
PKG_LIBS = -L$(LIBDIR) -lstring2path
STATLIB = $(LIBDIR)/libstring2path.a

Expand All @@ -20,13 +20,13 @@ $(STATLIB):
cp ./cargo_vendor_config.toml ./rust/.cargo/config.toml; \
fi

if [ "$(WEBR)" != "yes" ]; then \
if [ "$(TARGET)" != "wasm32-unknown-emscripten" ]; then \
@BEFORE_CARGO_BUILD@ cd ./rust && cargo build --jobs 1 --lib --release $(OFFLINE_OPTION); \
else \
export CC="$(CC)" && \
export CFLAGS="$(CFLAGS)" && \
export CARGO_PROFILE_RELEASE_PANIC="abort" && \
@BEFORE_CARGO_BUILD@ cd ./rust && cargo +nightly build --lib --release --target wasm32-unknown-emscripten -Zbuild-std=panic_abort,std $(OFFLINE_OPTION); \
@BEFORE_CARGO_BUILD@ cd ./rust && cargo +nightly build --lib --release --target $(TARGET) -Zbuild-std=panic_abort,std $(OFFLINE_OPTION); \
fi
@AFTER_CARGO_BUILD@

Expand Down

0 comments on commit 5e753bc

Please sign in to comment.