Skip to content

Commit c34ba7e

Browse files
committed
build libgifski from source if cargo is available
1 parent 3c4e7f0 commit c34ba7e

File tree

5 files changed

+41
-38
lines changed

5 files changed

+41
-38
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.7.0
2+
- Windows R >= 4.2: build libgifski from source if cargo is available
3+
14
1.6.6-1
25
- Fix for legacy Windows Vista/2008 (for the old winbuilder)
36

configure.win renamed to configure.ucrt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ if [ $? -eq 0 ]; then
99
echo "$VERSION"
1010
else
1111
echo "Cargo not found. Falling back to static libraries"
12-
cp -f src/Makevars.win.static src/Makevars.win
12+
rm -f Makevars.ucrt
1313
fi
1414
exit 0

src/Makevars.ucrt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
2+
LIBDIR = myrustlib/target/$(TARGET)/release
3+
STATLIB = $(LIBDIR)/libmyrustlib.a
4+
PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lws2_32 -ladvapi32 -luserenv -ldbghelp -lbcrypt
5+
6+
ifeq ($(R_COMPILED_BY),gcc 8.3.0)
7+
GCCPATH=$(subst C:\,/c/,$(RTOOLS40_HOME))/mingw$(WIN)/bin
8+
else
9+
# Either rtools40 or rtools42 ucrt toolchain is OK
10+
GCCPATH=$(R_RTOOLS42_PATH):$(subst C:\,/c/,$(RTOOLS40_HOME))/ucrt64/bin
11+
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc
12+
endif
13+
14+
all: clean rustup
15+
16+
$(SHLIB): $(STATLIB)
17+
18+
$(STATLIB):
19+
ifeq ($(WIN),64) #hack for missing libgcc_eh in mxe-rtools42
20+
mkdir -p myrustlib/target/release/deps; echo '!<arch>' > myrustlib/target/release/deps/libgcc_eh.a
21+
endif
22+
PATH="$(GCCPATH):$(USERPROFILE)\.cargo:$(PATH)" cargo build --target=$(TARGET) --release --manifest-path=myrustlib/Cargo.toml
23+
24+
clean:
25+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) myrustlib/target
26+
27+
rustup:
28+
rustup target add $(TARGET) || true

src/Makevars.win

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
2-
LIBDIR = myrustlib/target/$(TARGET)/release
3-
STATLIB = $(LIBDIR)/libmyrustlib.a
4-
PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lws2_32 -ladvapi32 -luserenv -ldbghelp -lbcrypt
1+
VERSION = 1.6.6
2+
RWINLIB = ../windows/gifski-winlibs
3+
PKG_CPPFLAGS = -I$(RWINLIB)/include
4+
PKG_LIBS = -L$(RWINLIB)/lib${R_ARCH}${CRT} \
5+
-lgifski -lws2_32 -ladvapi32 -luserenv -ldbghelp -lbcrypt
56

6-
ifeq ($(R_COMPILED_BY),gcc 8.3.0)
7-
GCCPATH=$(subst C:\,/c/,$(RTOOLS40_HOME))/mingw$(WIN)/bin
8-
else
9-
# Either rtools40 or rtools42 ucrt toolchain is OK
10-
GCCPATH=$(R_RTOOLS42_PATH):$(subst C:\,/c/,$(RTOOLS40_HOME))/ucrt64/bin
11-
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc
12-
endif
7+
all: clean winlibs
138

14-
all: clean rustup
15-
16-
$(SHLIB): $(STATLIB)
17-
18-
$(STATLIB):
19-
ifeq ($(WIN),64) #hack for missing libgcc_eh in mxe-rtools42
20-
mkdir -p myrustlib/target/release/deps; echo '!<arch>' > myrustlib/target/release/deps/libgcc_eh.a
21-
endif
22-
PATH="$(GCCPATH):$(USERPROFILE)\.cargo:$(PATH)" cargo build --target=$(TARGET) --release --manifest-path=myrustlib/Cargo.toml
9+
winlibs:
10+
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
2311

2412
clean:
25-
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) myrustlib/target
26-
27-
rustup:
28-
rustup target add $(TARGET) || true
13+
rm -f $(SHLIB) $(OBJECTS)

src/Makevars.win.static

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)