[PATCH] Allow inkscape to be cross-compiled from Fedora to Windows using MinGW
Hi,
I'm doing the Fedora MinGW project[1], where we are building up a cross-compiler and comprehensive set of libraries so we can build Windows software from Fedora.
Mostly inkscape "just works". Install the dependent libraries such as gtkmm etc. from our yum repo[2], then:
PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ ./configure --host=i686-pc-mingw32 \ --enable-lcms=no \ --without-gnome-vfs make
With this command and the patches below I built 'inkscape.exe', and did some limited testing, and it appears to run under Wine >= 1.1.6. (Note that at no point is MS Windows required).
The patches and specfile we use are in our development repository[3], and also attached to this email.
(a) mingw32-inkscape-20081027-no-gc-version-check-when-crosscompiling.patch
You cannot run programs when cross-compiling (not even if you have Wine). This first patch disables a test for the version of libgc which relied on running a test program.
(b) mingw32-inkscape-20081027-extra-win32-objects.patch
I'm not quite sure why, but a load of Win32 source files are apparently missing from the Makefile.am's. It should be safe to add these for all platforms, as long as the sources files themselves are surrounded by #ifdef WIN32 ... #endif.
(c) mingw32-inkscape-20081027-no-is-os-vista.patch
The code uses a function called 'is_os_vista' that doesn't seem to exist. Maybe this was added to a new version of some dependency?
(d) mingw32-inkscape-20081027-pango-enable-engine.patch
Some files don't compile unless you define PANGO_ENABLE_ENGINE. I didn't look into this very deeply, but certainly defining this symbol at the top of the affected files fixes this.
(e) mingw32-inkscape-20081027-no-setenv.patch
This is a hack we use to remove a reference to 'setenv' because that API doesn't exist on Windows.
I hope you find this useful, and maybe you can use it to automate builds and tests on the Windows version.
Rich.
[1] http://fedoraproject.org/wiki/MinGW
[2] http://www.annexia.org/tmp/mingw/fedora-9/
[3] Go to http://hg.et.redhat.com/misc/fedora-mingw--devel/ and click 'manifest' then go into the 'inkscape' directory.
Richard W.M. Jones-2 wrote:
The code uses a function called 'is_os_vista' that doesn't seem to exist. Maybe this was added to a new version of some dependency?
It is defined in libgdl/gdl-win32.c. Probably it's not added to the makefile. Please double-check, because it seems like removing this will cause severe performance issues on Vista.
This is a hack we use to remove a reference to 'setenv' because that API doesn't exist on Windows.
The proper fix is not to remove the call but to convert it to g_setenv, and convert the arguments to Glib filename encoding before the call.
Otherwise, good job. Inkscape is notoriously short on Windows developers, and being able to run Inkscape in Wine without the need for Windows will help to make this problem less severe. By the way, did you try compiling the Linux version from the same source after applying your changes?
Regards, Krzysztof Kosiński.
On Mon, Oct 27, 2008 at 09:22:45AM -0700, Krzysztof Kosiński wrote:
By the way, did you try compiling the Linux version from the same source after applying your changes?
No I didn't actually, but I take the point and will try that in the next round of patches.
Rich.
For those that are interested, here's a screenshot of inkscape running under Wine 1.1.6:
http://annexia.org/tmp/inkscape-wine.png
There's still some problem loading the toolbar icons. I'm not sure if this is just a simple paths problem.
Also it has problems rendering fonts on paths, although judging by the stderr messages I suspect this is actually down to a bug in Wine.
Rich.
Richard W.M. Jones-2 wrote:
There's still some problem loading the toolbar icons. I'm not sure if this is just a simple paths problem.
This looks like Inkscape can't find the file icons.svg, which is in the directory $prefix/share/inkscape/icons on Linux.
Regards, Krzysztof Kosiński
On Mon, Oct 27, 2008 at 03:12:44PM -0700, Krzysztof Kosiński wrote:
Richard W.M. Jones-2 wrote:
There's still some problem loading the toolbar icons. I'm not sure if this is just a simple paths problem.
This looks like Inkscape can't find the file icons.svg, which is in the directory $prefix/share/inkscape/icons on Linux.
I added a hack to set the paths correctly, and it now looks like this:
http://www.annexia.org/tmp/inkscape-tiger.png
I don't want to submit my patch (it really is a hack), but I wouldn't mind comments on version 2 of the MinGW patch I sent yesterday.
Rich.
I committed your patches, with some modifications - I added #ifdefs around Windows-only code where necessary and added gdl-win32.* to the makefile instead of removing the function call. The setenv issue was already fixed in another way. The only thing I'm holding back on is the PANGO_ENABLE_ENGINE issue, because I don't really understand what's going on there.
By the way, I don't see the second version of the MinGW patch here.
Regards, Krzysztof Kosiński
Krzysztof Kosiński wrote:
By the way, I don't see the second version of the MinGW patch here.
OK, now I do see it, it was posted in another thread... Nevermind :)
Regards, Krzysztof Kosiński
I got font rendering to work. As I predicted, it's simply a bug in Wine. If you call the Win32 API call 'GetGlyphOutline' with the format parameter containing 'GGO_UNHINTED', then Wine fails the call:
fixme:font:WineEngGetGlyphOutline Unsupported format 258
(258 = GGO_UNHINTED | GGO_NATIVE) Probably real Windows succeeds, but I didn't try that.
A good fix for that would be to gracefully fall-back to hinted fonts when you detect that situation.
A bad/hack fix is the patch I'm using instead: http://hg.et.redhat.com/misc/fedora-mingw--devel/?f=597377437067;file=inksca...
Anyway, with that, inkscape basically compiles and runs fine using our cross-compiler and Wine. I haven't found any other issues, even loading the large example SVG files that you supply.
If you want to keep track of our latest work, go to: http://hg.et.redhat.com/misc/fedora-mingw--devel/ then click 'manifest' then 'inkscape'.
Rich.
Richard W.M. Jones-2 wrote:
I got font rendering to work. As I predicted, it's simply a bug in Wine. If you call the Win32 API call 'GetGlyphOutline' with the format parameter containing 'GGO_UNHINTED', then Wine fails the call:
fixme:font:WineEngGetGlyphOutline Unsupported format 258
(258 = GGO_UNHINTED | GGO_NATIVE) Probably real Windows succeeds, but I didn't try that.
A good fix for that would be to gracefully fall-back to hinted fonts when you detect that situation.
This will not be fixed. See the rationale here: http://www.mail-archive.com/wine-devel@...2060.../msg48660.html Please report this problem to the Wine bug tracker if you can.
Regards, Krzysztof Kosiński
participants (2)
-
Krzysztof Kosiński
-
Richard W.M. Jones