summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarge Bot <marge-bot@gnome.org>2021-07-08 16:45:24 +0000
committerMarge Bot <marge-bot@gnome.org>2021-07-08 16:45:24 +0000
commit169ab91a2726ad5dd70b708cb423fac85a4bf307 (patch)
tree44ba309a340e87e587b9831465df178e0757b94c
parentfc0dcc9d0d013a3919f981addf867b756983c8fe (diff)
parentf7d39d431f1783bb3fc70b21f70a3312cef730aa (diff)
downloadlibrsvg-169ab91a2726ad5dd70b708cb423fac85a4bf307.tar.gz
Merge branch 'master.msvc' into 'master'
Fix building latest GIT master on Windows See merge request GNOME/librsvg!565
-rw-r--r--.gitignore4
-rw-r--r--Cargo.toml18
-rw-r--r--src/bin/rsvg-convert.rs8
-rw-r--r--win32/Makefile.am1
-rw-r--r--win32/Makefile.vc2
-rw-r--r--win32/README.txt46
-rw-r--r--win32/build-rules-msvc.mak64
-rw-r--r--win32/config-msvc.mak.in29
-rw-r--r--win32/create-lists-msvc.mak22
-rw-r--r--win32/generate-msvc.mak27
-rw-r--r--win32/info-msvc.mak2
-rw-r--r--win32/install-msvc.mak5
-rw-r--r--win32/librsvg.symbols58
-rw-r--r--win32/rsvg-rust.mak46
14 files changed, 203 insertions, 129 deletions
diff --git a/.gitignore b/.gitignore
index de909c2a..fcdd8e61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,10 @@ tests/rsvg-test
tests/*.log
tests/*.trs
win32/config-msvc.mak
+win32/*.bat
+win32/vs12
+win32/vs14
+win32/__pycache__
Rsvg-2.0.gir
Rsvg-2.0.typelib
librsvg-2.0.vapi
diff --git a/Cargo.toml b/Cargo.toml
index e74794ef..9afb5480 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,27 +6,33 @@ build = "build.rs"
edition = "2018"
[package.metadata.system-deps]
-cairo = "1.16"
-cairo-gobject = "1.16"
cairo-pdf = { version = "1.16", optional = true }
-cairo-png = "1.16"
cairo-ps = { version = "1.16", optional = true }
cairo-svg = { version = "1.16", optional = true }
-freetype2 = "20.0.14"
gdk-pixbuf = { name = "gdk-pixbuf-2.0", version = "2.20" }
gio = { name = "gio-2.0", version = "2.24" }
glib = { name = "glib-2.0", version = "2.50" }
-harfbuzz = "2.0"
-libxml2 = { name = "libxml-2.0", version = "2.9" }
pangocairo = "1.44"
[package.metadata.system-deps.'cfg(windows)']
fontconfig = { version = "1.7", optional = true }
pangoft2 = { version = "1.44", optional = true }
+harfbuzz = { version = "2.0", optional = true }
+freetype2 = { version = "20.0.14", optional = true }
+cairo = { version = "1.16", optional = true }
+cairo-gobject = { version = "1.16", optional = true }
+cairo-png = { version = "1.16", optional = true }
+libxml2 = { name = "libxml-2.0", version = "2.9", optional = true }
[package.metadata.system-deps.'cfg(not(windows))']
fontconfig = { version = "1.7" }
pangoft2 = { version = "1.44" }
+cairo = "1.16"
+cairo-gobject = "1.16"
+cairo-png = "1.16"
+harfbuzz = "2.0"
+freetype2 = "20.0.14"
+libxml2 = { name = "libxml-2.0", version = "2.9" }
[lib]
name = "librsvg"
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index cd1a699e..589f583f 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -9,7 +9,7 @@ use gio::{UnixInputStream, UnixOutputStream};
#[cfg(windows)]
mod windows_imports {
- pub use gio::ffi::{GInputStream, GOutputStream};
+ pub use gio::{Win32InputStream, Win32OutputStream};
pub use glib::ffi::gboolean;
pub use glib::translate::*;
pub use libc::c_void;
@@ -357,7 +357,8 @@ impl Stdin {
#[cfg(windows)]
pub fn stream() -> InputStream {
- Win32InputStream::with_handle(io::stdin()).upcast::<InputStream>()
+ let stream = unsafe { Win32InputStream::with_handle(io::stdin()) };
+ stream.upcast::<InputStream>()
}
}
@@ -372,7 +373,8 @@ impl Stdout {
#[cfg(windows)]
pub fn stream() -> OutputStream {
- Win32InputStream::with_handle(io::stdout()).upcast::<OutputStream>()
+ let stream = unsafe { Win32OutputStream::with_handle(io::stdout()) };
+ stream.upcast::<OutputStream>()
}
}
diff --git a/win32/Makefile.am b/win32/Makefile.am
index c3067577..8e31f91a 100644
--- a/win32/Makefile.am
+++ b/win32/Makefile.am
@@ -11,6 +11,7 @@ EXTRA_DIST = \
info-msvc.mak \
install-msvc.mak \
introspection-msvc.mak \
+ librsvg.symbols \
Makefile.vc \
README.txt \
rsvg-rust.mak \
diff --git a/win32/Makefile.vc b/win32/Makefile.vc
index e4d315e8..80d27c0a 100644
--- a/win32/Makefile.vc
+++ b/win32/Makefile.vc
@@ -32,7 +32,7 @@ VALID_MSC = TRUE
# Include the Makefile portion to convert the source and header lists
# into the lists we need for compilation and introspection
-all: $(RSVG_TOOLS) $(RSVG_EXTRA_TOOLS) $(EXTRA_TARGETS) build-info-librsvg
+all: $(RSVG_TOOLS) $(EXTRA_TARGETS) build-info-librsvg
# Include the build rules for Rust builds, sources, DLLs and executables
!include rsvg-rust.mak
diff --git a/win32/README.txt b/win32/README.txt
index 231e2a6d..3aafd01c 100644
--- a/win32/README.txt
+++ b/win32/README.txt
@@ -25,6 +25,10 @@ You will also need the following tools:
matches the architecture that is being built. It is recommended to use the
'rustup' tool from https://www.rust-lang.org/ to install and configure
Rust, which will install Rust in %HOMEPATH%\.cargo by default.
+-pkg-config tool (or something that is compatible, set via PKG_CONFIG
+ in the NMake command line if cross-compiling, or if in a non-standard
+ location). PKG_CONFIG_PATH in the NMake command line is also supported,
+ for similar reasons.
-Python (optional, recommended, to generate the pkg-config files and
build the introspection files; if building the introspection files, the
Python installation must match the version, architecture and configuration
@@ -34,11 +38,11 @@ You will also need the following tools:
system where the build is being carried out. This means, specifically,
introspection files for ARM64 builds are not currently supported also due to a
lack of an official native ARM64 Python build.
--For introspection builds, the pkg-config (or compatible) tool is also needed
- and the introspection files and pkg-config files for the dependent libraries
- (if applicable) are also needed. You will need to set PKG_CONFIG_PATH
- if the pkg-config files cannot be found from the default locations that
- pkg-config will look for.
+-For introspection builds, the introspection files and pkg-config
+ files for the dependent libraries (if applicable) are also needed.
+ You will need to set or pass in PKG_CONFIG_PATH if the pkg-config
+ files cannot be found from the default locations that pkg-config will
+ look for.
It is now possible to cross-compile librsvg for ARM64 Windows, as well as for
x64 Windows on 32-bit or ARM64 Windows systems, using this set of NMake Makefiles.
@@ -107,19 +111,25 @@ for all targets.
BINDIR\..\lib\gobject-introspection and the dependent introspection files are
looked for in BINDIR\..\share\gir-1.0 and BINDIR\..\lib\girepository-1.0
respectively for .gir files and .typelib files.
--PYTHON: Path to your Python interpreter executable, if not already in your %PATH% or
- using a different installation of Python is desired. Please see note above
- on Python usage. If Python cannot be found, you will not be able to build
- introspection files and the librsvg-2.0.pc pkg-config file will not be
- generated using the 'install' build target.
--PKG_CONFIG: Path to your pkg-config (or compatible) tool, if not already in your
- %PATH%. This is required for introspection builds.
--LIBINTL_LIB: Full file name of your gettext-runtime library .lib file, if it is not
- intl.lib. This should be in the directories indicated by %LIB% or in
- $(LIBDIR), or should be passed in with the full path. Note that its
- DLL, if applicable, should be found in %PATH% or in $(BINDIR) as well,
- for building the introspection files or for creating the GDK-Pixbuf
- loaders cache file.
+-PYTHON: Path to your Python interpreter executable, if not already in
+ your %PATH% or using a different installation of Python is
+ desired. Please see note above on Python usage. If Python
+ cannot be found, you will not be able to build
+ introspection files and the librsvg-2.0.pc pkg-config file will
+ not be generated using the 'install' build target.
+-PKG_CONFIG: Path to your pkg-config (or compatible) tool, if not
+ already in your %PATH%. This is required for introspection
+ builds.
+-LIBINTL_LIB: Full file name of your gettext-runtime, libxml2, FreeType
+ LIBXML2_LIB: and/or HarfBuzz library .lib file, if not intl.lib,
+ HARFBUZZ_LIB: libxml2.lib, harfbuzz.lib and freetype.lib
+ FREETYPE_LIB: respectively. These should be in the directories
+ indicated by %LIB% or in $(LIBDIR), or should be passed in
+ with the full path.
+ Note that their DLLs, if applicable, should be found in
+ %PATH% or in $(BINDIR) as well, for building the
+ introspection files or for creating the GDK-Pixbuf
+ loaders cache file.
<other_options> is as follows, activate the options using <option>=1:
-INTROSPECTION: Build the introspection files. Please see notes above.
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
index 2200a183..a1ec221c 100644
--- a/win32/build-rules-msvc.mak
+++ b/win32/build-rules-msvc.mak
@@ -13,32 +13,21 @@
# $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
# $<
# <<
-{..\librsvg\}.c{$(OUTDIR)\librsvg\}.obj:
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
+{$(OUTDIR)\librsvg\}.c{$(OUTDIR)\librsvg\}.obj:
$(CC) $(LIBRSVG_CFLAGS) $(LIBRSVG_INCLUDES) /Fo$(@D)\ /Fd$(@D)\ /c @<<
$<
<<
{..\gdk-pixbuf-loader\}.c{$(OUTDIR)\rsvg-gdk-pixbuf-loader\}.obj:
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
+ @if not exist $(@D)\ mkdir $(@D)
+ @if not exist $(@D)\..\librsvg\config.h copy .\config.h.win32 $(@D)\..\librsvg\config.h
$(CC) $(RSVG_PIXBUF_LOADER_CFLAGS) $(TOOLS_DEP_INCLUDES) /Fo$(@D)\ /Fd$(@D)\ /c @<<
$<
<<
-{..\}.c{$(OUTDIR)\rsvg-tools\}.obj:
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
- $(CC) $(BASE_CFLAGS) $(TOOLS_DEP_INCLUDES) /Fo$(@D)\ /Fd$(@D)\ /c @<<
-$<
-<<
-
-{..\tools\}.c{$(OUTDIR)\rsvg-tools\}.obj:
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
- $(CC) $(BASE_CFLAGS) $(LIBRSVG_LOG_DOMAIN) $(TOOLS_DEP_INCLUDES) /Fo$(@D)\ /Fd$(@D)\ /c @<<
-$<
-<<
-
{..\tests\}.c{$(OUTDIR)\rsvg-tests\}.obj:
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
+ @if not exist $(@D)\ mkdir $(@D)
+ @if not exist $(@D)\..\librsvg\config.h copy .\config.h.win32 $(@D)\..\librsvg\config.h
$(CC) $(TEST_CFLAGS) $(LIBRSVG_LOG_DOMAIN) $(TOOLS_DEP_INCLUDES) /Fo$(@D)\ /Fd$(@D)\ /c @<<
$<
<<
@@ -53,19 +42,17 @@ $(LIBRSVG_LIB): $(LIBRSVG_DLL)
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(LIBRSVG_DLL): \
-$(RSVG_INTERNAL_LIB) \
-$(OUTDIR)\librsvg\config.h \
-$(librsvg_OBJS)
- link /DLL $(LDFLAGS) \
- $(LIBRSVG_DEP_LIBS) \
+$(LIBRSVG_DLL): $(RSVG_INTERNAL_LIB) $(librsvg_OBJS) $(LIBRSVG_DEF)
+ link /DLL $(LDFLAGS) $(LIBRSVG_DEP_LIBS) \
/implib:$(LIBRSVG_LIB) \
- -out:$@ @<<
+ -out:$@ /def:$(LIBRSVG_DEF) @<<
$(librsvg_OBJS)
<<
@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(GDK_PIXBUF_SVG_LOADER): $(LIBRSVG_LIB) $(OUTDIR)\rsvg-gdk-pixbuf-loader\io-svg.obj
+$(GDK_PIXBUF_SVG_LOADER): \
+$(LIBRSVG_LIB) \
+$(OUTDIR)\rsvg-gdk-pixbuf-loader\io-svg.obj
link /DLL $(LDFLAGS) $** $(BASE_DEP_LIBS) /out:$@
@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
@@ -76,23 +63,10 @@ $(GDK_PIXBUF_SVG_LOADER): $(LIBRSVG_LIB) $(OUTDIR)\rsvg-gdk-pixbuf-loader\io-svg
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-$(OUTDIR)\rsvg-convert.exe: $(LIBRSVG_LIB) $(OUTDIR)\rsvg-tools\rsvg-convert.obj
-
-$(OUTDIR)\rsvg-dimensions.exe: \
- $(LIBRSVG_LIB) \
- $(OUTDIR)\rsvg-tools\rsvg-dimensions.obj \
- $(OUTDIR)\rsvg-tools\rsvg-tools-main.obj
-
-$(OUTDIR)\test-performance.exe: \
- $(LIBRSVG_LIB) \
- $(OUTDIR)\rsvg-tools\test-performance.obj \
- $(OUTDIR)\rsvg-tools\rsvg-tools-main.obj
-
-$(OUTDIR)\rsvg-convert.exe \
-$(OUTDIR)\rsvg-dimensions.exe \
-$(OUTDIR)\test-performance.exe:
- link $(LDFLAGS) $** $(TOOLS_DEP_LIBS) /out:$@
- @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+$(OUTDIR)\rsvg-convert.exe: \
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe
+ @copy /b $** $@
+ @if exist $(**D)\rsvg_convert.pdb copy /b $(**D)\rsvg_convert.pdb $(@D)
# Include the rules for the test programs
!include rsvg_tests_rules.mak
@@ -141,26 +115,24 @@ clean:
@if exist $(OUTDIR)\Rsvg-$(RSVG_API_VER).gir del /f /q $(OUTDIR)\Rsvg-$(RSVG_API_VER).gir
@-del /f /q $(OUTDIR)\*.dll
@-del /f /q $(OUTDIR)\*.exe
- @-del /f /q $(OUTDIR)\*.dll
@-del /f /q $(OUTDIR)\*.pdb
@-del /f /q $(OUTDIR)\*.ilk
@-del /f /q $(OUTDIR)\*.exp
@-del /f /q $(OUTDIR)\*.lib
@-del /s /q $(OUTDIR)\rsvg-tests\*.obj
@-del /s /q $(OUTDIR)\rsvg-tests\*.pdb
- @-del /s /q $(OUTDIR)\rsvg-tools\*.obj
- @-del /s /q $(OUTDIR)\rsvg-tools\*.pdb
@-del /s /q $(OUTDIR)\rsvg-gdk-pixbuf-loader\*.obj
@-del /s /q $(OUTDIR)\rsvg-gdk-pixbuf-loader\*.pdb
- @-del /s /q $(OUTDIR)\rsvg-tools\*.pdb
@-del /s /q $(OUTDIR)\librsvg\Rsvg_2_0_gir_list
@-del /s /q $(OUTDIR)\librsvg\*.obj
@-del /s /q $(OUTDIR)\librsvg\*.pdb
+ @-del /s /q $(OUTDIR)\librsvg\_rsvg_dummy.c
+ @-del /s /q $(OUTDIR)\librsvg\config.h
@-rmdir /s /q $(OUTDIR)\output
@-rmdir /s /q output
@-rmdir /s /q $(OUTDIR)\rsvg-tests
- @-rmdir /s /q $(OUTDIR)\rsvg-tools
@-rmdir /s /q $(OUTDIR)\rsvg-gdk-pixbuf-loader
@-rmdir /s /q $(OUTDIR)\librsvg
$(MAKE) /f rsvg-rust.mak CFG=$(CFG) cargo-clean
@-rmdir /s /q $(OUTDIR)\obj
+ @-del build-$(PLAT)-$(CFG)*.bat
diff --git a/win32/config-msvc.mak.in b/win32/config-msvc.mak.in
index 8568c061..4c42f753 100644
--- a/win32/config-msvc.mak.in
+++ b/win32/config-msvc.mak.in
@@ -20,11 +20,24 @@ LIBDIR=$(PREFIX)\lib
INCLUDEDIR=$(PREFIX)\include
!endif
-# Make import lib of gettext-runtime configurable
+# Make import libs of gettext-runtime, FreeType
+# HarfBuzz and libxml2 configurable
!ifndef LIBINTL_LIB
LIBINTL_LIB = intl.lib
!endif
+!ifndef FREETYPE_LIB
+FREETYPE_LIB = freetype.lib
+!endif
+
+!ifndef HARFBUZZ_LIB
+HARFBUZZ_LIB = harfbuzz.lib
+!endif
+
+!ifndef LIBXML2_LIB
+LIBXML2_LIB = libxml2.lib
+!endif
+
LDFLAGS = $(LDFLAGS) /libpath:$(LIBDIR)
# These are the base minimum libraries required for building librsvg.
@@ -58,6 +71,9 @@ BASE_DEP_LIBS = \
gobject-2.0.lib \
glib-2.0.lib \
cairo.lib \
+ $(HARFBUZZ_LIB) \
+ $(FREETYPE_LIB) \
+ $(LIBXML2_LIB) \
$(LIBINTL_LIB)
LIBRSVG_LOG_DOMAIN = /DG_LOG_DOMAIN=\"librsvg\"
@@ -70,7 +86,7 @@ LIBRSVG_CFLAGS = \
/DRSVG_API=__declspec(dllexport)
LIBRSVG_INCLUDES = \
- /I.. \
+ /I..\include \
/I.\$(OUTDIR)\librsvg \
$(BASE_DEP_INCLUDES) \
/I$(INCLUDEDIR)\libxml2
@@ -90,7 +106,7 @@ TEST_DEP_LIBS = \
fontconfig.lib
!endif
-RSVG_INTERNAL_LIB = $(OUTDIR)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg_c_api.lib
+RSVG_INTERNAL_LIB = $(OUTDIR)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\librsvg.lib
LIBRSVG_DEP_LIBS = \
$(RSVG_INTERNAL_LIB) \
@@ -117,11 +133,12 @@ LIBRSVG_DLL_FILENAME = $(OUTDIR)\rsvg-$(RSVG_API_VER)-vs$(VSVER)
LIBRSVG_DLL = $(LIBRSVG_DLL_FILENAME).dll
LIBRSVG_LIB = $(OUTDIR)\rsvg-$(RSVG_API_VER).lib
+LIBRSVG_DEF = $(OUTDIR)\librsvg\librsvg.def
GDK_PIXBUF_SVG_LOADER = $(OUTDIR)\libpixbufloader-svg.dll
TOOLS_DEP_INCLUDES = \
- /I.. \
+ /I..\include \
/I.\$(OUTDIR)\librsvg \
$(BASE_DEP_INCLUDES)
@@ -129,10 +146,6 @@ TOOLS_DEP_LIBS = $(BASE_DEP_LIBS)
RSVG_TOOLS = $(OUTDIR)\rsvg-convert.exe
-RSVG_EXTRA_TOOLS = \
- $(OUTDIR)\rsvg-dimensions.exe \
- $(OUTDIR)\test-performance.exe
-
# Build Introspection if requested
EXTRA_TARGETS = $(GDK_PIXBUF_SVG_LOADER)
!ifdef INTROSPECTION
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
index 06541a84..97087fdf 100644
--- a/win32/create-lists-msvc.mak
+++ b/win32/create-lists-msvc.mak
@@ -35,28 +35,10 @@ NULL=
# For librsvg
-!if [call create-lists.bat header rsvg_objs.mak librsvg_real_SRCS]
-!endif
-
-!if [for %s in ($(librsvg_c_srcs:/=\)) do @call create-lists.bat file rsvg_objs.mak ..\%s]
-!endif
-
-!if [call create-lists.bat footer rsvg_objs.mak]
-!endif
-
!if [call create-lists.bat header rsvg_objs.mak librsvg_real_pub_HDRS]
!endif
-!if [for %s in ($(headers:/=\)) do @call create-lists.bat file rsvg_objs.mak ..\%s]
-!endif
-
-!if [call create-lists.bat footer rsvg_objs.mak]
-!endif
-
-!if [call create-lists.bat header rsvg_objs.mak librsvg_real_extra_pub_HDRS]
-!endif
-
-!if [for %s in ($(extra_inc_headers:/=\)) do @call create-lists.bat file rsvg_objs.mak ..\%s]
+!if [for %s in ($(librsvg_public_headers:/=\)) do @call create-lists.bat file rsvg_objs.mak ..\%s]
!endif
!if [call create-lists.bat footer rsvg_objs.mak]
@@ -65,7 +47,7 @@ NULL=
!if [call create-lists.bat header rsvg_objs.mak librsvg_OBJS]
!endif
-!if [for %c in ($(librsvg_c_srcs:/=\)) do @if "%~xc" == ".c" @call create-lists.bat file rsvg_objs.mak ^$(OUTDIR)\librsvg\%~nc.obj]
+!if [for %c in ($(OUTDIR)\librsvg\_rsvg_dummy.c) do @if "%~xc" == ".c" @call create-lists.bat file rsvg_objs.mak ^$(OUTDIR)\librsvg\%~nc.obj]
!endif
!if [call create-lists.bat footer rsvg_objs.mak]
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index ed22a20e..2acbd65a 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -3,23 +3,18 @@
# Items in here should not need to be edited unless
# one is maintaining the NMake build files.
-# Copy the pre-defined config.h.win32
-$(OUTDIR)\librsvg\config.h: config.h.win32
- @if not exist $(@D) $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)
- @-copy $** $@
+$(OUTDIR)\librsvg\_rsvg_dummy.c:
+ @echo Generating dummy source file...
+ @if not exist $(@D)\ mkdir $(@D)
+ echo static int __rsvg_dummy; > $@
-# Create the build directories
-$(OUTDIR)\librsvg \
-$(OUTDIR)\rsvg-gdk-pixbuf-loader \
-$(OUTDIR)\rsvg-tools \
-$(OUTDIR)\rsvg-tests:
- @-mkdir $@
+$(OUTDIR)\librsvg\librsvg.def: .\librsvg.symbols
+ @echo Generating $@...
+ @if not exist $(@D)\ mkdir $(@D)
+ @echo EXPORTS>$@
+ $(CC) /EP $**>>$@
# Generate listing file for introspection
-$(OUTDIR)\librsvg\Rsvg_2_0_gir_list: \
-$(librsvg_real_pub_HDRS) \
-$(librsvg_real_extra_pub_HDRS) \
-$(librsvg_real_SRCS)
+$(OUTDIR)\librsvg\Rsvg_2_0_gir_list: $(librsvg_real_pub_HDRS)
@if exist $@ del $@
- @for %%s in ($(librsvg_real_pub_HDRS) $(librsvg_real_extra_pub_HDRS)) do echo %%s >> $@
- @for %%s in ($(librsvg_real_SRCS)) do @if "%%~xs" == ".c" echo %%s >> $@
+ @for %%s in ($**) do echo %%s >> $@
diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak
index 0ad8f212..631b3d9f 100644
--- a/win32/info-msvc.mak
+++ b/win32/info-msvc.mak
@@ -20,7 +20,7 @@ build-info-librsvg:
@echo Build Type: $(BUILD_TYPE)
@echo.
@echo Built Tools:
- @for %%t in ($(RSVG_TOOLS:.exe=) $(RSVG_EXTRA_TOOLS:.exe=)) do @echo %%~nt
+ @for %%t in ($(RSVG_TOOLS:.exe=)) do @echo %%~nt
@echo.
@echo Introspection: $(BUILD_INTROSPECTION)
diff --git a/win32/install-msvc.mak b/win32/install-msvc.mak
index 06252de0..0b541bd9 100644
--- a/win32/install-msvc.mak
+++ b/win32/install-msvc.mak
@@ -8,8 +8,9 @@ install: all
@for %%x in (dll pdb) do @copy /b $(LIBRSVG_DLL_FILENAME).%%x $(PREFIX)\bin
@copy /b $(LIBRSVG_LIB) $(PREFIX)\lib
@for %%x in (dll pdb) do @copy /b $(OUTDIR)\libpixbufloader-svg.%%x $(PREFIX)\lib\gdk-pixbuf-2.0\2.10.0\loaders
- @for %%f in ($(RSVG_TOOLS)) do @(for %%x in (exe pdb) do @copy %%~dpnf.%%x $(PREFIX)\bin)
- @for %%h in ($(librsvg_real_pub_HDRS) $(librsvg_real_extra_pub_HDRS)) do @copy %%h $(PREFIX)\include\librsvg-$(RSVG_API_VER)\librsvg\%%h
+ @copy $(OUTDIR)\rsvg-convert.exe $(PREFIX)\bin
+ @-copy $(OUTDIR)\rsvg_convert.pdb $(PREFIX)\bin
+ @for %%h in ($(librsvg_real_pub_HDRS)) do @copy %%h $(PREFIX)\include\librsvg-$(RSVG_API_VER)\librsvg\%%~nxh
@set PATH=$(PREFIX)\bin;$(BINDIR);$(PATH)
@-gdk-pixbuf-query-loaders > loaders.cache
@for %%f in (loaders.cache) do @if %%~zf equ 0 echo *** GDK-Pixbuf loaders cache is not generated. Run `gdk-pixbuf-query-loaders` in your ^$(PREFIX)\bin to generate it.
diff --git a/win32/librsvg.symbols b/win32/librsvg.symbols
new file mode 100644
index 00000000..eabf6d2c
--- /dev/null
+++ b/win32/librsvg.symbols
@@ -0,0 +1,58 @@
+/* symbols from rsvg.h */
+rsvg_cleanup
+rsvg_error_quark
+rsvg_error_get_type
+rsvg_handle_close
+rsvg_handle_flags_get_type
+rsvg_handle_free
+rsvg_handle_get_base_uri
+rsvg_handle_get_desc
+rsvg_handle_get_dimensions
+rsvg_handle_get_dimensions_sub
+rsvg_handle_get_intrinsic_dimensions
+rsvg_handle_get_intrinsic_size_in_pixels
+rsvg_handle_get_metadata
+rsvg_handle_get_pixbuf
+rsvg_handle_get_pixbuf_sub
+rsvg_handle_get_position_sub
+rsvg_handle_get_title
+rsvg_handle_get_type
+rsvg_handle_has_sub
+rsvg_handle_internal_set_testing
+rsvg_handle_new_from_data
+rsvg_handle_new
+rsvg_handle_new_from_file
+rsvg_handle_new_from_gfile_sync
+rsvg_handle_new_from_stream_sync
+rsvg_handle_new_with_flags
+rsvg_handle_read_stream_sync
+rsvg_handle_set_base_gfile
+rsvg_handle_set_base_uri
+rsvg_handle_set_dpi
+rsvg_handle_set_dpi_x_y
+rsvg_handle_set_size_callback
+rsvg_handle_set_stylesheet
+rsvg_handle_write
+rsvg_init
+rsvg_pixbuf_from_file
+rsvg_pixbuf_from_file_at_zoom
+rsvg_pixbuf_from_file_at_size
+rsvg_pixbuf_from_file_at_max_size
+rsvg_pixbuf_from_file_at_zoom_with_max
+rsvg_set_default_dpi
+rsvg_set_default_dpi_x_y
+rsvg_term
+
+/* symbols from rsvg-cairo.h */
+rsvg_handle_get_geometry_for_element
+rsvg_handle_get_geometry_for_layer
+rsvg_handle_render_cairo
+rsvg_handle_render_cairo_sub
+rsvg_handle_render_document
+rsvg_handle_render_element
+rsvg_handle_render_layer
+
+/* symbols from rsvg-features.h */
+rsvg_major_version
+rsvg_micro_version
+rsvg_minor_version \ No newline at end of file
diff --git a/win32/rsvg-rust.mak b/win32/rsvg-rust.mak
index 91bd798b..722f1eec 100644
--- a/win32/rsvg-rust.mak
+++ b/win32/rsvg-rust.mak
@@ -43,9 +43,9 @@ DEFAULT_TARGET = stable-$(RUST_TARGET)-pc-windows-msvc
RUSTUP_CMD = $(RUSTUP) default $(DEFAULT_TARGET)
!if "$(CFG)" == "release" || "$(CFG)" == "Release"
-CARGO_CMD = $(CARGO) build $(CARGO_TARGET) --release
+CARGO_CMD = $(CARGO) --locked build $(CARGO_TARGET) --release
!else
-CARGO_CMD = $(CARGO) build $(CARGO_TARGET)
+CARGO_CMD = $(CARGO) --locked build $(CARGO_TARGET)
!endif
# For building the Rust bits for ARM64 Windows, or when we are building on
@@ -55,7 +55,7 @@ CARGO_CMD = $(CARGO) build $(CARGO_TARGET)
# and the calls to cargo and therefore rustc in a temporary .bat file and use
# 'start /i ...' to call that .bat file
!if $(FORCE_CROSS) > 0
-build-$(PLAT)-$(CFG).bat:
+build-$(PLAT)-$(CFG).pre.bat:
@echo @echo off>$@
@echo set CommandPromptType=>>$@
@echo set DevEnvDir=>>$@
@@ -93,10 +93,24 @@ build-$(PLAT)-$(CFG).bat:
@echo if "$(__VSCMD_PREINIT_PATH)" == "" set PATH=c:\Windows\system;c:\Windows;c:\Windows\system32\wbem;%HOMEPATH%\.cargo\bin>>$@
@echo set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api>>$@
@echo set GTK_LIB_DIR=$(LIBDIR)>>$@
+ @echo set SYSTEM_DEPS_LIBXML2_LIB=$(LIBXML2_LIB:.lib=)>>$@
+ @if not "$(PKG_CONFIG_PATH)" == "" echo set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)>>$@
+ @if not "$(PKG_CONFIG)" == "" echo set PKG_CONFIG=$(PKG_CONFIG)>>$@
@echo cd ..>>$@
- @echo $(CARGO_CMD) --verbose>>$@
-vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg_c_api.lib: build-$(PLAT)-$(CFG).bat
+build-$(PLAT)-$(CFG)-lib.bat: build-$(PLAT)-$(CFG).pre.bat
+ @type $**>$@
+ @echo $(CARGO_CMD) --verbose --lib>>$@
+
+build-$(PLAT)-$(CFG)-bin.bat: build-$(PLAT)-$(CFG).pre.bat
+ @type $**>$@
+ @echo $(CARGO_CMD) --verbose --bin rsvg-convert>>$@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\librsvg.lib: build-$(PLAT)-$(CFG)-lib.bat
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe: build-$(PLAT)-$(CFG)-bin.bat
+
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\librsvg.lib \
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe:
@echo Please do not manually close the command window that pops up...
@echo.
@echo If this fails due to LNK1112 or a linker executable cannot be found, run
@@ -104,16 +118,32 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\r
@echo and then run 'start /i /wait cmd /c $**', and then continue
@echo the build with your original NMake command line.
@start "Building the Rust bits for $(PLAT) Windows MSVC Build, please do not close this console window..." /wait /i cmd /c $**
- @del /f/q $**
!else
-vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg_c_api.lib:
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\librsvg.lib:
+ @set PATH=%PATH%;%HOMEPATH%\.cargo\bin
+ @set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api
+ @set GTK_LIB_DIR=$(LIBDIR);$(LIB)
+ @set SYSTEM_DEPS_LIBXML2_LIB=$(LIBXML2_LIB:.lib=)
+ @if not "$(PKG_CONFIG_PATH)" == "" set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+ @if not "$(PKG_CONFIG)" == "" set PKG_CONFIG=$(PKG_CONFIG)
+ $(RUSTUP_CMD)
+ @cd ..
+ $(CARGO_CMD) --verbose --lib
+ @cd win32
+ @set GTK_LIB_DIR=
+ @set CARGO_TARGET_DIR=
+
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe:
@set PATH=%PATH%;%HOMEPATH%\.cargo\bin
@set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api
@set GTK_LIB_DIR=$(LIBDIR);$(LIB)
+ @set SYSTEM_DEPS_LIBXML2_LIB=$(LIBXML2_LIB:.lib=)
+ @if not "$(PKG_CONFIG_PATH)" == "" set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+ @if not "$(PKG_CONFIG)" == "" set PKG_CONFIG=$(PKG_CONFIG)
$(RUSTUP_CMD)
@cd ..
- $(CARGO_CMD) --verbose
+ $(CARGO_CMD) --verbose --bin $(@B)
@cd win32
@set GTK_LIB_DIR=
@set CARGO_TARGET_DIR=