[librsvg/cargo-c-msvc: 10/10] NMake Makefiles: Update for cargo-c usage
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/cargo-c-msvc: 10/10] NMake Makefiles: Update for cargo-c usage
- Date: Fri, 9 Jul 2021 04:42:36 +0000 (UTC)
commit 7962e0435049d8d1a270b19d8446f5cd3de1f6b7
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Jul 9 12:38:50 2021 +0800
NMake Makefiles: Update for cargo-c usage
This updates the Visual Studio build files to build librsvg after it has
been updated to use cargo-c to build the C libraries, and, as a
side-effect, static builds are now supported as well at the same time.
As a convenience, we still provide rsvg-2.0-vsXX.dll resulting from the
builds for people that aren't able to re-link their applications against
rsvg-2.dll (the DLL file name that results from the cargo-c updates),
but a warning message is shown upon 'install' that people are advised to
re-compile their applications if possible, since rsvg-2.0.lib now links
to rsvg-2.dll.
win32/Makefile.vc | 2 +-
win32/build-rules-msvc.mak | 21 +++++++++------------
win32/config-msvc.mak.in | 4 ++--
win32/generate-msvc.mak | 14 ++------------
win32/install-msvc.mak | 12 +++++++++++-
win32/rsvg-rust.mak | 14 +++++++-------
6 files changed, 32 insertions(+), 35 deletions(-)
---
diff --git a/win32/Makefile.vc b/win32/Makefile.vc
index 80d27c0a..3f96cfef 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) $(EXTRA_TARGETS) build-info-librsvg
+all: $(LIBRSVG_LIB) $(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/build-rules-msvc.mak b/win32/build-rules-msvc.mak
index a1ec221c..65fa16ea 100644
--- a/win32/build-rules-msvc.mak
+++ b/win32/build-rules-msvc.mak
@@ -13,13 +13,9 @@
# $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
# $<
# <<
-{$(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)\ mkdir $(@D)
+ @if not exist $(@D)\..\librsvg mkdir $(@D)\..\librsvg
@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 @<<
$<
@@ -27,6 +23,7 @@ $<
{..\tests\}.c{$(OUTDIR)\rsvg-tests\}.obj:
@if not exist $(@D)\ mkdir $(@D)
+ @if not exist $(@D)\..\librsvg mkdir $(@D)\..\librsvg
@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 @<<
$<
@@ -42,13 +39,13 @@ $(LIBRSVG_LIB): $(LIBRSVG_DLL)
# $(dependent_objects)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(LIBRSVG_DLL): $(RSVG_INTERNAL_LIB) $(librsvg_OBJS) $(LIBRSVG_DEF)
- link /DLL $(LDFLAGS) $(LIBRSVG_DEP_LIBS) \
- /implib:$(LIBRSVG_LIB) \
- -out:$@ /def:$(LIBRSVG_DEF) @<<
-$(librsvg_OBJS)
-<<
- @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+$(LIBRSVG_DLL): $(RSVG_INTERNAL_LIB)
+ @copy /b $(RSVG_INTERNAL_LIB:.dll.lib=.dll) $(OUTDIR)
+ @copy /b $(RSVG_INTERNAL_LIB:.dll.lib=.dll) $@
+ @copy /b $(RSVG_INTERNAL_LIB:.dll.lib=.lib) $(OUTDIR)\rsvg-2-static.lib
+ @copy /b $(RSVG_INTERNAL_LIB) $(OUTDIR)\rsvg-2.0.lib
+ @copy /b $(RUST_OUTDIR)\rsvg_2.pdb $(OUTDIR)
+ @copy /b $(RUST_OUTDIR)\librsvg-2.0.pc $(OUTDIR)
$(GDK_PIXBUF_SVG_LOADER): \
$(LIBRSVG_LIB) \
diff --git a/win32/config-msvc.mak.in b/win32/config-msvc.mak.in
index 4c42f753..b71b09a3 100644
--- a/win32/config-msvc.mak.in
+++ b/win32/config-msvc.mak.in
@@ -106,7 +106,8 @@ TEST_DEP_LIBS = \
fontconfig.lib
!endif
-RSVG_INTERNAL_LIB = $(OUTDIR)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\librsvg.lib
+RUST_OUTDIR = $(OUTDIR)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)
+RSVG_INTERNAL_LIB = $(RUST_OUTDIR)\rsvg-2.dll.lib
LIBRSVG_DEP_LIBS = \
$(RSVG_INTERNAL_LIB) \
@@ -133,7 +134,6 @@ 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
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index 2acbd65a..fbf4b52b 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -3,18 +3,8 @@
# Items in here should not need to be edited unless
# one is maintaining the NMake build files.
-$(OUTDIR)\librsvg\_rsvg_dummy.c:
- @echo Generating dummy source file...
- @if not exist $(@D)\ mkdir $(@D)
- echo static int __rsvg_dummy; > $@
-
-$(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)
+ @if not exist $(@D)\ mkdir $(@D)
@if exist $@ del $@
- @for %%s in ($**) do echo %%s >> $@
+ @for %%s in ($**) do @echo %%s >> $@
diff --git a/win32/install-msvc.mak b/win32/install-msvc.mak
index 0b541bd9..6dd8cc57 100644
--- a/win32/install-msvc.mak
+++ b/win32/install-msvc.mak
@@ -5,8 +5,10 @@ install: all
@if not exist $(PREFIX)\bin\ mkdir $(PREFIX)\bin
@if not exist $(PREFIX)\lib\gdk-pixbuf-2.0\2.10.0\loaders\ mkdir
$(PREFIX)\lib\gdk-pixbuf-2.0\2.10.0\loaders
@if not exist $(PREFIX)\include\librsvg-$(RSVG_API_VER)\librsvg @mkdir
$(PREFIX)\include\librsvg-$(RSVG_API_VER)\librsvg
- @for %%x in (dll pdb) do @copy /b $(LIBRSVG_DLL_FILENAME).%%x $(PREFIX)\bin
+ @copy /b $(OUTDIR)\rsvg-2*.dll $(PREFIX)\bin
+ @copy /b $(OUTDIR)\rsvg_2.pdb $(PREFIX)\bin
@copy /b $(LIBRSVG_LIB) $(PREFIX)\lib
+ @copy /b $(LIBRSVG_LIB:-2.0=-2-static) $(PREFIX)\lib
@for %%x in (dll pdb) do @copy /b $(OUTDIR)\libpixbufloader-svg.%%x
$(PREFIX)\lib\gdk-pixbuf-2.0\2.10.0\loaders
@copy $(OUTDIR)\rsvg-convert.exe $(PREFIX)\bin
@-copy $(OUTDIR)\rsvg_convert.pdb $(PREFIX)\bin
@@ -25,3 +27,11 @@ install: all
@if not exist librsvg-2.0.pc echo *** librsvg-2.0.pc is not generated! Generate it later using
^$(PYTHON) --version=$(RSVG_PKG_VERSION) --prefix=^$(PREFIX)
@if exist librsvg-2.0.pc if not exist $(PREFIX)\lib\pkgconfig mkdir $(PREFIX)\lib\pkgconfig
@if exist librsvg-2.0.pc move librsvg-2.0.pc $(PREFIX)\lib\pkgconfig
+ @echo.
+ @echo ******* WARNING *******
+ @echo People upgrading from librsvg-2.50.x may want to consider
+ @echo recompiling their application against this build of librsvg,
+ @echo as $(LIBRSVG_DLL) is provided as a convenience
+ @echo and linking against rsvg-2.0.lib will now always link to
+ @echo rsvg-2.dll.
+ @echo ******* WARNING *******
diff --git a/win32/rsvg-rust.mak b/win32/rsvg-rust.mak
index 722f1eec..e38afb94 100644
--- a/win32/rsvg-rust.mak
+++ b/win32/rsvg-rust.mak
@@ -100,16 +100,16 @@ build-$(PLAT)-$(CFG).pre.bat:
build-$(PLAT)-$(CFG)-lib.bat: build-$(PLAT)-$(CFG).pre.bat
@type $**>$@
- @echo $(CARGO_CMD) --verbose --lib>>$@
+ @echo $(CARGO_CMD: build = cbuild )>>$@
build-$(PLAT)-$(CFG)-bin.bat: build-$(PLAT)-$(CFG).pre.bat
@type $**>$@
- @echo $(CARGO_CMD) --verbose --bin rsvg-convert>>$@
+ @echo $(CARGO_CMD) --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-2.dll.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-2.dll.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.
@@ -120,7 +120,7 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\r
@start "Building the Rust bits for $(PLAT) Windows MSVC Build, please do not close this console
window..." /wait /i cmd /c $**
!else
-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-2.dll.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)
@@ -129,7 +129,7 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\l
@if not "$(PKG_CONFIG)" == "" set PKG_CONFIG=$(PKG_CONFIG)
$(RUSTUP_CMD)
@cd ..
- $(CARGO_CMD) --verbose --lib
+ $(CARGO_CMD: build = cbuild )
@cd win32
@set GTK_LIB_DIR=
@set CARGO_TARGET_DIR=
@@ -143,7 +143,7 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\r
@if not "$(PKG_CONFIG)" == "" set PKG_CONFIG=$(PKG_CONFIG)
$(RUSTUP_CMD)
@cd ..
- $(CARGO_CMD) --verbose --bin $(@B)
+ $(CARGO_CMD) --bin $(@B)
@cd win32
@set GTK_LIB_DIR=
@set CARGO_TARGET_DIR=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]