diff -Nru orig/vol2birdR/src/Makevars.win patched/vol2birdR/src/Makevars.win
--- orig/vol2birdR/src/Makevars.win	2024-07-10 22:18:59.000000000 +0200
+++ patched/vol2birdR/src/Makevars.win	2024-08-21 12:05:55.151421900 +0200
@@ -10,28 +10,30 @@
 
 OBJECTS = $(SOURCES:.cpp=.o) $(OBJECTS_C)
 
-# pkg-config.exe proj --libs
-PROJ_LIBS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" "../tools/get_proj_libraries.R")
-HDF5_LIBS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" "../tools/get_hdf5_libraries.R")
-H5_API_CFLAGS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" "../tools/get_h5_api_cflags.R")
+H5_API_CFLAGS=-DH5_USE_110_API
 
+PKG_CPPFLAGS=-D__USE_MINGW_ANSI_STDIO $(H5_API_CFLAGS)
+
+# librave needs proj
+# libhlhdf needs hdf5
+# librsl needs -lbz2 -lz
 
-# conditional linking of some dependencies needed eventually since Rtools42
 ifeq (,$(shell pkg-config --version 2>/dev/null))
     LIBSHARPYUV = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libsharpyuv.a),-lsharpyuv),)
     LIBDEFLATE = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libdeflate.a),-ldeflate),)
     LIBLERC = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/liblerc.a),-llerc),)
     LIBPSL = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libpsl.a),-lpsl),)
     LIBBROTLI = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libbrotlidec.a),-lbrotlidec -lbrotlicommon),)
+    PKG_LIBS = -lproj -lsqlite3 -lcurl -lbcrypt -ltiff -ljpeg -lrtmp -lssl -lssh2 -lgcrypt \
+               -lcrypto -lgdi32 -lz -lzstd -lwebp -llzma -lgdi32 -lcrypt32 \
+               -lidn2 $(LIBPSL) -lunistring -liconv -lgpg-error -lws2_32 -lwldap32 -lwinmm \
+               -lstdc++ $(LIBBROTLI) $(LIBLERC) $(LIBSHARPYUV) $(LIBDEFLATE) \
+               -lhdf5 -lm -ldl -lws2_32 -lwsock32 -lbz2 -lz -lsz
 else
-    # FIXME: it would make sense to rewrite all of the above to use pkg-config
-    PDEPS = $(shell pkg-config --libs libcurl libtiff-4)
+    PKG_LIBS = $(shell pkg-config --libs hdf5 proj) -lbz2 -lz
+    PKG_CPPFLAGS += $(shell pkg-config --cflags proj hdf5)
 endif
 
-PKG_LIBS=-lpthread $(HDF5_LIBS) -lbz2  -lz  -ldl -lm $(PROJ_LIBS) $(LIBBROTLI) $(LIBBROTLI) $(LIBBROTLI) $(LIBLERC) $(LIBSHARPYUV) $(LIBDEFLATE) $(PDEPS)
-
-PKG_CPPFLAGS=-D__USE_MINGW_ANSI_STDIO $(H5_API_CFLAGS)
-
 PKG_CPPFLAGS+= -I. -I./includes -I./includes/libvol2bird -I./includes/libmistnet -I./includes/librave -I./includes/libhlhdf -I./includes/librsl -I./includes/libiris2odim
 
 # VOL2BIRD flags
diff -Nru orig/vol2birdR/tools/get_h5_api_cflags.R patched/vol2birdR/tools/get_h5_api_cflags.R
--- orig/vol2birdR/tools/get_h5_api_cflags.R	2023-06-01 21:02:06.000000000 +0200
+++ patched/vol2birdR/tools/get_h5_api_cflags.R	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-if (pkgbuild::has_rtools()) {
-  ver<-pkgbuild::rtools_needed()
-  CFLAGS<-""
-  if (ver != "Rtools 4.0") {
-    CFLAGS<-"-DH5_USE_110_API"
-  }
-  cat(CFLAGS)
-  quit("no", status=0)
-}
-quit("no", status=127)
-
diff -Nru orig/vol2birdR/tools/get_hdf5_libraries.R patched/vol2birdR/tools/get_hdf5_libraries.R
--- orig/vol2birdR/tools/get_hdf5_libraries.R	2023-06-01 21:02:06.000000000 +0200
+++ patched/vol2birdR/tools/get_hdf5_libraries.R	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-if (pkgbuild::has_rtools()) {
-  ver<-pkgbuild::rtools_needed()
-  LIBS<-"-lhdf5 -lwsock32 -lz -lsz -lm -ldl -lws2_32"
-  if (ver == "Rtools 4.0") {
-    LIBS<-"-lhdf5 -lz"
-  }
-  cat(LIBS)
-  quit("no", status=0)
-}
-quit("no", status=127)
-
diff -Nru orig/vol2birdR/tools/get_proj_libraries.R patched/vol2birdR/tools/get_proj_libraries.R
--- orig/vol2birdR/tools/get_proj_libraries.R	2024-07-09 00:52:45.000000000 +0200
+++ patched/vol2birdR/tools/get_proj_libraries.R	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-if (pkgbuild::has_rtools()) {
-  ver<-pkgbuild::rtools_needed()
-  LIBS<-"-lproj -lsqlite3 -lz -ldl -ltiff -lwebp -lzstd -llzma -ljpeg -lz -lcurl -lidn2 -lunistring -liconv -lcharset -lssh2 -lgcrypt -lgpg-error -lws2_32 -lgcrypt -lgpg-error -lws2_32 -lz -ladvapi32 -lcrypt32 -lssl -lcrypto -lssl -lz -lws2_32 -lgdi32 -lcrypt32 -lcrypto -lbcrypt -lz -lws2_32 -lgdi32 -lcrypt32 -lgdi32 -lwldap32 -lzstd -lz -lws2_32 -lpthread -lstdc++"
-  if (ver == "Rtools 4.0") {
-    LIBS<-"-lproj -lsqlite3 -lz -ltiff -ljpeg -lz -lcurl -lnormaliz -lssh2 -lcrypt32 -lgdi32 -lws2_32 -lcrypt32 -lgdi32 -lws2_32 -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -lz -lssl -lcrypto -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -lgdi32 -lcrypt32 -lwldap32 -lz -lws2_32 -lstdc++"
-  }
-  cat(LIBS)
-  quit("no", status=0)
-}
-quit("no", status=127)    
-
