GNOME Bugzilla – Bug 768357
Build the gio tool on Windows/MSVC
Last modified: 2016-07-18 02:44:13 UTC
Hi, There was a recent addition of the gio-tool that is meant to be built for all platforms that GIO supports, but in order that it builds for Windows under Visual Studio, a few simple changes need to be made. I will attach patches for this purpose in a bit. With blessings, thank you!
Created attachment 330831 [details] [review] gio tool: Fix build on Windows/Visual Studio Hi, First up is the patch to allow the code to build under Visual Studio, since: -There isn't unistd.h on any Visual Studio, and we ought to include io.h instead on Windows (for read()/write()). -As a result, there is no STDIN_FILENO and STDOUT_FILENO, so we need to define those as needed as well. -Use gssize instead of ssize_t, as ssize_t is not available on at least older Visual Studio...
Created attachment 330833 [details] [review] Update the build files to build the gio tool with Visual Studio Hi, Next up is the patch for the Visual Studio build files (and gio/Makefile.am), so that we use a template to generate build/win32/vs9/gio-tool.vcproj and build/win32/vs10/gio-tool.[vcxproj|vcxproj.filters], which will definitely depend on the previous patch to work. This will need to be applied with --ignore-whitespace as the .sln files in there need to have Windows CR/LF line endings. Oh, I decided to re-arrange the items in gio/Makefile.am a little bit so that things are grouped better. Please note that the mime and open commands don't work, presumably that there are things in GIO that needs to be done for Windows and/or need to be fixed, which I think is better covered by another bug report, as well as monitor, which most probably needs further work for it to be complete on Windows. With blessings, thank you!
Comment on attachment 330831 [details] [review] gio tool: Fix build on Windows/Visual Studio I've pushed the first patch (with some cosmetic changes); the second one didn't apply.
Hi Matthias, Thanks! The reason the second patch did not apply is that the build/win32/vs[9|10]/glib.sln must use Windows/DOS line endings, unlike the rest of the code which have unix line endings, and --ignore-whitespace hence must be used as a result (please see comment 2). I applied it myself as a result, hope you don't mind, as c6aee1b. With blessings, thank you!