At some time in the past, it was possible to compile libXpm on MS Windows. The code to enable this has since fallen into disuse, but past security advisories concerning libXpm have motivated me to update the code so it can be built to target MS Windows again (tested with MinGW gcc 3.4.2) 2007-08-04 Jason Rumney <jasonr@gnu.org> * src/XpmI.h [FOR_MSW]: Include simx.h instead of real X headers. * src/simx.h (_XFUNCPROTOBEGIN, _XFUNCPROTOEND, NO_ZPIPE): Define. (XAllocColor): Fix arg list in prototype. (bzero, close, fdopen, index, rindex, open, strdup, O_RDONLY): Map to W32 equivalents. * src/RdFToI.c [FOR_MSW]: Include fcntl.h. *** src/XpmI.h~ 2007-01-09 00:09:36.000000000 +0000 --- src/XpmI.h 2007-07-04 17:50:34.406250000 +0100 *************** *** 57,66 **** #ifdef sequent extern FILE *popen(); #endif ! #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xmd.h> #ifdef VMS #include <unixio.h> --- 57,69 ---- #ifdef sequent extern FILE *popen(); #endif ! #ifdef FOR_MSW ! #include "simx.h" ! #else #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xmd.h> + #endif #ifdef VMS #include <unixio.h> *** src/RdFToI.c~ 2007-01-09 00:09:36.000000000 +0000 --- src/RdFToI.c 2007-08-03 23:59:11.203125000 +0100 *************** *** 44,49 **** --- 44,53 ---- #include <errno.h> #include <sys/types.h> #include <sys/wait.h> + #else + #ifdef FOR_MSW + #include <fcntl.h> + #endif #endif LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata)); *** src/simx.h~ 2007-01-09 00:09:36.000000000 +0000 --- src/simx.h 2007-08-04 00:58:30.437500000 +0100 *************** *** 41,46 **** --- 41,50 ---- #include "windows.h" /* MS windows GDI types */ + #define _XFUNCPROTOBEGIN + #define _XFUNCPROTOEND + #define NO_ZPIPE + /* * minimal portability layer between ansi and KR C */ *************** *** 101,107 **** /* color related */ FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *)); ! FUNC(XAllocColor, int, (Display *, Colormap *, XColor *)); FUNC(XQueryColors, void, (Display *display, Colormap *colormap, XColor *xcolors, int ncolors)); FUNC(XFreeColors, int, (Display *d, Colormap cmap, --- 105,111 ---- /* color related */ FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *)); ! FUNC(XAllocColor, int, (Display *, Colormap, XColor *)); FUNC(XQueryColors, void, (Display *display, Colormap *colormap, XColor *xcolors, int ncolors)); FUNC(XFreeColors, int, (Display *d, Colormap cmap, *************** *** 134,139 **** --- 138,155 ---- #undef LFUNC #undef FUNC + /* Some functions and constants that have non-standard names in the + MS library. */ + #define bzero(addr,sz) memset(addr, 0, sz) + #define close _close + #define fdopen _fdopen + #define index strchr + #define open _open + #define O_RDONLY _O_RDONLY + #define rindex strrchr + #define strdup _strdup + + #endif /* def FOR_MSW */ #endif /* _SIMX_H */
Thanks for the patch, but next time, please submit the bug first, then go back and use the attachment functionality to attach the patch, so it's easier to get a clean-applying patch (copying from the web browser failed, so I just manually applied the changes since they were small). Applied to git master: commit 43dfc6be8128139888426d8c709aa78efc207953 Author: Jason Rumney <jasonr@gnu.org> Date: Mon Aug 6 12:52:52 2007 -0700
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.