All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bean <bean123ch@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: mingw32 compile fixes (Re: [GITGRUB] New menu interface  (implementation))
Date: Tue, 10 Nov 2009 00:46:06 +0800	[thread overview]
Message-ID: <ca0f59980911090846o246b9cc7xf77f8b97a550412a@mail.gmail.com> (raw)
In-Reply-To: <20091109161653.GA5006@thorin>

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

On Tue, Nov 10, 2009 at 12:16 AM, Robert Millan <rmh@aybabtu.com> wrote:
> On Mon, Nov 09, 2009 at 11:55:11PM +0800, Bean wrote:
>> Sync with upstream r1810,
>
> Nice.
>
>> also fix a few compile error of grub-mkisofs
>> in mingw and ubuntu karmic.
>
> Could you perhaps send a patch for those compile fixes?

Hi,

Here is it, the compile error:

MINGW don't have fnmatch.h, add fnmatch.h to include
MINGW don't define S_IROTH, S_IRGRP and u_char
MINGW don't have lstat, getuid and getgid.
Some system such as ubuntu karmic define write using
warn_unused_result attribute, which cause a warning when return value
of write is not used. As grub compile with -Werror, this turn into
error, to work around it, use something like this:

 ssize_t tmp = write(bcat, buf, 2048);
 (void) tmp;

My branch also remove trailing blanks, but i use -w option to skip
those in the diff file.

BTW, my mingw version is 3.4.5 from windows host, it'd be nice if
someone can verify the result with newer version.

-- 
Bean

My repository: https://launchpad.net/burg
Document: https://help.ubuntu.com/community/Burg

[-- Attachment #2: mkisofs.diff --]
[-- Type: application/octet-stream, Size: 5990 bytes --]

=== modified file 'util/mkisofs/eltorito.c'
--- util/mkisofs/eltorito.c	2009-11-08 22:54:27 +0000
+++ util/mkisofs/eltorito.c	2009-11-09 15:39:57 +0000
@@ -111,7 +111,8 @@
     }
     
     buf = (char *) e_malloc( 2048 );
-    write(bcat, buf, 2048);
+    ssize_t tmp = write(bcat, buf, 2048);
+    (void) tmp;
     close(bcat);
     free(bootpath);
 } /* init_boot_catalog(... */
@@ -268,8 +269,9 @@
     /* 
      * write out 
      */
-    write(bootcat, &valid_desc, 32);
-    write(bootcat, &default_desc, 32);
+    ssize_t tmp = write(bootcat, &valid_desc, 32);
+    tmp = write(bootcat, &default_desc, 32);
+    (void) tmp;
     close(bootcat);
 } /* get_torito_desc(... */
 

=== modified file 'util/mkisofs/exclude.h'

=== modified file 'util/mkisofs/fnmatch.c'
--- util/mkisofs/fnmatch.c	2009-11-08 22:52:08 +0000
+++ util/mkisofs/fnmatch.c	2009-11-09 14:48:38 +0000
@@ -24,7 +24,7 @@
 #endif
 
 #include <errno.h>
-#include <fnmatch.h>
+#include "fnmatch.h"
 
 #ifndef	__STDC__
 #define	const

=== modified file 'util/mkisofs/hash.c'

=== added file 'util/mkisofs/include/fnmatch.h'
--- util/mkisofs/include/fnmatch.h	1970-01-01 00:00:00 +0000
+++ util/mkisofs/include/fnmatch.h	2009-11-09 14:53:34 +0000
@@ -0,0 +1,72 @@
+/* Copyright (C) 1991-93,96,97,98,99,2001,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_FNMATCH_H
+#define	_FNMATCH_H	1
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#ifndef const
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+#  define __const	const
+# else
+#  define __const
+# endif
+#endif
+
+/* We #undef these before defining them because some losing systems
+   (HP-UX A.08.07 for example) define these in <unistd.h>.  */
+#undef	FNM_PATHNAME
+#undef	FNM_NOESCAPE
+#undef	FNM_PERIOD
+
+/* Bits set in the FLAGS argument to `fnmatch'.  */
+#define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
+#define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
+#define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
+
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+# define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
+# define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
+# define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
+# define FNM_EXTMATCH	 (1 << 5)	/* Use ksh-like extended matching. */
+#endif
+
+/* Value returned by `fnmatch' if STRING does not match PATTERN.  */
+#define	FNM_NOMATCH	1
+
+/* This value is returned if the implementation does not support
+   `fnmatch'.  Since this is not the case here it will never be
+   returned but the conformance test suites still require the symbol
+   to be defined.  */
+#ifdef _XOPEN_SOURCE
+# define FNM_NOSYS	(-1)
+#endif
+
+/* Match NAME against the filename pattern PATTERN,
+   returning zero if it matches, FNM_NOMATCH if not.  */
+extern int fnmatch (__const char *__pattern, __const char *__name,
+		    int __flags);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif /* fnmatch.h */

=== modified file 'util/mkisofs/joliet.c'

=== modified file 'util/mkisofs/match.c'
--- util/mkisofs/match.c	2009-11-08 22:54:27 +0000
+++ util/mkisofs/match.c	2009-11-09 15:46:04 +0000
@@ -144,4 +144,3 @@
 {
   return (j_mat[0] != NULL);
 }
-

=== modified file 'util/mkisofs/match.h'

=== modified file 'util/mkisofs/mkisofs.c'

=== modified file 'util/mkisofs/mkisofs.h'
--- util/mkisofs/mkisofs.h	2009-11-08 22:54:27 +0000
+++ util/mkisofs/mkisofs.h	2009-11-09 15:29:59 +0000
@@ -48,6 +48,13 @@
 #define NON_UNIXFS
 #endif /* _WIN32 */
 
+#ifdef __MINGW32__
+#define S_IROTH		004
+#define S_IRGRP		040
+#undef u_char
+#define u_char		unsigned char
+#endif
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>

=== modified file 'util/mkisofs/multi.c'
--- util/mkisofs/multi.c	2009-11-08 22:52:08 +0000
+++ util/mkisofs/multi.c	2009-11-09 15:29:47 +0000
@@ -1210,4 +1210,3 @@
   
   return 1;
 }
-

=== modified file 'util/mkisofs/name.c'

=== modified file 'util/mkisofs/rock.c'
--- util/mkisofs/rock.c	2009-11-08 22:54:27 +0000
+++ util/mkisofs/rock.c	2009-11-09 15:40:31 +0000
@@ -480,7 +480,8 @@
     OK_flag = 1;
 
     zipfile = fopen(whole_name, "rb");
-    fread(header, 1, sizeof(header), zipfile);
+    ssize_t tmp = fread(header, 1, sizeof(header), zipfile);
+    (void) tmp;
 
     /* Check some magic numbers from gzip. */
     if(header[0] != 0x1f || header[1] != 0x8b || header[2] != 8) OK_flag = 0;

=== modified file 'util/mkisofs/tree.c'
--- util/mkisofs/tree.c	2009-11-08 22:54:27 +0000
+++ util/mkisofs/tree.c	2009-11-09 15:29:16 +0000
@@ -147,7 +147,11 @@
 int
 FDECL2(lstat_filter, char *, path, struct stat *, st)
 {
+#ifdef __MINGW32__
+  int result = stat(path, st);
+#else
   int result = lstat(path, st);
+#endif
   if (result >= 0 && rationalize)
     stat_fix(st);
   return result;
@@ -1880,8 +1884,13 @@
 	}
       else
 	{
+#ifdef __MINGW32__
+	  fstatbuf.st_uid = 0;
+	  fstatbuf.st_gid = 0;
+#else
 	  fstatbuf.st_uid = getuid();
 	  fstatbuf.st_gid = getgid();
+#endif
 	}
       fstatbuf.st_ctime = current_time;
       fstatbuf.st_mtime = current_time;

=== modified file 'util/mkisofs/write.c'


  reply	other threads:[~2009-11-09 16:46 UTC|newest]

Thread overview: 175+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 20:55 [GITGRUB] New menu interface (implementation) Bean
2009-09-17 10:06 ` Bean
2009-09-19 14:38 ` Michal Suchanek
2009-09-19 20:48   ` Bean
2009-09-20  8:21     ` Michal Suchanek
2009-09-20  8:30     ` Michal Suchanek
2009-09-20 18:17       ` Bean
2009-09-21  9:16         ` Michal Suchanek
2009-09-21 14:56           ` Bean
2009-09-23 11:29             ` Michal Suchanek
2009-09-23 12:11               ` Bean
2009-09-23 17:10                 ` Bean
2009-09-23 19:26                   ` Bean
2009-09-24  7:20                     ` Michal Suchanek
2009-09-24  8:51                       ` Bean
2009-09-24  9:40                         ` Michal Suchanek
2009-09-24 10:31                           ` Bean
2009-09-24 22:00                             ` Michal Suchanek
2009-09-25  8:00                               ` Bean
2009-09-25  9:00                                 ` Michal Suchanek
2009-09-25  9:12                                   ` Bean
2009-09-25  9:46                                     ` Michal Suchanek
2009-09-25 10:02                                       ` Bean
2009-09-25 10:13                                         ` Michal Suchanek
2009-09-25 10:19                                           ` Bean
2009-09-25 10:37                                             ` Michal Suchanek
2009-09-25 15:45                                               ` Bean
2009-09-27 16:12                                                 ` Michal Suchanek
2009-09-27 18:33                                                   ` Bean
2009-09-27 20:46                                                     ` Michal Suchanek
2009-09-28  3:48                                                       ` Bean
2009-09-28  9:47                                                         ` Michal Suchanek
2009-09-28 10:48                                                           ` Bean
2009-09-28 11:44                                                             ` Michal Suchanek
2009-09-30 19:52                                                               ` Bean
2009-09-30 23:21                                                                 ` Michal Suchanek
2009-10-01  5:06                                                                   ` Bean
2009-10-01  8:41                                                                     ` Michal Suchanek
2009-10-01  9:17                                                                       ` Bean
2009-10-01 10:02                                                                         ` Bean
2009-10-01 12:19                                                                           ` Bean
2009-10-01 12:44                                                                         ` Michal Suchanek
2009-10-01 13:33                                                                           ` Bean
2009-10-01 14:53                                                                             ` Michal Suchanek
2009-10-01 16:22                                                                               ` Bean
2009-10-02  9:16                                                                                 ` Bean
2009-10-02 10:42                                                                                 ` Michal Suchanek
2009-10-03 15:25                                                                                   ` Bean
2009-10-03 22:34                                                                                     ` Michal Suchanek
2009-10-04  4:27                                                                                       ` Bean
2009-10-04 11:22                                                                                         ` Michal Suchanek
2009-10-04 13:54                                                                                           ` Bean
2009-10-04 16:06                                                                                             ` richardvoigt
2009-10-04 16:16                                                                                               ` Bean
2009-10-04 20:05                                                                                                 ` Bean
2009-10-04 20:16                                                                                                   ` Bean
2009-10-04 22:20                                                                                                     ` Michal Suchanek
2009-10-04 22:21                                                                                                       ` Michal Suchanek
2009-10-05  4:45                                                                                                       ` Bean
2009-10-05  9:07                                                                                                         ` Michal Suchanek
2009-10-05 10:35                                                                                                           ` Bean
2009-10-05 13:40                                                                                                             ` Michal Suchanek
2009-10-06  6:10                                                                                                               ` Bean
2009-10-06  6:25                                                                                                                 ` richardvoigt
2009-10-05 17:52                                                                                                             ` richardvoigt
2009-10-06  5:35                                                                                                               ` Bean
2009-10-05 12:24                                                                                                           ` Bean
2009-10-05 13:33                                                                                                             ` Michal Suchanek
2009-10-06  5:33                                                                                                               ` Bean
2009-10-06  9:50                                                                                                                 ` Michal Suchanek
2009-10-06 11:08                                                                                                                   ` Bean
2009-10-06 11:46                                                                                                                     ` Michal Suchanek
2009-10-06 13:14                                                                                                                       ` Bean
2009-10-06 15:18                                                                                                                         ` Michal Suchanek
2009-10-06 16:14                                                                                                                           ` Bean
2009-10-06 16:35                                                                                                                           ` Bean
2009-10-06 18:41                                                                                                                             ` Michal Suchanek
2009-10-06 22:16                                                                                                                             ` Michal Suchanek
2009-10-07  6:05                                                                                                                               ` Bean
2009-10-07  8:54                                                                                                                                 ` Michal Suchanek
2009-10-07 10:54                                                                                                                                   ` Bean
2009-10-07 10:57                                                                                                                                   ` Bean
2009-10-07 13:05                                                                                                                                     ` Michal Suchanek
2009-10-07 21:13                                                                                                                                       ` Michal Suchanek
2009-10-08  4:20                                                                                                                                         ` Bean
2009-10-08  5:21                                                                                                                                           ` Bean
2009-10-08 11:26                                                                                                                                             ` Michal Suchanek
2009-10-08 13:26                                                                                                                                               ` Bean
2009-10-08 21:34                                                                                                                                                 ` Michal Suchanek
2009-10-09  3:45                                                                                                                                                   ` Bean
2009-10-09 11:52                                                                                                                                                     ` Michal Suchanek
2009-10-09 12:48                                                                                                                                                       ` Bean
2009-10-09 14:20                                                                                                                                                         ` Michal Suchanek
2009-10-09 14:54                                                                                                                                                           ` Bean
2009-10-09 15:57                                                                                                                                                             ` Michal Suchanek
2009-10-09 16:17                                                                                                                                                               ` Bean
2009-10-09 16:29                                                                                                                                                                 ` Michal Suchanek
2009-10-09 16:48                                                                                                                                                                   ` Bean
2009-10-09 17:27                                                                                                                                                                     ` Michal Suchanek
2009-10-09 18:32                                                                                                                                                                       ` Bean
2009-10-09 20:41                                                                                                                                                                         ` Michal Suchanek
2009-10-10  3:43                                                                                                                                                                           ` Bean
2009-10-10 11:22                                                                                                                                                                             ` Michal Suchanek
2009-10-10 19:21                                                                                                                                                                               ` Bean
2009-10-10 22:54                                                                                                                                                                                 ` Michal Suchanek
2009-10-11  3:58                                                                                                                                                                                   ` Bean
2009-10-11 10:03                                                                                                                                                                                     ` Michal Suchanek
2009-10-16 20:47                                                                                                                                                                                       ` Bean
2009-10-17 20:01                                                                                                                                                                                         ` Bean
2009-10-18 17:01                                                                                                                                                                                           ` Bean
2009-10-20 14:52                                                                                                                                                                                             ` Bean
2009-10-20 19:31                                                                                                                                                                                               ` Michal Suchanek
2009-10-21  1:01                                                                                                                                                                                                 ` Peter Cros
2009-10-21  4:07                                                                                                                                                                                                 ` Bean
2009-10-21 20:55                                                                                                                                                                                                   ` Michal Suchanek
2009-10-22  3:47                                                                                                                                                                                                     ` Bean
2009-10-20 19:20                                                                                                                                                                                             ` Michal Suchanek
2009-10-21  3:45                                                                                                                                                                                               ` Bean
2009-10-21 20:47                                                                                                                                                                                                 ` Michal Suchanek
2009-10-22  4:34                                                                                                                                                                                                   ` Bean
2009-10-22  7:41                                                                                                                                                                                                     ` Michal Suchanek
2009-10-22  8:15                                                                                                                                                                                                       ` Bean
2009-10-23  5:59                                                                                                                                                                                                         ` Peter Cros
2009-10-23  7:31                                                                                                                                                                                                           ` Bean
2009-10-24  8:04                                                                                                                                                                                                             ` Peter Cros
2009-10-25 14:27                                                                                                                                                                                                               ` Peter Cros
2009-10-26 18:24                                                                                                                                                                                                                 ` Bean
2009-10-27 17:34                                                                                                                                                                                                                   ` Bean
2009-10-28 20:29                                                                                                                                                                                                                     ` Bean
2009-10-28 21:12                                                                                                                                                                                                                       ` Vladimir 'phcoder' Serbinenko
2009-10-29  3:24                                                                                                                                                                                                                         ` Bean
2009-10-29  9:10                                                                                                                                                                                                                           ` Vladimir 'phcoder' Serbinenko
2009-10-29  9:25                                                                                                                                                                                                                             ` Bean
2009-10-29  9:33                                                                                                                                                                                                                               ` Vladimir 'phcoder' Serbinenko
2009-10-29  9:52                                                                                                                                                                                                                                 ` Bean
2009-10-30 12:07                                                                                                                                                                                                                                   ` Bean
2009-11-01 17:16                                                                                                                                                                                                                                     ` Bean
2009-11-09 15:55                                                                                                                                                                                                                                       ` Bean
2009-11-09 16:16                                                                                                                                                                                                                                         ` mingw32 compile fixes (Re: [GITGRUB] New menu interface (implementation)) Robert Millan
2009-11-09 16:46                                                                                                                                                                                                                                           ` Bean [this message]
2009-11-09 20:03                                                                                                                                                                                                                                             ` Robert Millan
2009-11-10 13:51                                                                                                                                                                                                                                               ` Bean
2009-11-09 20:04                                                                                                                                                                                                                                             ` warn_unused_result attribute (Re: mingw32 compile fixes (Re: [GITGRUB] New menu interface (implementation))) Robert Millan
2009-11-09 20:10                                                                                                                                                                                                                                               ` Felix Zielcke
2009-11-09 21:07                                                                                                                                                                                                                                                 ` Robert Millan
2009-11-09 20:20                                                                                                                                                                                                                                               ` Colin Watson
2009-10-20 19:06                                                                                                                                                                                           ` [GITGRUB] New menu interface (implementation) Michal Suchanek
2009-10-21  3:21                                                                                                                                                                                             ` Bean
2009-10-09 16:56                                                                                                                                                               ` richardvoigt
2009-10-09 17:09                                                                                                                                                                 ` Michal Suchanek
2009-10-09 18:28                                                                                                                                                                   ` richardvoigt
2009-10-09 18:49                                                                                                                                                                     ` Bean
2009-10-09 20:22                                                                                                                                                                     ` Michal Suchanek
2009-10-09 15:58                                                                                                                                                             ` Bean
2009-10-08 11:18                                                                                                                                           ` Michal Suchanek
2009-10-08 13:07                                                                                                                                             ` Bean
2009-10-08 21:46                                                                                                                                               ` Michal Suchanek
2009-10-09  3:34                                                                                                                                                 ` Bean
2009-10-09 11:48                                                                                                                                                   ` Michal Suchanek
2009-10-09 12:34                                                                                                                                                     ` Bean
2009-10-06 22:59                                                                                                                             ` Michal Suchanek
2009-10-04 21:24                                                                                                 ` Michal Suchanek
2009-10-04 21:57                                                                                             ` Michal Suchanek
2009-10-05  5:01                                                                                               ` Bean
2009-10-05  9:12                                                                                                 ` Michal Suchanek
2009-10-04 12:03                                                                                         ` Peter Cros
2009-10-04 13:26                                                                                           ` Bean
2009-09-27 23:01                                                     ` Michal Suchanek
2009-09-28  2:59                                                       ` Bean
2009-09-28  9:32                                                         ` Michal Suchanek
2009-09-19 18:45 ` Michal Suchanek
2009-09-19 18:55   ` richardvoigt
2009-09-20  8:31     ` Michal Suchanek
2009-09-20 18:51       ` richardvoigt
2009-09-21  9:23         ` Michal Suchanek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca0f59980911090846o246b9cc7xf77f8b97a550412a@mail.gmail.com \
    --to=bean123ch@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.