Skip to content

Commit

Permalink
Requests by CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Aug 9, 2023
1 parent abb1757 commit a3ae6c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ src/*.a
src/myrustlib/target/*
src/myrustlib/vendor.tar.xz
src/myrustlib/vendor/*
inst/AUTHORS
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: hellorust
Type: Package
Title: Minimal Examples of Using Rust Code in R
Version: 1.1.0
Version: 1.1.1
Authors@R: c(person("Jeroen", "Ooms", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0002-4035-0289")),
person("Authors of the dependency Rust crates", role = "cph", comment = "see AUTHORS file"))
person("Authors of the dependency Rust crates", role = "aut", comment = "see AUTHORS file"))
Description: Template R package with minimal setup to use Rust code in R without
hacks or frameworks. Includes basic examples of importing cargo dependencies,
spawning threads and passing numbers or strings from Rust to R. Cargo crates
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.1
- CRAN request: use role="aut" for rust dependencies
- CRAN request: use -j2 instead of CARGO_BUILD_JOBS=2

1.1.0
- Vendor cargo sources to comply with new CRAN guidlines

Expand Down
8 changes: 5 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lresolv -pthread

$(SHLIB): $(STATLIB)

# CRAN policy forbids using $HOME so we build in the current working dir.
# CRAN policy forbids using $HOME so we build in the current working dir and
# never use local cache. Also CRAN does not allow using more than 2 CPUs.
# This makes things really slow because we have to reinstall all dependencies.
# You can comment these things out if you do not submit to CRAN.
CRANFLAGS=-j 2
CARGOTMP=$(PWD)/.cargo
export CARGO_HOME=$(CARGOTMP)
export CARGO_BUILD_JOBS=2

$(STATLIB):
if [ -f myrustlib/vendor.tar.xz ]; then tar xf myrustlib/vendor.tar.xz && mkdir -p $(CARGOTMP) && cp myrustlib/vendor-config.toml $(CARGOTMP)/config.toml; fi
PATH="${PATH}:${HOME}/.cargo/bin" cargo build --release --manifest-path=myrustlib/Cargo.toml
PATH="${PATH}:${HOME}/.cargo/bin" cargo build ${CRANFLAGS} --release --manifest-path=myrustlib/Cargo.toml
rm -Rf $(CARGOTMP) vendor || true # CRAN wants us to remove "detritus"
rm -Rf $(LIBDIR)/build || true

Expand Down

0 comments on commit a3ae6c2

Please sign in to comment.