[gtk/gtk-3-24] build/win32: Track resouce listings in gdk/gtk



commit 78dcdbc2469303d6cd989bdc387e29318e543ffa
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jul 30 12:05:14 2019 +0800

    build/win32: Track resouce listings in gdk/gtk
    
    This is so that we can re-generate the GResource sources if any of the
    items are updated.

 build/win32/Makefile.am           |  2 +
 build/win32/create-lists-msvc.mak | 80 +++++++++++++++++++++++++++++++++++++++
 build/win32/create-lists.bat      | 42 ++++++++++++++++++++
 build/win32/generate-msvc.mak     | 23 +++--------
 4 files changed, 130 insertions(+), 17 deletions(-)
---
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index b94f61216f..c83b78bf45 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -38,6 +38,8 @@ SUBDIRS =     \
 EXTRA_DIST +=  \
        config-msvc.mak         \
        config-msvc.mak.in              \
+       create-lists.bat        \
+       create-lists-msvc.mak           \
        detectenv-msvc.mak              \
        gen-gdkversionmacros-h.py       \
        generate-msvc.mak       \
diff --git a/build/win32/create-lists-msvc.mak b/build/win32/create-lists-msvc.mak
new file mode 100644
index 0000000000..4b2df561b3
--- /dev/null
+++ b/build/win32/create-lists-msvc.mak
@@ -0,0 +1,80 @@
+# Convert the source listing to object (.obj) listing in
+# another NMake Makefile module, include it, and clean it up.
+# This is a "fact-of-life" regarding NMake Makefiles...
+# This file does not need to be changed unless one is maintaining the NMake Makefiles
+
+# For those wanting to add things here:
+# To add a list, do the following:
+# # $(description_of_list)
+# if [call create-lists.bat header $(makefile_snippet_file) $(variable_name)]
+# endif
+#
+# if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]
+# endif
+#
+# if [call create-lists.bat footer $(makefile_snippet_file)]
+# endif
+# ... (repeat the if [call ...] lines in the above order if needed)
+# !include $(makefile_snippet_file)
+#
+# (add the following after checking the entries in $(makefile_snippet_file) is correct)
+# (the batch script appends to $(makefile_snippet_file), you will need to clear the file unless the 
following line is added)
+#!if [del /f /q $(makefile_snippet_file)]
+#!endif
+
+# In order to obtain the .obj filename that is needed for NMake Makefiles to build DLLs/static LIBs or EXEs, 
do the following
+# instead when doing 'if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]'
+# (repeat if there are multiple $(srcext)'s in $(source_list), ignore any headers):
+# !if [for %c in ($(source_list)) do @if "%~xc" == ".$(srcext)" @call create-lists.bat file 
$(makefile_snippet_file) $(intdir)\%~nc.obj]
+#
+# $(intdir)\%~nc.obj needs to correspond to the rules added in build-rules-msvc.mak
+# %~xc gives the file extension of a given file, %c in this case, so if %c is a.cc, %~xc means .cc
+# %~nc gives the file name of a given file without extension, %c in this case, so if %c is a.cc, %~nc means a
+
+NULL=
+
+# For GDK resources
+
+!if [call create-lists.bat header resources_sources.mak GDK_RESOURCES]
+!endif
+
+!if [for %f in (..\..\gdk\resources\glsl\*.glsl) do @call create-lists.bat file resources_sources.mak %f]
+!endif
+
+!if [call create-lists.bat footer resources_sources.mak]
+!endif
+
+!if [call create-lists.bat header resources_sources.mak GTK_RESOURCES]
+!endif
+
+!if [for %f in (..\..\gtk\theme\Adwaita\gtk.css ..\..\gtk\theme\Adwaita\gtk-dark.css 
..\..\gtk\theme\Adwaita\gtk-contained.css ..\..\gtk\theme\Adwaita\gtk-contained-dark.css) do @call 
create-lists.bat file resources_sources.mak %f]
+!endif
+
+!if [for %x in (png svg) do @(for %f in (..\..\gtk\theme\Adwaita\assets\*.%x) do @call create-lists.bat file 
resources_sources.mak %f)]
+!endif
+
+!if [for %f in (..\..\gtk\theme\HighContrast\gtk.css ..\..\gtk\theme\HighContrast\gtk-inverse.css 
..\..\gtk\theme\HighContrast\gtk-contained.css ..\..\gtk\theme\HighContrast\gtk-contained-inverse.css) do 
@call create-lists.bat file resources_sources.mak %f]
+!endif
+
+!if [for %x in (png svg) do @(for %f in (..\..\gtk\theme\HighContrast\assets\*.%x) do @call create-lists.bat 
file resources_sources.mak %f)]
+!endif
+
+!if [for %f in (..\..\gtk\theme\win32\gtk-win32-base.css ..\..\gtk\theme\win32\gtk.css) do @call 
create-lists.bat file resources_sources.mak %f]
+!endif
+
+!if [for %f in (..\..\gtk\cursor\*.png ..\..\gtk\gesture\*.symbolic.png ..\..\gtk\ui\*.ui) do @call 
create-lists.bat file resources_sources.mak %f]
+!endif
+
+!if [for %s in (16 22 24 32 48) do @(for %c in (actions status categories) do @(for %f in 
(..\..\gtk\icons\%sx%s\%c\*.png) do @call create-lists.bat file resources_sources.mak %f))]
+!endif
+
+!if [for %s in (scalable) do @(for %c in (status) do @(for %f in (..\..\gtk\icons\%s\%c\*.svg) do @call 
create-lists.bat file resources_sources.mak %f))]
+!endif
+
+!if [for %f in (..\..\gtk\inspector\*.ui ..\..\gtk\inspector\logo.png ..\..\gtk\emoji\emoji.data) do @call 
create-lists.bat file resources_sources.mak %f]
+!endif
+
+!include resources_sources.mak
+
+!if [del /f /q resources_sources.mak]
+!endif
\ No newline at end of file
diff --git a/build/win32/create-lists.bat b/build/win32/create-lists.bat
new file mode 100644
index 0000000000..ef60d5ce11
--- /dev/null
+++ b/build/win32/create-lists.bat
@@ -0,0 +1,42 @@
+@echo off
+rem Simple .bat script for creating the NMake Makefile snippets.
+
+if not "%1" == "header" if not "%1" == "file" if not "%1" == "footer" goto :error_cmd
+if "%2" == "" goto error_no_destfile
+
+if "%1" == "header" goto :header
+if "%1" == "file" goto :addfile
+if "%1" == "footer" goto :footer
+
+:header
+if "%3" == "" goto error_var
+echo %3 =      \>>%2
+goto done
+
+:addfile
+if "%3" == "" goto error_file
+echo.  %3      \>>%2
+goto done
+
+:footer
+echo.  $(NULL)>>%2
+echo.>>%2
+goto done
+
+:error_cmd
+echo Specified command '%1' was invalid.  Valid commands are: header file footer.
+goto done
+
+:error_no_destfile
+echo Destination NMake snippet file must be specified
+goto done
+
+:error_var
+echo A name must be specified for using '%1'.
+goto done
+
+:error_file
+echo A file must be specified for using '%1'.
+goto done
+
+:done
\ No newline at end of file
diff --git a/build/win32/generate-msvc.mak b/build/win32/generate-msvc.mak
index 4bfbdef92b..755a39a1c4 100644
--- a/build/win32/generate-msvc.mak
+++ b/build/win32/generate-msvc.mak
@@ -4,18 +4,7 @@
 # one is maintaining the NMake build files.
 
 !include config-msvc.mak
-
-!if [echo GDK_RESOURCES = \>> resources_sources.mak ]
-!endif
-
-!if [for %f in (..\..\gdk\resources\glsl\*.glsl) do @echo %f \>> resources_sources.mak]
-!endif
-
-!if [echo.>> resources_sources.mak]
-!endif
-
-!if [del /f /q resources_sources.mak]
-!endif
+!include create-lists-msvc.mak
 
 # Copy the pre-defined gdkconfig.h.[win32|win32_broadway]
 !if "$(CFG)" == "release" || "$(CFG)" == "Release"
@@ -35,9 +24,9 @@ GDK_CONFIG_TEMPLATE = ..\..\gdk\gdkconfig.h.win32
 !endif
 
 GDK_MARSHALERS_FLAGS = --prefix=_gdk_marshal --valist-marshallers
-GDK_RESOURCES_ARGS = $** --target=$@ --sourcedir=..\..\gdk --c-name _gdk --manual-register
+GDK_RESOURCES_ARGS = ..\..\gdk\gdk.gresource.xml --target=$@ --sourcedir=..\..\gdk --c-name _gdk 
--manual-register
 GTK_MARSHALERS_FLAGS = --prefix=_gtk_marshal --valist-marshallers
-GTK_RESOURCES_ARGS = $** --target=$@ --sourcedir=..\..\gtk --c-name _gtk --manual-register
+GTK_RESOURCES_ARGS = ..\..\gtk\gtk.gresource.xml --target=$@ --sourcedir=..\..\gtk --c-name _gtk 
--manual-register
 
 all:   \
        ..\..\config.h  \
@@ -93,7 +82,7 @@ all:  \
        @$(PYTHON) $(GLIB_GENMARSHAL) $(GDK_MARSHALERS_FLAGS) --body $** > $@.tmp
        @move $@.tmp $@
 
-..\..\gdk\gdk.gresource.xml:
+..\..\gdk\gdk.gresource.xml: $(GDK_RESOURCES)
        @echo Generating $@...
        @echo ^<?xml version='1.0' encoding='UTF-8'?^> >$@
        @echo ^<gresources^> >> $@
@@ -139,7 +128,7 @@ all:        \
        @$(PYTHON) $** $@ $(@R).combined.c
        @del $(@R).preproc.c $(@R).combined.c
 
-..\..\gtk\gtk.gresource.xml:
+..\..\gtk\gtk.gresource.xml: $(GTK_RESOURCES)
        @echo Generating $@...
        @echo ^<?xml version='1.0' encoding='UTF-8'?^>> $@
        @echo ^<gresources^>>> $@
@@ -176,7 +165,7 @@ all:        \
        @if not "$(GDK_PIXBUF_PIXDATA)" == "" set GDK_PIXBUF_PIXDATA=$(GDK_PIXBUF_PIXDATA)
        @$(GLIB_COMPILE_RESOURCES) $(GTK_RESOURCES_ARGS) --generate-header
 
-..\..\gtk\gtkresources.c: ..\..\gtk\gtk.gresource.xml
+..\..\gtk\gtkresources.c: ..\..\gtk\gtk.gresource.xml $(GTK_RESOURCES)
        @echo Generating $@...
        @if not "$(XMLLINT)" == "" set XMLLINT=$(XMLLINT)
        @if not "$(JSON_GLIB_FORMAT)" == "" set JSON_GLIB_FORMAT=$(JSON_GLIB_FORMAT)


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