-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakevars
26 lines (21 loc) · 1.01 KB
/
Makevars
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
LIBDIR = myrustlib/target/release
STATLIB = $(LIBDIR)/libmyrustlib.a
PKG_CFLAGS = -pthread
PKG_CPPFLAGS = -DSTRICT_R_HEADERS -DR_NO_REMAP
PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lresolv -pthread
#all: clean
$(SHLIB): $(STATLIB)
# 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)
$(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 ${CRANFLAGS} --release --manifest-path=myrustlib/Cargo.toml
rm -Rf $(CARGOTMP) vendor || true # CRAN wants us to remove "detritus"
rm -Rf $(LIBDIR)/build || true
clean:
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) myrustlib/target