After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762311 - Improve libgtk3.manifest embedding process
Improve libgtk3.manifest embedding process
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
3.19.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-02-19 10:07 UTC by Fan, Chun-wei
Modified: 2016-02-26 03:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improve build experience on Win32 by improving how gtk-win32.rc is generated (25.08 KB, patch)
2016-02-19 10:16 UTC, Fan, Chun-wei
committed Details | Review

Description Fan, Chun-wei 2016-02-19 10:07:48 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!
Comment 1 Fan, Chun-wei 2016-02-19 10:16:53 UTC
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!
Comment 2 Fan, Chun-wei 2016-02-19 10:19:51 UTC
(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).
Comment 3 Ignacio Casal Quinteiro (nacho) 2016-02-19 10:49:45 UTC
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?
Comment 4 Fan, Chun-wei 2016-02-19 11:01:56 UTC
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!
Comment 5 Ignacio Casal Quinteiro (nacho) 2016-02-22 07:25:15 UTC
OK, let's go for it then
Comment 6 Fan, Chun-wei 2016-02-26 03:35:38 UTC
Hi Nacho,

Thanks, I pushed the patch (though I have to rebase it a bit) as 5962dae.

With blessings, thank you!