-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
Cran feedback
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
^src/rust/.cargo$ | ||
^src/rust/.vscode$ | ||
^src/rust/vendor$ | ||
^src/rust/target$ | ||
|
||
^_pkgdown\.yml$ | ||
^docs$ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,39 @@ | ||
TARGET = x86_64-pc-windows-gnu | ||
|
||
# Rtools42 doesn't have the linker in the location that cargo expects, so we | ||
# need to overwrite it via configuration. | ||
CARGO_LINKER = x86_64-w64-mingw32.static.posix-gcc.exe | ||
|
||
# TODO | ||
VENDORING = yes | ||
OFFLINE_OPTION = --offline | ||
VENDORING = yes | ||
|
||
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu | ||
|
||
TARGET_DIR = ./rust/target | ||
LIBDIR = $(TARGET_DIR)/$(TARGET)/release | ||
STATLIB = $(LIBDIR)/liborbweaver.a | ||
PKG_LIBS = -L$(LIBDIR) -lorbweaver -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll | ||
CARGOTMP = ./rust/.cargo/tmp | ||
TAR=tar | ||
|
||
all: C_clean | ||
|
||
$(SHLIB): $(STATLIB) | ||
|
||
$(STATLIB): | ||
mkdir -p $(LIBDIR)/libgcc_mock && touch $(LIBDIR)/libgcc_mock/libgcc_eh.a | ||
CARGOTMP = $(CURDIR)/.cargo | ||
|
||
# vendoring (Note: to avoid NOTE of "Found the following hidden files and | ||
# directories", .cargo needs to be created here) | ||
$(STATLIB): | ||
mkdir -p $(TARGET_DIR)/libgcc_mock && \ | ||
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a && \ | ||
if [ "$(VENDORING)" = "yes" ]; then \ | ||
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust && \ | ||
mkdir -p ./rust/.cargo && \ | ||
cp ./config/cargo_vendor_config.toml ./rust/.cargo/config.toml; \ | ||
fi | ||
|
||
mkdir -p $(TARGET_DIR)/libgcc_mock | ||
# `rustc` adds `-lgcc_eh` flags to the compiler, but Rtools' GCC doesn't have | ||
# `libgcc_eh` due to the compilation settings. So, in order to please the | ||
# compiler, we need to add empty `libgcc_eh` to the library search paths. | ||
# | ||
# 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 | ||
|
||
# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2 | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
export CARGO_HOME=$(CARGOTMP); \ | ||
mkdir -p ./rust/.cargo && \ | ||
cp ./config/cargo_vendor_config.toml ./rust/.cargo/config.toml; \ | ||
fi && \ | ||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ | ||
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ | ||
cd ./rust && \ | ||
cargo build --target=$(TARGET) --lib --release \ | ||
$(OFFLINE_OPTION) \ | ||
--jobs 1 | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
rm -Rf $(CARGOTMP) && \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
fi | ||
export CARGO_HOME=$(CARGOTMP); \ | ||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ | ||
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ | ||
cd ./rust && \ | ||
cargo build --target=$(TARGET) --lib --release $(OFFLINE_OPTION) --jobs 1; \ | ||
rm -Rf $(CARGOTMP) && \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
|
||
C_clean: | ||
rm -Rf $(SHLIB) $(OBJECTS) ./rust/.cargo $(STATLIB) | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
|
||
clean: | ||
rm -Rf $(SHLIB) $(OBJECTS) $(STATLIB) ./rust/.cargo ./rust/vendor ./rust/target | ||
|
||
.PHONY: all C_clean clean | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) |