Skip to content

Commit

Permalink
Fix/windows (#22)
Browse files Browse the repository at this point in the history
* Increment version number to 0.1.5

* Try to build on windows

* try on win devel

* Syntax fix

* Syntax fix again

* try echoing extracted files

* Vendoring = yes

* introspect dir

* add target

* cleanup
  • Loading branch information
dfalbel authored Oct 1, 2024
1 parent 35e2c51 commit 842b750
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
config:
- {os: windows-latest, r: 'release', rust-version: 'stable-msvc'}
- {os: windows-latest, r: 'devel', rust-version: 'stable-msvc'}
- {os: macOS-latest, r: 'release', rust-version: 'stable'}
- {os: ubuntu-latest, r: 'release', rust-version: '1.69.0'}
- {os: ubuntu-latest, r: 'devel', rust-version: 'stable'}
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tok
Title: Fast Text Tokenization
Version: 0.1.4.9000
Version: 0.1.5
Authors@R: c(
person("Daniel", "Falbel", , "[email protected]", c("aut", "cre")),
person("Regouby", "Christophe", , "[email protected]", c("ctb")),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tok (development version)
# tok 0.1.5

- add message translation in FR (#19, @cregouby)

Expand Down
4 changes: 1 addition & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ $(STATLIB):
# to set it here to ensure cargo can be invoked. It is appended to PATH and
# therefore is only used if cargo is absent from the user's PATH.



if [ "$(VENDORING)" = "yes" ]; then \
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust && \
mkdir -p ./rust/.cargo; \
Expand All @@ -25,7 +23,7 @@ $(STATLIB):
export CARGO_HOME=$(CARGOTMP); \
fi && \
echo "*** Rust version: $$(rustc --version)" && \
cargo build --lib --release --offline --config rust/config/cargo-config.toml --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) --jobs 1
cargo build --lib --release --offline --config rust/config/cargo-config.toml --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)

# we clean headers to avoid a message like
# Found the following sources/headers with CR or CRLF line endings:
Expand Down
14 changes: 13 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
VENDORING = yes

TARGET_DIR = ./rust/target
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
Expand All @@ -19,14 +20,25 @@ $(STATLIB):
# For more details, please refer to
# https://github.com/r-windows/rtools-packages/blob/2407b23f1e0925bbb20a4162c963600105236318/mingw-w64-gcc/PKGBUILD#L313-L316
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a

if [ "$(VENDORING)" = "yes" ]; then \
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust; \
fi

# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \
if [ "$(NOT_CRAN)" != "true" ]; then \
export CARGO_HOME=$(CARGOTMP); \
fi && \
cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
echo "*** Rust version: $$(rustc --version)" && \
cargo build --target=$(TARGET) --lib --release --offline --config rust/config/cargo-config.toml --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)

# we clean headers to avoid a message like
# Found the following sources/headers with CR or CRLF line endings:
# src/rust/vendor/clang-sys/tests/header.h
@echo "*** Cleaning headers"
"${R_HOME}/bin${R_ARCH_BIN}/Rscript" "../tools/patch.R"

if [ "$(NOT_CRAN)" != "true" ]; then \
rm -Rf $(CARGOTMP) && \
Expand Down

0 comments on commit 842b750

Please sign in to comment.