Skip to content

Commit

Permalink
Windows: use new libs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 24, 2023
1 parent 36340ee commit 259a353
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: '4.1'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: 'release'}
- {os: windows-2022, r: 'devel'}
- {os: windows-latest, r: 'devel'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand Down
36 changes: 13 additions & 23 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
# ImageMagick build target
IM=6
ifeq ($(R_COMPILED_BY),gcc 8.3.0)
VERSION=6.9.12-3
else
VERSION=6.9.12-93
#NTDLL=-lntdll
endif

IMPATH = ../windows/imagemagick${IM}-${VERSION}
LIBBUILD = ${subst gcc ,-,${R_COMPILED_BY}}${R_ARCH}
RWINLIB = ../windows/imagemagick
LIBBUILD = lib${subst gcc ,-,${R_COMPILED_BY}}${R_ARCH}

PKG_CPPFLAGS = \
-I$(IMPATH)/include-config${R_ARCH} \
-I$(IMPATH)/include/ImageMagick-${IM}
-I$(RWINLIB)/include-config${R_ARCH} \
-I$(RWINLIB)/include/ImageMagick-6

PKG_CXXFLAGS = -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -D_LIB

PKG_LIBS = \
-L$(IMPATH)/lib${LIBBUILD} \
-L$(IMPATH)/lib${R_ARCH} \
-lMagick++-${IM}.Q16 -lMagickWand-${IM}.Q16 -lMagickCore-${IM}.Q16 \
-L$(RWINLIB)/$(LIBBUILD) \
-L$(RWINLIB)/lib \
-lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16 \
-lraw -lheif -lde265 -lx265 -laom \
-lrsvg-2 -lxml2 \
-lpangocairo-1.0 -lpango-1.0 -lpangowin32-1.0 \
-lpangocairo-1.0 -lpango-1.0 -lpangowin32-1.0 -lharfbuzz -ldwrite \
-lcairo -lfreetype -lpixman-1 -lgdk_pixbuf-2.0 \
-lfftw3 -llcms2 -ljpeg -ltiff -llzma -lbz2 \
-lcairo-gobject -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 \
-lffi -lpcre -lpng16 -lintl -lz -liconv -lfribidi \
-lopenjp2 -lwebpmux -lwebp -lwebpdecoder -lwebpdemux \
-lcairo-gobject -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lpcre2-8 \
-lffi -lpng16 -lintl -lz -liconv -lfribidi \
-lopenjp2 -lwebpmux -lwebp -lsharpyuv -lwebpdecoder -lwebpdemux \
-lusp10 -liphlpapi -lgdiplus -lgdi32 -lole32 -ldnsapi \
-lws2_32 -luserenv -lbcrypt -lurlmon ${NTDLL}
-lws2_32 -luserenv -lbcrypt -lurlmon -lrpcrt4 -lshlwapi -luuid -lntdll

all: clean winlibs

clean:
rm -f $(OBJECTS) $(SHLIB)
rm -f $(SHLIB)

winlibs:
@echo "Linking to imagemagick-$(VERSION)"
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" ${VERSION}

.PHONY: all winlibs clean
24 changes: 16 additions & 8 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Build against imagemagick static website.
VERSION <- commandArgs(TRUE)
IM <- substr(VERSION, 1,1)
if(!file.exists(sprintf("../windows/imagemagick%s-%s/include/ImageMagick-%s/Magick++.h", IM, VERSION, IM))){
if(getRversion() < "3.3.0") setInternet2()
download.file(sprintf("https://github.com/rwinlib/imagemagick%s/archive/v%s.zip", IM, VERSION), "lib.zip", quiet = TRUE)
if(!file.exists("../windows/imagemagick/include/ImageMagick-6/Magick++.h")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/imagemagick-6.9.12.93/imagemagick-6.9.12.93-clang-aarch64.tar.xz"
} else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){
"https://github.com/r-windows/bundles/releases/download/imagemagick-6.9.12.93/imagemagick-6.9.12.93-clang-x86_64.tar.xz"
} else if(getRversion() >= "4.3") {
"https://github.com/r-windows/bundles/releases/download/imagemagick-6.9.12.93/imagemagick-6.9.12.93-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/imagemagick6/archive/6.9.12.96.tar.gz"
}
download.file(url, basename(url), quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("lib.zip", exdir = "../windows")
unlink("lib.zip")
untar(basename(url), exdir = "../windows", tar = 'internal')
unlink(basename(url))
setwd("../windows")
file.rename(list.files(), 'imagemagick')
}

0 comments on commit 259a353

Please sign in to comment.