From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: two more mingw patches: guile runs in wine Date: Mon, 31 Jan 2011 21:49:04 +0100 Organization: www.AvatarAcademy.nl Message-ID: <1296506944.17905.24.camel@vuurvlieg> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-tzGtUz2Qe17Bn/N02IoC" X-Trace: dough.gmane.org 1296513649 30973 80.91.229.12 (31 Jan 2011 22:40:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 Jan 2011 22:40:49 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jan 31 23:40:44 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pk2QL-0006hW-Eb for guile-devel@m.gmane.org; Mon, 31 Jan 2011 23:40:42 +0100 Original-Received: from localhost ([127.0.0.1]:42626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pk1Pb-0006U6-2W for guile-devel@m.gmane.org; Mon, 31 Jan 2011 16:35:51 -0500 Original-Received: from [140.186.70.92] (port=58660 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pk1D1-0000gJ-8E for guile-devel@gnu.org; Mon, 31 Jan 2011 16:23:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pk0gN-0007sG-PG for guile-devel@gnu.org; Mon, 31 Jan 2011 15:49:09 -0500 Original-Received: from smtp-vbr19.xs4all.nl ([194.109.24.39]:4299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pk0gN-0007rA-Eb for guile-devel@gnu.org; Mon, 31 Jan 2011 15:49:07 -0500 Original-Received: from [192.168.1.112] (peder.onsbrabantnet.nl [88.159.206.46] (may be forged)) (authenticated bits=0) by smtp-vbr19.xs4all.nl (8.13.8/8.13.8) with ESMTP id p0VKn5qv097646; Mon, 31 Jan 2011 21:49:05 +0100 (CET) (envelope-from janneke-list@xs4all.nl) X-Mailer: Evolution 2.30.3 X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-Received-From: 194.109.24.39 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11476 Archived-At: --=-tzGtUz2Qe17Bn/N02IoC Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by smtp-vbr19.xs4all.nl id p0VKn5qv097646 Hi With these two patches, Guile runs in Wine (the interactive mode still has problems but Schikkers-List runs) and LilyPond also starts to run. I realise that one of these is a pure gnulib thing, you may or may not want to include it until gnulib includes [something like] this. At least, now you know about it. Greetings, Jan. --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.= nl =20 --=-tzGtUz2Qe17Bn/N02IoC Content-Disposition: attachment; filename*0=0001-Add-an-implementation-of-gnulib-s-canonicalize_file_.pat; filename*1=ch Content-Type: text/x-patch; name="0001-Add-an-implementation-of-gnulib-s-canonicalize_file_.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit >From b53c12f8f3c861824582150c1b2ec6595a6e5965 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 31 Jan 2011 21:38:57 +0100 Subject: [PATCH] Add an implementation of gnulib's canonicalize_file_name for mingw. This marked the first sensible running of guile.exe (1.9) in wine. --- lib/canonicalize-lgpl.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index ec55f26..2464bad 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -84,6 +84,9 @@ #endif #if !FUNC_REALPATH_WORKS || defined _LIBC + +#ifndef __MINGW32__ + /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated path separators ('/') or symlinks. All path components must exist. If @@ -342,6 +345,81 @@ error: } return NULL; } + +#else /* __MINGW32__ */ +#include +#include + +static char const* +slashify (char const *str) +{ + char *p = (char*)str; + + while (*p) + { + if (*p == '\\') + *p = '/'; + p++; + } + return str; +} + +char * +__realpath (const char *name, char *resolved) +{ + char *rpath = NULL; + + if (name == NULL) + { + /* As per Single Unix Specification V2 we must return an error if + either parameter is a null pointer. We extend this to allow + the RESOLVED parameter to be NULL in case the we are expected to + allocate the room for the return value. */ + __set_errno (EINVAL); + return NULL; + } + + if (name[0] == '\0') + { + /* As per Single Unix Specification V2 we must return an error if + the name argument points to an empty string. */ + __set_errno (ENOENT); + return NULL; + } + + if (resolved == NULL) + { + rpath = malloc (PATH_MAX + 1); + if (rpath == NULL) + { + /* It's easier to set errno to ENOMEM than to rely on the + 'malloc-posix' gnulib module. */ + errno = ENOMEM; + return NULL; + } + } + else + rpath = resolved; + + strncpy (rpath, name, PATH_MAX); + size_t len = strlen (name); + if (len > PATH_MAX) + len = PATH_MAX; + rpath[len] = '\0'; + + slashify (rpath); + struct stat st; + if (lstat (rpath, &st) < 0) + { + if (resolved == NULL) + free (rpath); + return NULL; + } + return rpath; +} + +#endif /* __MINGW32__ */ + versioned_symbol (libc, __realpath, realpath, GLIBC_2_3); #endif /* !FUNC_REALPATH_WORKS || defined _LIBC */ -- 1.7.1 --=-tzGtUz2Qe17Bn/N02IoC Content-Disposition: attachment; filename*0=0001-For-mingw-rename-exported-readdir-et-al.-to-guile_re.pat; filename*1=ch Content-Type: text/x-patch; name="0001-For-mingw-rename-exported-readdir-et-al.-to-guile_re.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit >From 208da616f6b43e3edce869aecb8e7f03e1378cd0 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 31 Jan 2011 21:43:20 +0100 Subject: [PATCH] For mingw, rename exported readdir et al. to guile_readdir, guile_*. This fixes running LilyPond, which links to glib and guile. Glib also exports "readdir" and it also installs the corresponding dirent.h, with different definitions. Eg, glib's struct dirent struct dirent { long d_ino; /* Always zero. */ unsigned short d_reclen; /* Always zero. */ unsigned short d_namlen; /* Length of name in d_name. */ char d_name[FILENAME_MAX]; /* File name. */ }; does not include off_t d_off. --- libguile/filesys.c | 5 ++++- libguile/win32-dirent.c | 4 ++-- libguile/win32-dirent.h | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libguile/filesys.c b/libguile/filesys.c index d6251a0..0a318f0 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -35,6 +35,10 @@ #include #include +#if defined (__MINGW32__) || defined (_MSC_VER) || defined (__BORLANDC__) +# include "win32-dirent.h" +#endif /* __MINGW32__ || _MSC_VER || __BORLANDC__ */ + #include "libguile/_scm.h" #include "libguile/smob.h" #include "libguile/feature.h" @@ -94,7 +98,6 @@ #if defined (__MINGW32__) || defined (_MSC_VER) || defined (__BORLANDC__) -# include "win32-dirent.h" # define NAMLEN(dirent) strlen((dirent)->d_name) /* The following bits are per AC_HEADER_DIRENT doco in the autoconf manual */ #elif HAVE_DIRENT_H diff --git a/libguile/win32-dirent.c b/libguile/win32-dirent.c index de170c7..b5b2c60 100644 --- a/libguile/win32-dirent.c +++ b/libguile/win32-dirent.c @@ -20,14 +20,14 @@ # include #endif +#include "win32-dirent.h" + #include "libguile/__scm.h" #include #include #include -#include "win32-dirent.h" - DIR * opendir (const char * name) { diff --git a/libguile/win32-dirent.h b/libguile/win32-dirent.h index 578db49..f9f8fe9 100644 --- a/libguile/win32-dirent.h +++ b/libguile/win32-dirent.h @@ -27,6 +27,14 @@ #include +#define opendir guile_opendir +#define readdir guile_readdir +#define closedir guile_closedir +#define rewinddir guile_rewinddir +#define seekdir guile_seekdir +#define telldir guile_telldir +#define dirfd guile_dirfd + struct dirstream { int fd; /* File descriptor. */ -- 1.7.1 --=-tzGtUz2Qe17Bn/N02IoC--