GNOME Bugzilla – Bug 762311
Improve libgtk3.manifest embedding process
Last modified: 2016-02-26 03:35:55 UTC
Hi, Currently, to support using visual styles in the native print dialog on Windows, an embed of a manifest file is used to request common controls library. However, the manifest embedding process differs between Visual Studio builds and MinGW-(MSYS2-)based builds as follows: -Visual Studio builds embed manifests by having the manifest file enlisted in the project files. -MinGW builds embed manifests using the .rc ...currently, the code is done to do it in the MinGW way. There are some drawbacks to this, on Visual Studio builds, namely: -On later Visual Studio versions, embedding manifests via .rc files will cause the build to fail (not allowed), so it is required to embed it by adding the manifest file to the projects. This is currently done by using a Python script to remove the line when generating gtk-win32.rc, so that the build is supported there, but this is obviously hackish. -As only a subset of preprocessor options are supported by rc.exe, warnings are raised on later Visual Studio versions when including winuser.h in gtk-win32.rc. This is to improve the build experience on Windows, which I will attach a patch for. With blessings, thank you!
Created attachment 321643 [details] [review] Improve build experience on Win32 by improving how gtk-win32.rc is generated Hi, This is my proposed patch at dealing with the problem, what it does is as follows: -Move everything, sans the winuser.h and the line to embed libgtk3.manifest, from gtk-win32.rc.in to gtk-win32.rc.body.in, which has its version info filled in during configure, and dist the generated gtk-win32.rc.body, which is like how gdk.rc is done (please see gdk/win32/rc). -For the autotools (MinGW-based) builds on Windows, generate gtk-win32.rc by first generating a gtk-win32.rc with "#include <winuser.h>" in it, then append the contents of gtk-win32.rc.body to it, and then append the line to embed libgtk3.manifest. -For the Visual Studio builds, generate gtk-win32.rc by copying gtk-win32.rc.body. The libgtk3.manifest is generated in a way more or less like before on both build variants. With blessings, thank you!
(Oh, please note that the Python script that was used to generate gtk-win32.rc and libgtk3.manifest files were replaced with the generic script that is also used in GLib, i.e. build/win32/replace.py, to ease future maintenance, as this patch makes it only necessary to generate libgtk3.manifest during Visual Studio builds).
Review of attachment 321643 [details] [review]: Patch looks good to me. Just have a look at the minor comment. ::: gtk/Makefile.am @@ +1648,3 @@ libgtk3.manifest.in \ + gtk-win32.rc.body.in \ + gtk-win32.rc.body \ why do we need to dist the .body one? It should be generated no?
Hi Nacho, I am leaning towards dist'ing gtk-win32.rc.body as: -gdk/win32/rc/gdk.rc is being dist'ed, and the rest of the .rc files which are used in the GTK+ stack are also dist'ed (and they are also generated with the autotools builds in the same way). Visual Studio does not use autotools, so I would rather not have to generate it using replace.py, as all that is in there are version information--and gtk-win32.rc before the changes introduced by LRN for the native print dialog was dist'ed. -It does seem to me that what needs to be really generated during configure time is libgtk3.manifest, as in the autotools builds the platform info is determined at build time, although we may be able to get away there by using a *. With blessings, thank you!
OK, let's go for it then
Hi Nacho, Thanks, I pushed the patch (though I have to rebase it a bit) as 5962dae. With blessings, thank you!