-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove igraph dependency * Fix windows installation of Rust library * Remove unicode symbols not compatible with LaTeX * remove vendor folder * force linker for windows to be rust-lld * improved rust arch detection * remove forced linker * revert change of rust arch detection script * revert change of rust arch detection script * add empty libgcc_eh.a * fix(win): fix libgcc_mock folder not being created * remove documentation page
- Loading branch information
1 parent
e2bba4c
commit cec3285
Showing
10 changed files
with
61 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,23 @@ | ||
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu | ||
|
||
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 | ||
|
||
VENDORING = @VENDORING@ | ||
OFFLINE_OPTION = @OFFLINE_OPTION@ | ||
|
||
|
||
TARGET = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript.exe" "../tools/rustarch.R") | ||
LIBDIR = rust/target/$(TARGET)/release | ||
STATLIB = $(LIBDIR)/WebGestaltR.a | ||
PKG_LIBS = -L$(LIBDIR) -lWebGestaltR -lws2_32 -ladvapi32 -lgdi32 -lbcrypt -lcrypt32 -luserenv -lntdll | ||
TARGET_DIR = rust/target | ||
LIBDIR = $(TARGET_DIR)/$(TARGET)/release | ||
STATLIB = $(LIBDIR)/libWebGestaltR.a | ||
PKG_LIBS = -L$(LIBDIR) -lWebGestaltR -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll | ||
|
||
all: C_clean | ||
all: clean rustup | ||
|
||
$(SHLIB): $(STATLIB) | ||
|
||
CARGOTMP = $(CURDIR)/.cargo | ||
|
||
$(STATLIB): | ||
if [ -f rust/vendor.tar.xz ]; then tar xf rust/vendor.tar.xz && mkdir -p .cargo && cp windows-config.toml .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 | ||
mkdir -p $(LIBDIR)/libgcc_mock && touch $(LIBDIR)/libgcc_mock/libgcc_eh.a | ||
|
||
# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2 | ||
# vendoring (Note: to avoid NOTE of "Found the following hidden files and | ||
# directories", .cargo needs to be created here) | ||
if [ "$(VENDORING)" = "yes" ]; then \ | ||
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust && \ | ||
mkdir -p ./.cargo && \ | ||
cp ./config.toml ./.cargo/config.toml; \ | ||
fi | ||
|
||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
export CARGO_HOME=$(CARGOTMP); \ | ||
fi && \ | ||
@BEFORE_CARGO_BUILD@ export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ | ||
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ | ||
cargo build --target=$(TARGET) --jobs 2 --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) $(OFFLINE_OPTION) | ||
if [ "$(NOT_CRAN)" != "true" ]; then \ | ||
rm -Rf $(CARGOTMP) && \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
fi | ||
@AFTER_CARGO_BUILD@ | ||
|
||
C_clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" | ||
PATH="$(USERPROFILE)\.cargo\bin:$(PATH)" cargo build --target=$(TARGET) --release --manifest-path=rust/Cargo.toml | ||
|
||
clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target | ||
rm -Rf vendor | ||
|
||
rustup: | ||
rustup target add $(TARGET) || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[net] | ||
git-fetch-with-cli = true | ||
|
||
[source.crates-io] | ||
replace-with = "vendored-sources" | ||
|
||
[source."git+https://github.com/bzhanglab/webgestalt_rust.git?branch=master"] | ||
git = "https://github.com/bzhanglab/webgestalt_rust.git" | ||
branch = "master" | ||
replace-with = "vendored-sources" | ||
|
||
[source.vendored-sources] | ||
directory = "vendor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# See notes in FAQ about ARM64 support: | ||
# https://github.com/r-rust/faq#does-rust-support-windows-on-arm64-aarch64 | ||
arch <- if (grepl("aarch", R.version$platform)) { | ||
"aarch64-pc-windows-gnullvm" | ||
} else if (grepl("clang", Sys.getenv("R_COMPILED_BY"))) { | ||
"x86_64-pc-windows-gnullvm" | ||
} else if (grepl("i386", R.version$platform)) { | ||
"i686-pc-windows-gnu" | ||
} else { | ||
"x86_64-pc-windows-gnu" | ||
} | ||
cat(arch) |