[gtk+] Windows: Update how gtk-win32.rc is generated



commit 5962daef4ff2cd81bddba20ad0b49d8de16de287
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Feb 22 17:38:15 2016 +0800

    Windows: Update how gtk-win32.rc is generated
    
    On Visual Studio, unlike MinGW, manifest files are embedded via
    including the manifest file as a resource file in the projects, not
    via the .rc file.  This means that the line in the .rc file that
    specifies the manifest file would cause trouble, so that line gets
    removed when the full gtk3-win32.rc is generated on Visual Studio builds,
    otherwise 2010+ Visual Studio will complain when compiling the .rc file.
    Also, the inclusion of winuser.h will cause warnings during the
    compilation of the .rc file.
    
    Fix this by isolating the Win32 resource portions of gtk-win32.rc.in to
    gtk-win32.rc.body.in and:
    -On MinGW, construct the full gtk-win32.rc by doing the winver.h and
     winuser.h inclusion first, then append the contents of gtk-win32.rc.body,
     and then appending the line to embed the manifest file.
    -On Visual Studio, simply copy the gtk-win32.rc.body to gtk-win32.rc,
     and generate the full libgtk3.manifest file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762311

 build/win32/Makefile.am                       |    2 +-
 build/win32/process-in-win32.py               |  109 -------------------------
 build/win32/replace.py                        |  102 +++++++++++++++++++++++
 build/win32/vs10/gtk-3.vcxproj.filtersin      |    3 +-
 build/win32/vs10/gtk-3.vcxprojin              |   40 ++++++---
 build/win32/vs10/gtk3-gen-srcs.props          |   10 ++-
 build/win32/vs10/gtk3-gen-srcs.vsprops        |   77 +++++++++++++++++
 build/win32/vs9/gtk-3.vcprojin                |   56 ++++++++++---
 configure.ac                                  |    2 +-
 gtk/Makefile.am                               |   12 +++-
 gtk/{gtk-win32.rc.in => gtk-win32.rc.body.in} |    2 -
 11 files changed, 271 insertions(+), 144 deletions(-)
---
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index e235327..9fa15e8 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -8,6 +8,6 @@ SUBDIRS =       \
        vs12    \
        vs14
 
-EXTRA_DIST += process-in-win32.py
+EXTRA_DIST += replace.py
 
 -include $(top_srcdir)/git.mk
diff --git a/build/win32/replace.py b/build/win32/replace.py
new file mode 100644
index 0000000..69ef417
--- /dev/null
+++ b/build/win32/replace.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Simple utility script to manipulate
+# certain types of strings in a file
+
+# This can be used in various projects where
+# there is the need to replace strings in files,
+# and is copied from GLib's $(srcroot)/build/win32
+
+# Author: Fan, Chun-wei
+# Date: September 03, 2014
+
+import os
+import sys
+import re
+import string
+import argparse
+
+valid_actions = ['remove-prefix',
+                 'replace-var',
+                 'replace-str',
+                 'remove-str']
+
+def replace(src, dest, instring, outstring):
+    with open(src, 'r') as s:
+        with open(dest, 'w') as d:
+            for line in s:
+                i = line.replace(instring, outstring)
+                d.write(i)
+
+def check_required_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is None:
+            raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
+
+def warn_ignored_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is not None:
+            print('%s: warning: --%s argument is ignored' % (__file__, param))
+
+def main(argv):
+
+    parser = argparse.ArgumentParser(description='Process strings in a file.')
+    parser.add_argument('-a',
+                        '--action',
+                        help='Action to carry out.  Can be one of:\n'
+                             'remove-prefix\n'
+                             'replace-var\n'
+                             'replace-str\n'
+                             'remove-str',
+                        choices=valid_actions)
+    parser.add_argument('-i', '--input', help='Input file')
+    parser.add_argument('-o', '--output', help='Output file')
+    parser.add_argument('--instring', help='String to replace or remove')
+    parser.add_argument('--var', help='Autotools variable name to replace')
+    parser.add_argument('--outstring',
+                        help='New String to replace specified string or variable')
+    parser.add_argument('--removeprefix', help='Prefix of string to remove')
+
+    args = parser.parse_args()
+
+    input_string = ''
+    output_string = ''
+
+    # We must have action, input, output for all operations
+    check_required_args(args, ['action','input','output'])
+
+    # Build the arguments by the operation that is to be done,
+    # to be fed into replace()
+
+    # Get rid of prefixes from a string
+    if args.action == 'remove-prefix':
+        check_required_args(args, ['instring','removeprefix'])
+        warn_ignored_args(args, ['outstring','var'])
+        input_string = args.removeprefix + args.instring
+        output_string = args.instring
+
+    # Replace an m4-style variable (those surrounded by @...@)
+    if args.action == 'replace-var':
+        check_required_args(args, ['var','outstring'])
+        warn_ignored_args(args, ['instring','removeprefix'])
+        input_string = '@' + args.var + '@'
+        output_string = args.outstring
+
+    # Replace a string
+    if args.action == 'replace-str':
+        check_required_args(args, ['instring','outstring'])
+        warn_ignored_args(args, ['var','removeprefix'])
+        input_string = args.instring
+        output_string = args.outstring
+
+    # Remove a string
+    if args.action == 'remove-str':
+        check_required_args(args, ['instring'])
+        warn_ignored_args(args, ['var','outstring','removeprefix'])
+        input_string = args.instring
+        output_string = ''
+
+    replace(args.input, args.output, input_string, output_string)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/build/win32/vs10/gtk-3.vcxproj.filtersin b/build/win32/vs10/gtk-3.vcxproj.filtersin
index aefeb45..319d20a 100644
--- a/build/win32/vs10/gtk-3.vcxproj.filtersin
+++ b/build/win32/vs10/gtk-3.vcxproj.filtersin
@@ -19,7 +19,8 @@
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
-    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in"><Filter>Resource Files</Filter></CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body"><Filter>Resource Files</Filter></CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in"><Filter>Resource Files</Filter></CustomBuild>
   </ItemGroup>
   <ItemGroup>
 #include "gtk-3.vs10.sourcefiles.filters"
diff --git a/build/win32/vs10/gtk-3.vcxprojin b/build/win32/vs10/gtk-3.vcxprojin
index b8031d6..f159c5e 100644
--- a/build/win32/vs10/gtk-3.vcxprojin
+++ b/build/win32/vs10/gtk-3.vcxprojin
@@ -177,19 +177,33 @@
       <Command 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkDbusBuiltSources)</Command>
       <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
     </CustomBuild>
-    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in">
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32RC)</Command>
-      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32RC)</Command>
-      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32RC)</Command>
-      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32RC)</Command>
-      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+    <CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying GTK+ Win32 Version 
Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CopyGtkWin32RC)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying GTK+ Win32 Version 
Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CopyGtkWin32RC)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying GTK+ Win32 Version 
Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CopyGtkWin32RC)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying GTK+ Win32 Version 
Resource...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(CopyGtkWin32RC)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 
Manifest...</Message>
+      <Command 
Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 
Manifest...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 
Manifest...</Message>
+      <Command 
Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 
Manifest...</Message>
+      <Command 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs 
Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
     </CustomBuild>
   </ItemGroup>
   <ItemGroup>
diff --git a/build/win32/vs10/gtk3-gen-srcs.props b/build/win32/vs10/gtk3-gen-srcs.props
index 41c68eb..b9440c8 100644
--- a/build/win32/vs10/gtk3-gen-srcs.props
+++ b/build/win32/vs10/gtk3-gen-srcs.props
@@ -64,7 +64,8 @@ $(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix
 
 cd $(SolutionDir)
     </GenerateGtkDbusBuiltSources>
-    <GenerateGtkWin32RC>$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc 
--gtk3manifest</GenerateGtkWin32RC>
+    <CopyGtkWin32RC>copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc</CopyGtkWin32RC>
+    <GenerateGtkWin32Manifest>$(PythonPath)\python ..\replace.py --action=replace-var 
--input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest 
--var=EXE_MANIFEST_ARCHITECTURE --outstring=*</GenerateGtkWin32Manifest>
     <CopyDemosH>copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h</CopyDemosH>
   </PropertyGroup>
   <PropertyGroup>
@@ -83,8 +84,11 @@ cd $(SolutionDir)
     <BuildMacro Include="GenerateGtkDbusBuiltSources">
       <Value>$(GenerateGtkDbusBuiltSources)</Value>
     </BuildMacro>
-    <BuildMacro Include="GenerateGtkWin32RC">
-      <Value>$(GenerateGtkWin32RC)</Value>
+    <BuildMacro Include="CopyGtkWin32RC">
+      <Value>$(CopyGtkWin32RC)</Value>
+    </BuildMacro>
+    <BuildMacro Include="GenerateGtkWin32Manifest">
+      <Value>$(GenerateGtkWin32Manifest)</Value>
     </BuildMacro>
     <BuildMacro Include="CopyDemosH">
       <Value>$(CopyDemosH)</Value>
diff --git a/build/win32/vs10/gtk3-gen-srcs.vsprops b/build/win32/vs10/gtk3-gen-srcs.vsprops
new file mode 100644
index 0000000..88bb982
--- /dev/null
+++ b/build/win32/vs10/gtk3-gen-srcs.vsprops
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="gtk3gensrcsprops"
+       InheritedPropertySheets=".\gtk3-build-defines.vsprops"
+       >
+       <UserMacro
+               Name="GenConfigH"
+               Value="
+copy ..\..\..\config.h.win32 ..\..\..\config.h
+                     "
+       />
+       <UserMacro
+               Name="GenGdkConfigHWin32"
+               Value="
+if exist ..\..\..\MSVC_$(ConfigurationName) goto DONE_GDKCONFIG_H&#x0D;&#x0A;
+
+if exist ..\..\..\gdk\gdkconfig.h del ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+if exist ..\..\..\GDK_BROADWAY_BUILD del ..\..\..\GDK_BROADWAY_BUILD&#x0D;&#x0A;
+if exist ..\..\..\MSVC_$(ConfigurationName)_Broadway del 
..\..\..\MSVC_$(ConfigurationName)_Broadway&#x0D;&#x0A;
+
+if exist $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll del 
$(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll&#x0D;&#x0A;
+if exist $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib del 
$(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib&#x0D;&#x0A;
+
+if &quot;$(ConfigurationName)&quot; == &quot;Release&quot; del ..\..\..\MSVC_Debug&#x0D;&#x0A;
+if &quot;$(ConfigurationName)&quot; == &quot;Debug&quot; del ..\..\..\MSVC_Release&#x0D;&#x0A;
+
+copy ..\..\..\gdk\gdkconfig.h.win32 ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+copy ..\..\..\gdk\gdkconfig.h.win32 ..\..\..\GDK_WIN32ONLY_BUILD&#x0D;&#x0A;
+
+echo $(ConfigurationName) &gt; ..\..\..\MSVC_$(ConfigurationName)&#x0D;&#x0A;
+:DONE_GDKCONFIG_H&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="GenGdkConfigHBroadway"
+               Value="
+if exist ..\..\..\MSVC_$(ConfigurationName)_Broadway goto DONE_GDKCONFIG_H&#x0D;&#x0A;
+
+if exist ..\..\..\gdk\gdkconfig.h del ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+if exist ..\..\..\GDK_WIN32ONLY_BUILD del ..\..\..\GDK_WIN32ONLY_BUILD&#x0D;&#x0A;
+
+if exist ..\..\..\MSVC_Release del ..\..\..\MSVC_Release&#x0D;&#x0A;
+if exist ..\..\..\MSVC_Debug del ..\..\..\MSVC_Debug&#x0D;&#x0A;
+
+if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; del 
..\..\..\MSVC_Debug_Broadway&#x0D;&#x0A;
+if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; del 
..\..\..\MSVC_Release_Broadway&#x0D;&#x0A;
+
+copy ..\..\..\gdk\gdkconfig.h.win32_broadway ..\..\..\gdk\gdkconfig.h&#x0D;&#x0A;
+copy ..\..\..\gdk\gdkconfig.h.win32_broadway ..\..\..\GDK_BROADWAY_BUILD&#x0D;&#x0A;
+
+echo $(ConfigurationName) &gt; ..\..\..\MSVC_$(ConfigurationName)_Broadway&#x0D;&#x0A;
+:DONE_GDKCONFIG_H&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="GenerateGtkDbusBuiltSources"
+               Value="
+cd ..\..\..\gtk&#x0D;&#x0A;
+$(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk 
--generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml&#x0D;&#x0A;
+cd $(SolutionDir)&#x0D;&#x0A;
+                     "
+       />
+       <UserMacro
+               Name="CopyGtkWin32RC"
+               Value="copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc"
+       />
+       <UserMacro
+               Name="GenerateGtkWin32Manifest"
+               Value="$(PythonPath)\python ..\replace.py --action=replace-var 
--input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest 
--var=EXE_MANIFEST_ARCHITECTURE --outstring=*"
+       />
+       <UserMacro
+               Name="CopyDemosH"
+               Value="copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h"
+       />
+</VisualStudioPropertySheet>
diff --git a/build/win32/vs9/gtk-3.vcprojin b/build/win32/vs9/gtk-3.vcprojin
index 24b4fe4..b2dd357 100644
--- a/build/win32/vs9/gtk-3.vcprojin
+++ b/build/win32/vs9/gtk-3.vcprojin
@@ -192,33 +192,63 @@
                                        />
                                </FileConfiguration>
                        </File>
-                       <File RelativePath="..\..\..\gtk\gtk-win32.rc.in">
+                       <File RelativePath="..\..\..\gtk\gtk-win32.rc.body">
                                <FileConfiguration Name="Debug|Win32">
                                <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Release|Win32">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Debug|x64">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
                                        />
                                </FileConfiguration>
                                <FileConfiguration Name="Release|x64">
                                        <Tool Name="VCCustomBuildTool"
-                                               Description="Generating GTK+ Win32 Version Resource..."
-                                               CommandLine="$(GenerateGtkWin32RC)"
-                                               
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
+                                               Description="Copying GTK+ Win32 Version Resource..."
+                                               CommandLine="$(CopyGtkWin32RC)"
+                                               Outputs="..\..\..\gtk\gtk-win32.rc"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File RelativePath="..\..\..\gtk\libgtk3.manifest.in">
+                               <FileConfiguration Name="Debug|Win32">
+                               <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Release|Win32">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Debug|x64">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration Name="Release|x64">
+                                       <Tool Name="VCCustomBuildTool"
+                                               Description="Generating GTK+ Win32 Manifest..."
+                                               CommandLine="$(GenerateGtkWin32Manifest)"
+                                               Outputs="..\..\..\gtk\libgtk3.manifest"
                                        />
                                </FileConfiguration>
                        </File>
diff --git a/configure.ac b/configure.ac
index ae139e8..e97cb25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1943,7 +1943,7 @@ gdk/gdkversionmacros.h
 gtk/Makefile
 gtk/makefile.msc
 gtk/gtkversion.h
-gtk/gtk-win32.rc
+gtk/gtk-win32.rc.body
 gtk/libgtk3.manifest
 libgail-util/Makefile
 modules/Makefile
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 0806246..45f862a 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -35,6 +35,11 @@ gtk_win32_res_ldflag = -Wl,gtk-win32-res.o
 gtk-win32-res.o : gtk-win32.rc libgtk3.manifest
        $(WINDRES) gtk-win32.rc $@
 
+gtk-win32.rc: gtk-win32.rc.body
+       echo "#include <winuser.h>" >>$@
+       cat $< >>$@
+       echo "ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest" >>$@
+
 gtk.def: libgtk-3.la
        echo "LIBRARY libgtk-$(GTK_MAJOR_VERSION)- LT_CURRENT_MINUS_AGE@" >$@
        echo "EXPORTS" >>$@
@@ -1124,6 +1129,10 @@ MAINTAINERCLEANFILES = \
 
 DISTCLEANFILES =
 
+if OS_WIN32
+DISTCLEANFILES += gtk-win32.rc
+endif
+
 EXTRA_DIST += $(gtk_all_private_h_sources) $(gtk_extra_sources)
 EXTRA_DIST += $(gtk_built_sources)
 
@@ -1587,7 +1596,8 @@ EXTRA_DIST +=                   \
        deprecated/Makefile.inc \
        inspector/Makefile.inc  \
        libgtk3.manifest.in     \
-       gtk-win32.rc.in         \
+       gtk-win32.rc.body.in    \
+       gtk-win32.rc.body       \
        gtkwin32embed.h         \
        gtkwin32embedwidget.h   \
        gtkwin32embedwidget.c   \
diff --git a/gtk/gtk-win32.rc.in b/gtk/gtk-win32.rc.body.in
similarity index 92%
rename from gtk/gtk-win32.rc.in
rename to gtk/gtk-win32.rc.body.in
index e58d55a..4a42d5a 100644
--- a/gtk/gtk-win32.rc.in
+++ b/gtk/gtk-win32.rc.body.in
@@ -1,5 +1,4 @@
 #include <winver.h>
-#include <winuser.h>
 
 VS_VERSION_INFO VERSIONINFO
   FILEVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
@@ -29,4 +28,3 @@ VS_VERSION_INFO VERSIONINFO
       VALUE "Translation", 0x409, 1200
     END
   END
-ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk3.manifest


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