[librsvg/cargo-c-msvc: 3/3] NMake Makefiles: Streamline build process




commit b672dec010d9d9327c041d9e6c9e9e23a10f9b51
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jul 9 16:58:37 2021 +0800

    NMake Makefiles: Streamline build process
    
    Use separate build directories for librsvg and rsvg_convert, so that
    building one of it does no require rebuilding the other.  Also make the
    cross-build batch generation done on the fly, so that they will be
    removed once the Rust cross build work is completed (or failed--they can
    be generated quite quickly if needed).

 .gitignore                 |  4 ++--
 win32/build-rules-msvc.mak |  4 ++--
 win32/info-msvc.mak        |  4 ++--
 win32/install-msvc.mak     |  2 +-
 win32/rsvg-rust.mak        | 23 +++++++++++++++--------
 5 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index fcdd8e61..9060fa72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,7 +76,7 @@ tests/rsvg-test
 tests/*.log
 tests/*.trs
 win32/config-msvc.mak
-win32/*.bat
+win32/build-*.bat
 win32/vs12
 win32/vs14
 win32/__pycache__
@@ -92,4 +92,4 @@ tools/docker/debian/librsvg.tar.gz
 tools/docker/opensuse/build-librsvg.sh
 tools/docker/opensuse/librsvg.tar.gz
 tools/docker/fedora/build-librsvg.sh
-tools/docker/fedora/librsvg.tar.gz
\ No newline at end of file
+tools/docker/fedora/librsvg.tar.gz
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
index 7af562df..8c1454ed 100644
--- a/win32/build-rules-msvc.mak
+++ b/win32/build-rules-msvc.mak
@@ -61,7 +61,7 @@ $(OUTDIR)\rsvg-gdk-pixbuf-loader\io-svg.obj
 # <<
 #      @-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
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg-convert\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe
        @copy /b $** $@
        @if exist $(**D)\rsvg_convert.pdb copy /b $(**D)\rsvg_convert.pdb $(@D)
 
@@ -110,6 +110,7 @@ $(OUTDIR)\Rsvg-2.0.typelib: $(OUTDIR)\Rsvg-2.0.gir
 clean:
        @if exist $(OUTDIR)\Rsvg-$(RSVG_API_VER).typelib del /f /q $(OUTDIR)\Rsvg-$(RSVG_API_VER).typelib
        @if exist $(OUTDIR)\Rsvg-$(RSVG_API_VER).gir del /f /q $(OUTDIR)\Rsvg-$(RSVG_API_VER).gir
+       @-del /f /q $(OUTDIR)\librsvg-2.0.pc
        @-del /f /q $(OUTDIR)\*.dll
        @-del /f /q $(OUTDIR)\*.exe
        @-del /f /q $(OUTDIR)\*.pdb
@@ -129,4 +130,3 @@ clean:
        @-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/info-msvc.mak b/win32/info-msvc.mak
index 631b3d9f..7966007e 100644
--- a/win32/info-msvc.mak
+++ b/win32/info-msvc.mak
@@ -56,9 +56,9 @@ help:
        @echo will be searched for in ^$(INCLUDEDIR)\glib-2.0 and
        @echo ^$(LIBDIR)\glib-2.0\include.
        @echo.
-       @echo PKG_CONFIG_PATH: Full path to pkg-config.exe.  Required if building
-       @echo introspection files and if pkg-config.exe is not in your PATH or it
+       @echo PKG_CONFIG: Full path to pkg-config.exe.  Required if pkg-config.exe is not in your PATH or it
        @echo is called something other than pkg-config.
+       @echo PKG_CONFIG_PATH: Other paths to search for pkg-config outside of paths search by default; 
separate paths by ';'.
        @echo.
        @echo PYTHON: Full path to your Python interpreter executable.  Required
        @echo if building introspection files and if python.exe is not in your PATH.
diff --git a/win32/install-msvc.mak b/win32/install-msvc.mak
index 09416830..f649c040 100644
--- a/win32/install-msvc.mak
+++ b/win32/install-msvc.mak
@@ -26,7 +26,7 @@ install: all
        @-$(PYTHON) rsvgpc.py --version=$(RSVG_PKG_VERSION) --prefix=$(PREFIX) 
--source=$(OUTDIR)\librsvg-2.0.pc -o $(OUTDIR)\librsvg-2.0.pc.real
        @if not exist $(OUTDIR)\librsvg-2.0.pc.real echo *** librsvg-2.0.pc may not contain a ^$prefix that 
matches your build config.  Please check it.
        @if not exist $(PREFIX)\lib\pkgconfig mkdir $(PREFIX)\lib\pkgconfig
-       @if exist $(OUTDIR)\librsvg-2.0.pc.real copy $(OUTDIR)\librsvg-2.0.pc.real 
$(PREFIX)\lib\pkgconfig\librsvg-2.0.pc
+       @if exist $(OUTDIR)\librsvg-2.0.pc.real move $(OUTDIR)\librsvg-2.0.pc.real 
$(PREFIX)\lib\pkgconfig\librsvg-2.0.pc
        @if not exist $(OUTDIR)\librsvg-2.0.pc.real copy $(OUTDIR)\librsvg-2.0.pc $(PREFIX)\lib\pkgconfig
        @echo.
        @echo ******* WARNING *******
diff --git a/win32/rsvg-rust.mak b/win32/rsvg-rust.mak
index e38afb94..266d8617 100644
--- a/win32/rsvg-rust.mak
+++ b/win32/rsvg-rust.mak
@@ -91,26 +91,28 @@ build-$(PLAT)-$(CFG).pre.bat:
        @echo set __VSCMD_script_err_count=>>$@
        @echo if not "$(__VSCMD_PREINIT_PATH)" == "" set 
PATH=$(__VSCMD_PREINIT_PATH);%HOMEPATH%\.cargo\bin>>$@
        @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 ..>>$@
 
-build-$(PLAT)-$(CFG)-lib.bat: build-$(PLAT)-$(CFG).pre.bat
-       @type $**>$@
+build-$(PLAT)-$(CFG)-lib.bat: build-$(PLAT)-$(CFG).pre.bat build-$(PLAT)-$(CFG)-bin.bat
+       @type build-$(PLAT)-$(CFG).pre.bat>$@
+       @echo set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api>>$@
        @echo $(CARGO_CMD: build = cbuild )>>$@
+       @del /f/q build-$(PLAT)-$(CFG).pre.bat
 
 build-$(PLAT)-$(CFG)-bin.bat: build-$(PLAT)-$(CFG).pre.bat
        @type $**>$@
+       @echo set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\convert>>$@
        @echo $(CARGO_CMD) --bin rsvg-convert>>$@
 
 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-convert\$(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)\rsvg-2.dll.lib  \
-vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-convert.exe:
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg-convert\$(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
@@ -118,6 +120,8 @@ 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 $**
+       @if "$(@F)" == "rsvg-2.dll.lib" del /f/q build-$(PLAT)-$(CFG)-lib.bat
+       @if "$(@F)" == "rsvg-convert.exe" del /f/q build-$(PLAT)-$(CFG)-bin.bat
 
 !else
 vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\rsvg-2.dll.lib:
@@ -134,9 +138,9 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\r
        @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:
+vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg-convert\$(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 CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg-convert
        @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)
@@ -151,8 +155,11 @@ vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api\$(RUST_TARGET)-pc-windows-msvc\$(CFG)\r
 
 cargo-clean:
        @set PATH=%PATH%;%HOMEPATH%\.cargo\bin
+       @set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg-convert
+       @cd ..
+       @$(CARGO) clean
+       @cd win32
        @set CARGO_TARGET_DIR=win32\vs$(VSVER)\$(CFG)\$(PLAT)\obj\rsvg_c_api
-       @if exist build-$(PLAT)-$(CFG).bat del /f/q build-$(PLAT)-$(CFG).bat
        @cd ..
        @$(CARGO) clean
        @cd win32


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]