GNOME Bugzilla – Bug 723734
Add Support for Win32/MSVC using NMake Makefiles
Last modified: 2015-10-05 07:51:34 UTC
Hi, I have come up with a set of NMake Makefiles, along with a few scripts, that can be used to generate the .gschema.xml gsettings files from the templates that are given in this package, the .enums.xml that are needed by the gsettings files, and to also "install" them by copying them to the shared directory and process them with glib-compile-schemas. The reason behind this is to enable GNOME-3.x apps to run on Windows, notably Evince and GEdit, (which both have Win32 ports for example) but couldn't be run unless this package(gsettings-desktop-scehmas) is installed beforehand. This NMake Makefile set can also be optionally used to generate the introspection files for this package, if desired and if gobject-introspection has been built and installed. Please note though, as I have not yet figured out how to install intltool without autotools (and installing it from the sources is hard on Windows, AFAICT), this NMake Makefile set does not yet support building the i18n files.
Created attachment 268249 [details] [review] NMake Makefiles and scripts used to build and "install" the package This patch is the NMake Makefiles and associated scripts used to build and "install" the package under a Windows/MSVC environment.
Created attachment 268250 [details] [review] README.txt for how to use the NMake Makefiles set .
Created attachment 268251 [details] [review] Additions to the autotools files to dist the NMake Makefiles, scripts and README.txt ...that's it for now. With blessings, thank you (and a Happy New Year again)!
I don't understand why we would want what should be fairly generic introspection and schemas handling directly in gsettings-desktop-schemas. I really can't see myself maintaining that in any way. Could this generic support be in gnome-common instead? I'd be happy to take the rest of the necessary (non-generic) plumbing in gsettings-desktop-schemas.
Created attachment 269665 [details] [review] NMake Makefiles and scripts used to build and "install" the package (take ii) Hello Bastien, Here's the NMake Makefile and scripts that do not contain the parts to build the introspection files, if I understood you correctly, so it would only generate the gschema.xml files and generate the enums.xml files before copying them and processing them with glib-compile-schemas. With blessings, thank you!
Created attachment 269667 [details] [review] ReadMe file for those intending to install this package with the NMake Makefiles This is the updated README.txt file that tells people how to "install" this package with the NMake Makefiles, with the introspection parts taken out. Please note that this should be committed with DOS/Windows-style line endings.
Created attachment 269668 [details] [review] Updated autotools files to dist the NMake Makefiles items This is the (updated) autotools files to dist the items from the previous two patches. This concludes the updated patch set. With blessings, thank you!
Created attachment 293022 [details] [review] schemas/Makefile.am: List source files in another file Hello Bastien, Sorry I didn't have time to get back to this, but I think I have a better understanding about what you meant (sorry for my utter ignorance :) ). This first patch is to split the part for schemas/Makefile.am, where the source schema files are listed, into a separate file which can be included by schemas/Makefile.am (and by the NMake Makefile that I will attach a patch later), so that only that listings file needs to be updated if a schemas template file is added or removed. I will continue to add patches for the other parts of this bug as well shortly...
Created attachment 293024 [details] [review] Add autotools module to assemble the commands for using NMake to build the introspection files Hi, This adds an autotools module that can be included by various Makefile.am's which can be used to generate a NMake Module in which the introspection files for a project can be generated via NMake (i.e., no MSYS is required, just standard Visual Studio-enabled cmd.exe). I understand that this might be better for gnome-common, but I am not sure how this gets integrated into that part, so I am posting the patch here anyways. This is used later in the NMake Makefile patch that I will post in a bit, so that we can build introspection files for this package using the NMake Makefiles as well.
Created attachment 293025 [details] [review] Add utility Python scripts to handle .in files Hi, Again, I understand that this might be better-suited to gnome-common, but since O am not sure how this will integrate (i.e. how does the project acquire the gnome-common modules as necessary, and get it to work together with the package), I am posting this patch here anyways. This is a set of 2 simple Python scripts that are used to replace/modify strings, removing strings and replacing autotools variables with real values, as well as forming a URI from a file path. With blessings, thank you!
Created attachment 293026 [details] [review] Add NMake Makefiles to Generate and install the full gschema files and optionally build introspection files Hi, This patch adds the NMake-specific "plumbing" that is used to generate and install the full gschema files via NMake, and call glib-compile-schemas on them, by retrieving the source list, which was split out in attachment 293022 [details] [review], and by processing the gschema.xml.in.in with the scripts in attachment 293025 [details] [review] with the proper XML tags and the file path URIs by a default or an user-defined PREFIX when the NMake Makefile is used. For the introspection part, this is where attachement 293024 comes into play. Basically the module is included after defining the necessary stuff in headers/Makefile.am, where the file lists and NMake Makefile module (which contains the commands for NMake to generate the introspection files) is generated during 'make dist', and is then included by the NMake Makefile, where it is then utilized. With blessings, thank you!
Created attachment 293027 [details] [review] ReadMe file for those intending to install this package with the NMake Makefiles (rev ii) Hi, This is the revised README.txt file on the usage of the NMake Makefile set. With blessings, thank you!
Hi, I am adding Nacho to the CC list of this bug, as probably he wants to look at this. Attachment 293027 [details] needs to have DOS/Windows line feeds, hence the other patch to include it is not enclosed (but build/Makefile.am needs to include that once the other patches and the file itself gets the nod) With blessings, thank you!
Created attachment 311455 [details] [review] Add a common autotools module for Introspection under Visual Studio Builds Hi, This adds a autotools module that can be included by the Makefile.am's for various projects (as Bastien mentioned in comment #4), so that we can generate the complete command lines for g-ir-scanner and g-ir-compiler to build the introspection files for Visual Studio builds. This is now done here as gnome-common is being phased out.
Created attachment 311457 [details] [review] Split out the listing of the gschema.xml.in into a shared Makefile snippet Hi, This splits out the listing of the .gschema.xml.in files into a separate makefile snippet file so that it could be shared between autotools builds and NMake Builds, and any additions and removals of gschema.xml templates only need to be done here.
Created attachment 311458 [details] [review] Build: Add NMake Makefile for "Building" and "installation" Hi, This adds a NMake Makefile set along with some helper Python scripts that is used to generate the full GSchema XML files, the enum XML, and to copy them to an appropriate location and to compile them. This optionally can be used to generate the introspection files for this package. Please note that attachment 311455 [details] [review] is used to generate the introspection command lines during 'make dist'. With blessings, thank you!
Review of attachment 293027 [details] [review]: Go ahead.
Review of attachment 311455 [details] [review]: See the comment, apart from that go ahead. ::: build/Makefile.msvc-introspection @@ +8,3 @@ +# GNU General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License not sure this address is updated. please double check it.
Review of attachment 311457 [details] [review]: Not sure I like the name SrcSchemas. I'll let other decide about this patch.
Review of attachment 311458 [details] [review]: Again, are those python files managed somewhere as an upstream project? if yes, a comment on them would be great.
Created attachment 311845 [details] [review] Split out the listing of the gschema.xml.in into a shared Makefile snippet (take ii) Hi, This is the updated patch for splitting out the schema templates listing, as the Makefile module file name is updated...
Created attachment 311846 [details] [review] Add a common autotools module for Introspection under Visual Studio Builds (take ii) Hi, This updates the previous patch to avoid an extra whitespace...
Created attachment 311847 [details] [review] Build: Add NMake Makefile for "Building" and "installation" (take ii) Hi, This is updated as the Makefile module for the schema templates was renamed. With blessings, thank you!
Review of attachment 311845 [details] [review]: We use .include for files, so "Makefile-schemas.include" would be better. > Build: Split Out Schema Templates List build: Split out schema templates list
Review of attachment 311846 [details] [review]: Is that a copy/paste from another module? If so, please mention where/how to update it in the commit message. You might also need to add the file to the top-level Makefile.am if you want it shipped in the tarballs. About the script itself, does it really need to create temporary files to execute them?
Review of attachment 311847 [details] [review]: ::: build/Makefile.am @@ +6,3 @@ +introspection.body.mak: GDesktopEnums-3.0.gir.msvc.introspect + -$(RM) introspection.body.mak + for F in `ls *.msvc.introspect`; do \ There's no wildcard support in NMake? ::: build/replace.py @@ +7,3 @@ +# Date: September 03, 2014 + +# This is a direct copy from glib's build/win32 directory. I would prefer that sub-directory as well, please.
Hi Bastien, (In reply to Bastien Nocera from comment #25) > Is that a copy/paste from another module? If so, please mention where/how to > update it in the commit message. It is intended to be shared with other modules, but this project (gsettings-desktop-schemas) is the first one to have this, so maybe I should point people here in the commit message instead? > You might also need to add the file to the top-level Makefile.am if you want > it shipped in the tarballs. Hmm, I tried to do 'make dist' on my Fedora 22 system, and it was indeed included when attachment 311847 [details] [review] is applied, without needing to "extra dist" this file in the top-level Makefile.am or so. > > About the script itself, does it really need to create temporary files to > execute them? (In reply to Bastien Nocera from comment #26) > +introspection.body.mak: GDesktopEnums-3.0.gir.msvc.introspect > + -$(RM) introspection.body.mak > + for F in `ls *.msvc.introspect`; do \ > > There's no wildcard support in NMake? I hope I didn't misunderstand you here... Sorry if I did in any way:) I don't think we can !include wildcards in NMake though. The reason of the temporary files is also done with other projects in mind, such as GTK+. The temporary files that are generated here consist of the list file(s) for files to be introspected (GDesktopEnums_3_0_gir_list in our case here), one file per introspected DLL/header/executable, and files (GDesktopEnums-3.0.gir.msvc.introspect in our case here) which consists of the command lines for g-ir-scanner and g-ir-compiler, which is then processed (combined) into introspection.body.mak to be consumed by the NMake Makefile upon running 'make dist'. We need to use filelists in Windows as Windows has a 8192 character limit to the length of a single command, which means we would be in trouble if we try to do otherwise for building introspection for GTK+, for instance. We could use a preprocessor to process the NMake Makefile template, but then the tabs there would be replaced by spaces unless something can be done during preprocessing to preserve those tabs, so that would probably not be optimal. In some cases, we can have multiple file lists files and command lines for introspection, such as for Pango and GTK+, so this module is intended to handle situtations like this as well. This means for the case of Pango, we will get upon 'make dist' Pango_1_0_gir_list and PangoCairo_1_0_gir_list for the lists of files to introspect for Pango and PangoCairo in $(top_builddir)/build respectively, plus an introspection.body.mak which contains the full command lines for g-ir-scanner and g-ir-compiler for building Pango-1.0.gir and PangoCairo-1.0.gir, and their respective .typelib files. Likewise, for GTK+, we will get upon 'make dist' Gdk_3_0_list, GdkWin32_3_0_list and Gtk_3_0_list in $(top_builddir)/build, along with a introspection.body.mak that contains the full command lines for g-ir-scanner and g-ir-compiler for building Gdk-3.0.gir, GdkWin32-3.0.gir and Gtk-3.0.gir and their respective .typelib files. All in all, this approach is done this way to ensure consistency across projects as far as possible. Hope this explains the situation a bit, and sorry for the lengthy response. With blessings, thank you!
Hi Fan, after changing the schemas file feel free to push the files. See i.e this discussion. <hadess> nacho_, put anything you want in build/win32, if you don't touch anything else * dsd has quit (Ping timeout: 183 seconds) <hadess> dsd_, now, it's a winbook tw100 <nacho_> hadess, sure, but we wanted your opinion on having the schemas.inc <hadess> dsd_, baytrail <nacho_> so for me is fine to change it to whatever name you prefer <hadess> nacho_, i've commented on that <nacho_> apart from that the rest should be fine <nacho_> hadess, can you just comment that it is fine for you to put whatever in build/win32? <hadess> nacho_, so change that, and the rest is self-contained <dsd_> and this has rtl8723bs sdio wifi, and you have patches that improve the wifi stability but such patches are outside of the wifi driver? * sils (lasse@ip1f101853.dynamic.kabel-deutschland.de) has joined <hadess> nacho_, i'm late already, feel free to copy/paste <nacho_> ok thanks
Hi Fan, anything else missing here? As pointed out in the previous message you can go ahead and push it once you change the name of the file to Makefile-schemas.include and fix the commit message as pointed out by Bastien. Cheers
Hi Bastien and Nacho, Sorry for the delay, was a pretty rough last week... Anyways, I have pushed the patches as follows: Attachment 311845 [details] (with the filename and commit message corrected as suggested): ce2346d Attachment 311846 [details] (This now outputs items to build/win32, with comments to copy this from gobject-introspection's $(srcroot)/build): 55bdb19 Attachment 311847 [details] (With the NMake items residing in build/win32 and paths adjusted accordingly): fe15797 Attachment 293027 [details] (With Info on Introspection and other slight updates): ca4bd9d. With blessings, thank you for the time and help.