GNOME Bugzilla – Bug 158972
Gnome-print running on win32
Last modified: 2004-12-22 21:47:04 UTC
It would be nice if these small changes could be considered for inclusion. As a result e.g. Dia on win32 will be able to output PDF, etc. [If the following patch is acceptable I can commit myself and provide similar patches for gnome-canvas and gnome-print-ui as well] Thanks, Hans 2004-11-19 Hans Breuer <hans@breuer.org> * config.h.win32 : [new file] support building on win32 without autoconf libgnomeprint/libgnomeprint/gpa/gpa-printer.c : use g_buildfile_name and g_win32_get_package_installation_subdirectory() to determine additional module dirs at runtime * libgnomeprint/gnome-font-face.c libgnomeprint/gnome-print-pdf-tt.c : added HAVE_UNISTD_H * libgnomeprint/gnome-fontmap.c : use g_strcasecmp() * libgnomeprint/gnome-print-transport.c libgnomeprint/gpa/gpa-printer.c : use GLib provided <gdir.h> instead of <dirent.h> * libgnomeprint/gnome-print-transport.c : don't hardcode so names, instead use the least common denominator GModule is capable to handle * libgnomeprint/ttsubset/ttcr.c libgnomeprint/ttsubset/gnome-print-tt-subset.c libgnomeprint/gnome-print-ps2.c : open files in binary mode libgnomeprint/gnome-print.c : ... abd also include <io.h> on win32 to get prototypes for unix like open(), close() * libgnomeprint/transports/gp-transport-lpr.c : define popen(), pclose() to their msvcrt name. * libgnomeprint/transports/gp-transport-lpr.c : make the prototype of G_MOUDULE_EXPORT(ed) functions match the implementation * libgnomeprint/ttsubset/sft.h : if building with msvc use typedefs from GLib instead of the native GNUC types * libgnomeprint/transports/gp-transport-win32.[hc] libgnomeprint/modules/win32/gnome-print-win32.c : start of win32 native printer access * libgnomeprint/gnome-print.c : use native memory mapping when on G_OS_WIN32 * libgnomeprint/gnome-print.def : exported symbols **/makefile.msc : makefile for ms visualc nmake/command line compiler
Created attachment 33997 [details] [review] the patch mentioned above
Visually, most of this looks fine. I don't like the conditionals on _MSC_VER in libgnomeprint/ttsubset/sft.h We need to #define O_BINARY to 0 if it isn't already defined. win32_model_unknown_xml_template should probably be "const". The popen stuff doesn't look elegant. Any way to simply test for popen and _popen in configure.in instead of explicitly testing for G_OS_WIN32?
libgnomeprint/ttsubset/sft.h : would it be more acceptable to depend on GLib definitions unconditionally ? O_BINARY: there are currently 3-4 files which would require such a definition. Would it be possible to get this into config.h with a configure check. win32_model_unknown_xml_template : copied straight from gnome-print-lpd.c so it should be adapted there as well. [ The win32 native support files are just a start, but I didn't manage to get them to work yet. The real native win32 printer support would likely require a more high-level appraoch - something like I've done for Dia with http://cvs.gnome.org/viewcvs/dia/plug-ins/wmf/wmf.cpp?rev=1.28&view=markup ] _popen: Agreed, but I'm the not qualified to answer even the most simple configure.in questions (the msvc glib/gtk/gimp/dia/... build does not use it at all and I've never managed to get msys or cygwin to work for me on win32 either to compile e.g. GLib from cvs) But the definitions could as well be moved to config.h.win32 where the other messy parts are ;-) There is something more in the updated patch (not including new files anymore to keep it smaller) : * libgnomeprint/gnome-print.c : use native memory mapping when on G_OS_WIN32
Created attachment 34045 [details] [review] just an update (as described above)
Created attachment 34431 [details] [review] updated patch the final patch looks good, though i've made a few alterations as per morten's suggestions. i'm also interested in working on a win32 printing backend. email me sometime if you're interested in collaborating. nice work. thanks.
Created attachment 34432 [details] [review] remove duplicate HAVE_POPEN in previous patch
Created attachment 34459 [details] [review] updated patch. should work equally well on mingw and msvc
Comment on attachment 34459 [details] [review] updated patch. should work equally well on mingw and msvc Very nice work. Initial review looks good. I'll go through again just to be sure and commit today for a 2.8.2 release.
+++ libgnomeprint/ttsubset/sft.h 3 Dec 2004 16:34:02 -0000 @@ -77,7 +77,9 @@ #define __SUBFONT_H #include <sys/types.h> +#ifndef _MSC_VER #include <unistd.h> looks odd. Changing to HAVE_UNISTD_H then corrected sft.c to include config.h so that it is properly defined.
Hi Jody, thanks for applying, but there are files missing from the original patch. Also somehow my ChangeLog entry from above got lost. And more serious there crept in a bug in one of the patch iterations. Following the further ChangeLog entry - and an attachment including all the missing files. Thanks, Hans 2004-12-03 Hans Breuer <hans@breuer.org> * libgnomeprint/transports/gp-transport-file.c : add the appropriate access flags to open() for win32, too. Also don't use gsize to keep the return value of write(). Otherwise one will get anendless loop if writing fails.
Created attachment 34469 [details] [review] missing files but *not* patching ChangeLog
Changelog added, along with the missing files. I also extended the Makefile.am to include them in the release.