Re: [PATCH] Use _W64 to detect MinGW W64-32 instead of _FILE_OFFSET_BITS

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 14.01.2014 04:05, Andrey Borzenkov wrote:
> +/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */
Do you mean 64-bit ?



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] reintroduce BUILD_LDFLAGS for the cross-compile case

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
Go ahead.
On 12.01.2014 13:11, Andrey Borzenkov wrote:
> This allows providing separate LDFLAGS for build and host environment, which
> are not necessary the same for cross-compile case. In particular, it allows
> building host programs statically to not depend on presence of libraries at
> run-time (e.g. MinGW environment on Windows) while continue to use default
> build time dynamic linking.
> 
> Also fix obsolete comments in confgure.ac - we do use different environment
> for build and host now.
> 
> In principle, it would be enough to just reset LDFLAGS before
> performing build time tests, but I think this functionality is useful
> by itself (e.g. to be able to link with libraries in non-standard
> location). And patch itself it trivial enough.
> 
> Attached because git won't send mail with so long lines.
> 
> 
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Ignore EPERM when modifying kern.geom.debugflags

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
go ahead
On 17.01.2014 03:55, Colin Watson wrote:
> Many tests fail when run as a non-root user on FreeBSD.  The failures
> all amount to an inability to open files using grub_util_fd_open,
> because we cannot set the kern.geom.debugflags sysctl.  This sysctl is
> indeed important to allow us to do such things as installing GRUB to the
> MBR, but if we need to do that and can't then we will get an error
> later.  Enforcing it here is unnecessary and prevents otherwise
> perfectly reasonable operations.
> ---
>  grub-core/osdep/freebsd/hostdisk.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/osdep/freebsd/hostdisk.c 
> b/grub-core/osdep/freebsd/hostdisk.c
> index eb202dc..6145d07 100644
> --- a/grub-core/osdep/freebsd/hostdisk.c
> +++ b/grub-core/osdep/freebsd/hostdisk.c
> @@ -102,8 +102,16 @@ grub_util_fd_open (const char *os_dev, int flags)
>if (! (sysctl_oldflags & 0x10)
>&& sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, 
> sysctl_size))
>  {
> -  grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl 
> kern.geom.debugflags");
> -  return GRUB_UTIL_FD_INVALID;
> +  if (errno == EPERM)
> + /* Running as an unprivileged user; don't worry about restoring
> +flags, although if we try to write to anything interesting such
> +as the MBR then we may fail later.  */
> + sysctl_oldflags = 0x10;
> +  else
> + {
> +   grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl 
> kern.geom.debugflags");
> +   return GRUB_UTIL_FD_INVALID;
> + }
>  }
>  
>ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Use _W64 to detect MinGW W64-32 instead of _FILE_OFFSET_BITS

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 16:22:21 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 14.01.2014 04:05, Andrey Borzenkov wrote:
> > +/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */
> Do you mean 64-bit ?
> 

No, I mean exactly 32 bit. 'Mingw w64" is project (toolchain) name; it
can produce both 32 bit and 64 bit programs. 64 bit is already covered
by __MINGW64__, but in 32 bit case we need to differentiate between
native MinGW and Mingw w64 building for 32 bit.


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Use _W64 to detect MinGW W64-32 instead of _FILE_OFFSET_BITS

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 16:53, Andrey Borzenkov wrote:
> В Sat, 18 Jan 2014 16:22:21 +0100
> Vladimir 'φ-coder/phcoder' Serbinenko  пишет:
> 
>> On 14.01.2014 04:05, Andrey Borzenkov wrote:
>>> +/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */
>> Do you mean 64-bit ?
>>
> 
> No, I mean exactly 32 bit. 'Mingw w64" is project (toolchain) name; it
> can produce both 32 bit and 64 bit programs. 64 bit is already covered
> by __MINGW64__, but in 32 bit case we need to differentiate between
> native MinGW and Mingw w64 building for 32 bit.
> 
I see.
Go ahead.
> 
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] Improve DejaVuSans detection

2014-01-18 Thread Andrey Borzenkov
Look also in /usr/share/fonts/truetype, it is installed in this path on
openSUSE.

Prefer DejaVuSansMono if found, on openSUSE DejaVuSans is proportional font.

Add detected path name to summary output.

---
 configure.ac | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2e4cf3c..98f6012 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1378,11 +1378,13 @@ fi
 
 if test x"$starfield_excuse" = x; then
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
- for dir in . /usr/src /usr/share/fonts/X11/misc 
/usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
-if test -f "$dir/DejaVuSans.$ext"; then
-  DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
-  break 2
-fi
+ for dir in . /usr/src /usr/share/fonts/X11/misc 
/usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu 
/usr/share/fonts/truetype; do
+   for font in DejaVuSansMono DejaVuSans; do
+ if test -f "$dir/$font.$ext"; then
+   DJVU_FONT_SOURCE="$dir/$font.$ext"
+   break 2
+ fi
+   done
  done
done
 
@@ -1805,6 +1807,7 @@ echo grub-mount: No "($grub_mount_excuse)"
 fi
 if [ x"$starfield_excuse" = x ]; then
 echo starfield theme: Yes
+echo With DejaVuSans font from $DJVU_FONT_SOURCE
 else
 echo starfield theme: No "($starfield_excuse)"
 fi
-- 
tg: (dcecae1..) u/dejavu-path (depends on: master)

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h

2014-01-18 Thread Andrey Borzenkov
In file included from util/misc.c:36:0:
./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized 
format function type [-Werror=format=]
 char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2))) WARN_UNUSED_RESULT;
 ^
./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized 
format function type [-Werror=format=]

The reason is libintl.h which redefines printf as libintl_printf. The problem
is not present in native MinGW build which avoids redefinition.  Use
(format (__printf__) instead which is valid replacement in GCC.

v2: add grub-core/lib/libgcrypt/src/g10lib.h

---
 grub-core/lib/libgcrypt/src/g10lib.h | 4 ++--
 include/grub/crypto.h| 2 +-
 include/grub/emu/misc.h  | 8 
 include/grub/err.h   | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/grub-core/lib/libgcrypt/src/g10lib.h 
b/grub-core/lib/libgcrypt/src/g10lib.h
index 6bde20f..85a51be 100644
--- a/grub-core/lib/libgcrypt/src/g10lib.h
+++ b/grub-core/lib/libgcrypt/src/g10lib.h
@@ -47,9 +47,9 @@
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
 #define JNLIB_GCC_M_FUNCTION 1
 #define JNLIB_GCC_A_NR  __attribute__ ((noreturn))
-#define JNLIB_GCC_A_PRINTF( f, a )  __attribute__ ((format (printf,f,a)))
+#define JNLIB_GCC_A_PRINTF( f, a )  __attribute__ ((format (__printf__,f,a)))
 #define JNLIB_GCC_A_NR_PRINTF( f, a ) \
-   __attribute__ ((noreturn, format (printf,f,a)))
+   __attribute__ ((noreturn, format (__printf__,f,a)))
 #define GCC_ATTR_NORETURN  __attribute__ ((__noreturn__))
 #else
 #define JNLIB_GCC_A_NR
diff --git a/include/grub/crypto.h b/include/grub/crypto.h
index ec1b980..a24e89d 100644
--- a/include/grub/crypto.h
+++ b/include/grub/crypto.h
@@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char 
*file, int line,
   const char *func) __attribute__ ((noreturn));
 
 void _gcry_burn_stack (int bytes);
-void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format (printf, 
1, 2)));
+void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format 
(__printf__, 1, 2)));
 
 
 #ifdef GRUB_UTIL
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
index dde48c1..a588ba2 100644
--- a/include/grub/emu/misc.h
+++ b/include/grub/emu/misc.h
@@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev);
 void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
 void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
 char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
-char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2))) WARN_UNUSED_RESULT;
+char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2))) WARN_UNUSED_RESULT;
 
-void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2)));
-void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2)));
-void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
((format (printf, 1, 2), noreturn));
+void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2)));
+void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2)));
+void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
((format (__printf__, 1, 2), noreturn));
 
 grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
 
diff --git a/include/grub/err.h b/include/grub/err.h
index 9896fcc..1590c68 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void);
 void EXPORT_FUNC(grub_print_error) (void);
 extern int EXPORT_VAR(grub_err_printed_errors);
 int grub_err_printf (const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__ ((format (__printf__, 1, 2)));
 
 #endif /* ! GRUB_ERR_HEADER */
-- 
tg: (5ef569d..) u/mingw/attribute_printf (depends on: master)

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] add BUILD_EXEEXT support to fix make clean on Windows

2014-01-18 Thread Andrey Borzenkov
Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
appropriate.

---
 Makefile.am   | 16 
 Makefile.util.def |  2 +-
 configure.ac  | 21 -
 grub-core/Makefile.am | 14 --
 4 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1bbec0e..aa526f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,22 +66,22 @@ endif
 
 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png 
$(srcdir)/themes/starfield/boot_menu_c.png 
$(srcdir)/themes/starfield/boot_menu_e.png 
$(srcdir)/themes/starfield/boot_menu_ne.png 
$(srcdir)/themes/starfield/boot_menu_n.png 
$(srcdir)/themes/starfield/boot_menu_nw.png 
$(srcdir)/themes/starfield/boot_menu_se.png 
$(srcdir)/themes/starfield/boot_menu_s.png 
$(srcdir)/themes/starfield/boot_menu_sw.png 
$(srcdir)/themes/starfield/boot_menu_w.png 
$(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png 
$(srcdir)/themes/starfield/slider_s.png 
$(srcdir)/themes/starfield/starfield.png 
$(srcdir)/themes/starfield/terminal_box_c.png 
$(srcdir)/themes/starfield/terminal_box_e.png 
$(srcdir)/themes/starfield/terminal_box_ne.png 
$(srcdir)/themes/starfield/terminal_box_n.png 
$(srcdir)/themes/starfield/terminal_box_nw.png 
$(srcdir)/themes/starfield/terminal_box_se.png 
$(srcdir)/themes/starfield/terminal_box_s.png 
$(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/t
 hemes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt 
$(srcdir)/themes/starfield/README 
$(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
 
-build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c 
grub-core/kern/emu/misc.c util/misc.c
+build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c 
grub-core/kern/emu/misc.c util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
$(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 
-DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) 
$(build_freetype_libs)
-CLEANFILES += build-grub-mkfont
+CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
 
-garbage-gen: util/garbage-gen.c
+garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
-CLEANFILES += garbage-gen
+CLEANFILES += garbage-gen$(BUILD_EXEEXT)
 EXTRA_DIST += util/garbage-gen.c
 
-build-grub-gen-asciih: util/grub-gen-asciih.c
+build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
$(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 
$^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
-CLEANFILES += build-grub-gen-asciih
+CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
 
-build-grub-gen-widthspec: util/grub-gen-widthspec.c
+build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
$(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 
$^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
-CLEANFILES += build-grub-gen-widthspec
+CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
 
 if COND_STARFIELD
 starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 
dejavu_16.pf2 $(starfield_theme_files)
diff --git a/Makefile.util.def b/Makefile.util.def
index 3c99be2..83df212 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -708,7 +708,7 @@ script = {
   name = grub-fs-tester;
   common = tests/util/grub-fs-tester.in;
   installdir = noinst;
-  dependencies = garbage-gen;
+  dependencies = 'garbage-gen$(BUILD_EXEEXT)';
 };
 
 script = {
diff --git a/configure.ac b/configure.ac
index 2e4cf3c..cf3de3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
 # We don't want -g -O2 by default in CFLAGS
 : ${CFLAGS=""}
 
-# Checks for host and target systems.
+# Checks for build, host and target systems.
+AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 save_program_prefix="${program_prefix}"
 AC_CANONICAL_TARGET
@@ -422,6 +423,16 @@ case "$build_os" in
   haiku*)  BUILD_LIBM= ;;
   *)   BUILD_LIBM=-lm ;;
 esac
+
+dnl FIXME proper test seems to require too deep dive into Autoconf internals.
+dnl For now just list known platforms that we support.
+
+case "$build_os" in
+  cygwin*|mingw32*|mingw64*)   BUILD_EXEEXT=.exe ;;
+  *)   BUILD_EXEEXT= ;;
+esac
+AC_SUBST(BUILD_EXEEXT)
+
 # For gnulib.
 gl_INIT
 
@@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then
 *windows* | *cygwin* | *mingw*)
   if test x${target_cpu} = xi386 ; then
 grub_cv_target_cc_link_format=-mi386pe;
-   TARGET_OBJ2ELF='./build-grub-pe2elf';
+   TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
   fi
   if test x${target_

Re: [PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 17:09, Andrey Borzenkov wrote:
> In file included from util/misc.c:36:0:
> ./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized 
> format function type [-Werror=format=]
>  char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
> (printf, 1, 2))) WARN_UNUSED_RESULT;
>  ^
> ./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized 
> format function type [-Werror=format=]
> 
> The reason is libintl.h which redefines printf as libintl_printf. The problem
> is not present in native MinGW build which avoids redefinition.  Use
> (format (__printf__) instead which is valid replacement in GCC.
> 
> v2: add grub-core/lib/libgcrypt/src/g10lib.h
> 
can we avoid modifying libgcrypt?
> ---
>  grub-core/lib/libgcrypt/src/g10lib.h | 4 ++--
>  include/grub/crypto.h| 2 +-
>  include/grub/emu/misc.h  | 8 
>  include/grub/err.h   | 2 +-
>  4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/grub-core/lib/libgcrypt/src/g10lib.h 
> b/grub-core/lib/libgcrypt/src/g10lib.h
> index 6bde20f..85a51be 100644
> --- a/grub-core/lib/libgcrypt/src/g10lib.h
> +++ b/grub-core/lib/libgcrypt/src/g10lib.h
> @@ -47,9 +47,9 @@
>  #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
>  #define JNLIB_GCC_M_FUNCTION 1
>  #define JNLIB_GCC_A_NR__attribute__ ((noreturn))
> -#define JNLIB_GCC_A_PRINTF( f, a )  __attribute__ ((format (printf,f,a)))
> +#define JNLIB_GCC_A_PRINTF( f, a )  __attribute__ ((format (__printf__,f,a)))
>  #define JNLIB_GCC_A_NR_PRINTF( f, a ) \
> - __attribute__ ((noreturn, format (printf,f,a)))
> + __attribute__ ((noreturn, format (__printf__,f,a)))
>  #define GCC_ATTR_NORETURN  __attribute__ ((__noreturn__))
>  #else
>  #define JNLIB_GCC_A_NR
> diff --git a/include/grub/crypto.h b/include/grub/crypto.h
> index ec1b980..a24e89d 100644
> --- a/include/grub/crypto.h
> +++ b/include/grub/crypto.h
> @@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char 
> *file, int line,
>const char *func) __attribute__ ((noreturn));
>  
>  void _gcry_burn_stack (int bytes);
> -void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format 
> (printf, 1, 2)));
> +void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format 
> (__printf__, 1, 2)));
>  
>  
>  #ifdef GRUB_UTIL
> diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
> index dde48c1..a588ba2 100644
> --- a/include/grub/emu/misc.h
> +++ b/include/grub/emu/misc.h
> @@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev);
>  void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
>  void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) 
> WARN_UNUSED_RESULT;
>  char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
> -char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
> (printf, 1, 2))) WARN_UNUSED_RESULT;
> +char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
> (__printf__, 1, 2))) WARN_UNUSED_RESULT;
>  
> -void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ 
> ((format (printf, 1, 2)));
> -void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ 
> ((format (printf, 1, 2)));
> -void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
> ((format (printf, 1, 2), noreturn));
> +void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ 
> ((format (__printf__, 1, 2)));
> +void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ 
> ((format (__printf__, 1, 2)));
> +void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
> ((format (__printf__, 1, 2), noreturn));
>  
>  grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
>  
> diff --git a/include/grub/err.h b/include/grub/err.h
> index 9896fcc..1590c68 100644
> --- a/include/grub/err.h
> +++ b/include/grub/err.h
> @@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void);
>  void EXPORT_FUNC(grub_print_error) (void);
>  extern int EXPORT_VAR(grub_err_printed_errors);
>  int grub_err_printf (const char *fmt, ...)
> - __attribute__ ((format (printf, 1, 2)));
> + __attribute__ ((format (__printf__, 1, 2)));
>  
>  #endif /* ! GRUB_ERR_HEADER */
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Improve DejaVuSans detection

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 16:58, Andrey Borzenkov wrote:
> Look also in /usr/share/fonts/truetype, it is installed in this path on
> openSUSE.
> 
> Prefer DejaVuSansMono if found, on openSUSE DejaVuSans is proportional font.
> 
It's not right solution. Proportional fonts must be preffered for
themes. Only terminal requires monospace fonts. You need to set
gfxterm_font to unifont name.
> Add detected path name to summary output.
> 
> ---
>  configure.ac | 13 -
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 2e4cf3c..98f6012 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1378,11 +1378,13 @@ fi
>  
>  if test x"$starfield_excuse" = x; then
> for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
> - for dir in . /usr/src /usr/share/fonts/X11/misc 
> /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
> -if test -f "$dir/DejaVuSans.$ext"; then
> -  DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
> -  break 2
> -fi
> + for dir in . /usr/src /usr/share/fonts/X11/misc 
> /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu 
> /usr/share/fonts/truetype; do
> + for font in DejaVuSansMono DejaVuSans; do
> +   if test -f "$dir/$font.$ext"; then
> + DJVU_FONT_SOURCE="$dir/$font.$ext"
> + break 2
> +   fi
> + done
>   done
> done
>  
> @@ -1805,6 +1807,7 @@ echo grub-mount: No "($grub_mount_excuse)"
>  fi
>  if [ x"$starfield_excuse" = x ]; then
>  echo starfield theme: Yes
> +echo With DejaVuSans font from $DJVU_FONT_SOURCE
>  else
>  echo starfield theme: No "($starfield_excuse)"
>  fi
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] add GRUB_WINDOWS_DLLS to make windowsdir to allow shipping runtime files

2014-01-18 Thread Andrey Borzenkov
Not all toolkits provide static libraries. This patch enables creation of self
contained distribution that does not require pre-existing runtime libraries.
Intended usage is

export GRUB_EXTRA_DLLS="/path/to/liblzma.dll /path/to/libintl.dll"
make
make windowszip

As those libraries and locations are dependent on toolchain in use, trying
to autodetect them is likely impossible. So just provide a simple way to
package everything in one step.

Also remove $(windowsdir) after ZIP was created same as other "make dist"
targets.

---
 Makefile.am | 4 
 1 file changed, 4 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 1bbec0e..649a10b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -420,10 +420,14 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
for x in $(starfield_DATA); do \
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
done
+   for x in $(GRUB_WINDOWS_DLLS); do \
+   cp -fp $$x $(windowsdir); \
+   done
 
 windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip
 windowszip: windowsdir
test -f $(windowszip) && rm $(windowszip) || true
zip -r $(windowszip) $(windowsdir)
+   rm -rf $(windowsdir)
 
 EXTRA_DIST += linguas.sh
-- 
tg: (5ef569d..) u/mingw/extra_windows_dist (depends on: master)

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Andrey Borzenkov
MinGW native nm does not support ELF binaries. While on it, pass detected
nm arguments instead of hardcoding them.

---
 grub-core/Makefile.am | 6 +++---
 grub-core/genemuinit.sh   | 9 +
 grub-core/genemuinitheader.sh | 9 +
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 13b7979..704ae90 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -292,12 +292,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
 
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
-   rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh 
$(TARGET_NM) > $@
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
+   rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh 
$(TARGET_NM) $(TARGET_NMFLAGS_MINUS_P) $(TARGET_NMFLAGS_DEFINED_ONLY) > $@
 CLEANFILES += grub_emu_init.h
 
 grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
-   rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > 
$@
+   rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh 
$(TARGET_NM) $(TARGET_NMFLAGS_MINUS_P) $(TARGET_NMFLAGS_DEFINED_ONLY) > $@
 CLEANFILES += grub_emu_init.c
 endif
 
diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh
index 45c15ec..58fb604 100644
--- a/grub-core/genemuinit.sh
+++ b/grub-core/genemuinit.sh
@@ -13,6 +13,7 @@
 
 nm="$1"
 shift
+nmargs="$*"
 
 cat < /dev/null; then
-  echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_init > /dev/null; then
+  echo "grub_${line%%.*}_init ();"
   fi
 done
 
@@ -62,8 +63,8 @@ grub_fini_all (void)
 EOF
 
 for line in $mods; do
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-  echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_fini > /dev/null; then
+  echo "grub_${line%%.*}_fini ();"
   fi
 done
 
diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh
index 6b83f59..8631157 100644
--- a/grub-core/genemuinitheader.sh
+++ b/grub-core/genemuinitheader.sh
@@ -13,6 +13,7 @@
 
 nm="$1"
 shift
+nmargs="$*"
 
 cat < /dev/null; then
-  echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_init > /dev/null; then
+  echo "void grub_${line%%.*}_init (void);"
   fi
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-  echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_fini > /dev/null; then
+  echo "void grub_${line%%.*}_fini (void);"
   fi
 done
-- 
tg: (5ef569d..) u/mingw/use_MODULE_FILES_for_genemu (depends on: master)

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] add BUILD_EXEEXT support to fix make clean on Windows

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
Go ahead.
On 18.01.2014 17:20, Andrey Borzenkov wrote:
> Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
> appropriate.
> 
> ---
>  Makefile.am   | 16 
>  Makefile.util.def |  2 +-
>  configure.ac  | 21 -
>  grub-core/Makefile.am | 14 --
>  4 files changed, 33 insertions(+), 20 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 1bbec0e..aa526f5 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -66,22 +66,22 @@ endif
>  
>  starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png 
> $(srcdir)/themes/starfield/boot_menu_c.png 
> $(srcdir)/themes/starfield/boot_menu_e.png 
> $(srcdir)/themes/starfield/boot_menu_ne.png 
> $(srcdir)/themes/starfield/boot_menu_n.png 
> $(srcdir)/themes/starfield/boot_menu_nw.png 
> $(srcdir)/themes/starfield/boot_menu_se.png 
> $(srcdir)/themes/starfield/boot_menu_s.png 
> $(srcdir)/themes/starfield/boot_menu_sw.png 
> $(srcdir)/themes/starfield/boot_menu_w.png 
> $(srcdir)/themes/starfield/slider_c.png 
> $(srcdir)/themes/starfield/slider_n.png 
> $(srcdir)/themes/starfield/slider_s.png 
> $(srcdir)/themes/starfield/starfield.png 
> $(srcdir)/themes/starfield/terminal_box_c.png 
> $(srcdir)/themes/starfield/terminal_box_e.png 
> $(srcdir)/themes/starfield/terminal_box_ne.png 
> $(srcdir)/themes/starfield/terminal_box_n.png 
> $(srcdir)/themes/starfield/terminal_box_nw.png 
> $(srcdir)/themes/starfield/terminal_box_se.png 
> $(srcdir)/themes/starfield/terminal_box_s.png 
> $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/
themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt 
$(srcdir)/themes/starfield/README 
$(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
>  
> -build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c 
> grub-core/kern/emu/misc.c util/misc.c
> +build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c 
> grub-core/kern/emu/misc.c util/misc.c
>   $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
> $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 
> -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ 
> $(build_freetype_cflags) $(build_freetype_libs)
> -CLEANFILES += build-grub-mkfont
> +CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
>  
> -garbage-gen: util/garbage-gen.c
> +garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
>   $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
> -CLEANFILES += garbage-gen
> +CLEANFILES += garbage-gen$(BUILD_EXEEXT)
>  EXTRA_DIST += util/garbage-gen.c
>  
> -build-grub-gen-asciih: util/grub-gen-asciih.c
> +build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
>   $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
> $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 
> -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> -CLEANFILES += build-grub-gen-asciih
> +CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
>  
> -build-grub-gen-widthspec: util/grub-gen-widthspec.c
> +build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
>   $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) 
> $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 
> -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> -CLEANFILES += build-grub-gen-widthspec
> +CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
>  
>  if COND_STARFIELD
>  starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 
> dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
> diff --git a/Makefile.util.def b/Makefile.util.def
> index 3c99be2..83df212 100644
> --- a/Makefile.util.def
> +++ b/Makefile.util.def
> @@ -708,7 +708,7 @@ script = {
>name = grub-fs-tester;
>common = tests/util/grub-fs-tester.in;
>installdir = noinst;
> -  dependencies = garbage-gen;
> +  dependencies = 'garbage-gen$(BUILD_EXEEXT)';
>  };
>  
>  script = {
> diff --git a/configure.ac b/configure.ac
> index 2e4cf3c..cf3de3b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
>  # We don't want -g -O2 by default in CFLAGS
>  : ${CFLAGS=""}
>  
> -# Checks for host and target systems.
> +# Checks for build, host and target systems.
> +AC_CANONICAL_BUILD
>  AC_CANONICAL_HOST
>  save_program_prefix="${program_prefix}"
>  AC_CANONICAL_TARGET
> @@ -422,6 +423,16 @@ case "$build_os" in
>haiku*)BUILD_LIBM= ;;
>*) BUILD_LIBM=-lm ;;
>  esac
> +
> +dnl FIXME proper test seems to require too deep dive into Autoconf internals.
> +dnl For now just list known platforms that we support.
> +
> +case "$build_os" in
> +  cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
> +  *) BUILD_EXEEXT= ;;
> +esac
> +AC_SUBST(BUILD_EXEEXT)
> +
>  # For gnulib.
>  gl_INIT
>  
> @@ -765,11 +776,11 @@ if test x"$platform

Re: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 17:27, Andrey Borzenkov wrote:
>  While on it, pass detected
> nm arguments instead of hardcoding them.
please make this part a separate patch. This would indicate that you
support non-portable nm output which in this branch isn't the case. Why
do you need it in the first place?



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Improve DejaVuSans detection

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 17:26:16 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 16:58, Andrey Borzenkov wrote:
> > Look also in /usr/share/fonts/truetype, it is installed in this path on
> > openSUSE.
> > 
> > Prefer DejaVuSansMono if found, on openSUSE DejaVuSans is proportional font.
> > 
> It's not right solution. Proportional fonts must be preffered for
> themes. Only terminal requires monospace fonts. You need to set
> gfxterm_font to unifont name.

But then not gfxterm_font, but we need to set it in theme definition.
gfxterm_font is optional and theme must still work without it.

From: Andrey Borzenkov 
Subject: [PATCH] Improve DejaVuSans detection and fix starfield terminal font

Look also in /usr/share/fonts/truetype, it is installed in this path on
openSUSE.

Add detected path name to summary output.

Set terminal font to unifont in starfield; DejaVuSans is proportional and looks
bad in terminal window.

---
 configure.ac   | 3 ++-
 themes/starfield/theme.txt | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index cf3de3b..c2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1389,7 +1389,7 @@ fi
 
 if test x"$starfield_excuse" = x; then
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
- for dir in . /usr/src /usr/share/fonts/X11/misc 
/usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
+ for dir in . /usr/src /usr/share/fonts/X11/misc 
/usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu 
/usr/share/fonts/truetype; do
 if test -f "$dir/DejaVuSans.$ext"; then
   DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
   break 2
@@ -1816,6 +1816,7 @@ echo grub-mount: No "($grub_mount_excuse)"
 fi
 if [ x"$starfield_excuse" = x ]; then
 echo starfield theme: Yes
+echo With DejaVuSans font from $DJVU_FONT_SOURCE
 else
 echo starfield theme: No "($starfield_excuse)"
 fi
diff --git a/themes/starfield/theme.txt b/themes/starfield/theme.txt
index 5ec871b..b3b8d85 100644
--- a/themes/starfield/theme.txt
+++ b/themes/starfield/theme.txt
@@ -25,7 +25,7 @@ message-font: "DejaVu Sans Regular 12"
 message-color: "#000"
 message-bg-color: "#fff"
 terminal-box: "terminal_box_*.png"
-terminal-font: "DejaVu Sans Regular 12"
+terminal-font: "Gnu Unifont Mono Regular 16"
 desktop-image: "starfield.png"
 
 #help bar at the bottom
-- 
tg: (1ecf96f..) u/dejavu-path (depends on: master)


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 17:55:38 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 17:27, Andrey Borzenkov wrote:
> >  While on it, pass detected
> > nm arguments instead of hardcoding them.
> please make this part a separate patch.

is it OK to commit without this part?

> This would indicate that you
> support non-portable nm output which in this branch isn't the case. Why
> do you need it in the first place?
> 

I do not need it for MinGW case; but it just looks incorrect in general
case - first we check nm arguments and then ignore it. I agree that
mixing two patches was wrong on my side.


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: conflicting types for 'grub_list_push' on MinGW (include loop)

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 15.01.2014 19:14, Andrey Borzenkov wrote:
> + *  Copyright (C) 2014  Free Software Foundation, Inc.
please preserve copyright years when copying code around (just copying
whole string and adding 2104 is fine)
Otherwise, go ahead.



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: conflicting types for 'grub_list_push' on MinGW (include loop)

2014-01-18 Thread SevenBits
On Jan 18, 2014, at 12:12 PM, Vladimir 'φ-coder/phcoder' Serbinenko 
 wrote:

> On 15.01.2014 19:14, Andrey Borzenkov wrote:
>> + *  Copyright (C) 2014  Free Software Foundation, Inc.
> please preserve copyright years when copying code around (just copying
> whole string and adding 2104 is fine)

I assume you meant 2014.

> Otherwise, go ahead.
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 18:12, Andrey Borzenkov wrote:
> В Sat, 18 Jan 2014 17:55:38 +0100
> Vladimir 'φ-coder/phcoder' Serbinenko  пишет:
> 
>> On 18.01.2014 17:27, Andrey Borzenkov wrote:
>>>  While on it, pass detected
>>> nm arguments instead of hardcoding them.
>> please make this part a separate patch.
> 
> is it OK to commit without this part?
> 
could you send the remaining part alone? It's difficult to see throught
intermingled patch.
>> This would indicate that you
>> support non-portable nm output which in this branch isn't the case. Why
>> do you need it in the first place?
>>
> 
> I do not need it for MinGW case; but it just looks incorrect in general
> case - first we check nm arguments and then ignore it.
Because relevant support in scripts isn't available yet.
> I agree that
> mixing two patches was wrong on my side.
> 
> 
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] fix removal of {cpu,machine} links on mingw/msys

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 28.12.2013 10:58, Andrey Borzenkov wrote:
> At least on Windows 2003 using "ln -s dir1 dir2" in msys shell succeeds,
> but results in what looks like hard link. Subsequent "rm -f dir2" (e.g.
> during second config.status invocation) fails. Check that we also can
> remove link to directory.
> 
> Make it more clear in message that we are checking "ln -s".
> 
Is there a way to reliably remove result of such test? We don't want to
leave a weird file after the test behind. Perhaps rm -rf since we know
that we test with newly-created directory?
> ---
>  acinclude.m4 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/acinclude.m4 b/acinclude.m4
> index 32d5477..b2bb88d 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -418,15 +418,15 @@ else
>  [fi]
>  ])
>  
> -dnl Check if ln can handle directories properly (mingw).
> +dnl Check if ln -s can handle directories properly (mingw).
>  AC_DEFUN([grub_CHECK_LINK_DIR],[
> -AC_MSG_CHECKING([whether ln can handle directories properly])
> +AC_MSG_CHECKING([whether ln -s can handle directories properly])
>  [mkdir testdir 2>/dev/null
>  case $srcdir in
>  [\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;;
>  *) reldir=../$srcdir/include/grub/util ;;
>  esac
> -if ln -s $reldir testdir/util 2>/dev/null ; then]
> +if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null 
> ; then]
>AC_MSG_RESULT([yes])
>[link_dir=yes
>  else
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] fix removal of {cpu,machine} links on mingw/msys

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 19:14:43 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 28.12.2013 10:58, Andrey Borzenkov wrote:
> > At least on Windows 2003 using "ln -s dir1 dir2" in msys shell succeeds,
> > but results in what looks like hard link. Subsequent "rm -f dir2" (e.g.
> > during second config.status invocation) fails. Check that we also can
> > remove link to directory.
> > 
> > Make it more clear in message that we are checking "ln -s".
> > 
> Is there a way to reliably remove result of such test? We don't want to
> leave a weird file after the test behind. Perhaps rm -rf since we know
> that we test with newly-created directory?

Test does "rm -rf testdir" at the end already and it removes this.


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 19:08:35 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 18:12, Andrey Borzenkov wrote:
> > В Sat, 18 Jan 2014 17:55:38 +0100
> > Vladimir 'φ-coder/phcoder' Serbinenko  пишет:
> > 
> >> On 18.01.2014 17:27, Andrey Borzenkov wrote:
> >>>  While on it, pass detected
> >>> nm arguments instead of hardcoding them.
> >> please make this part a separate patch.
> > 
> > is it OK to commit without this part?
> > 
> could you send the remaining part alone? It's difficult to see throught
> intermingled patch.

From: Andrey Borzenkov 
Subject: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

MinGW native nm does not support ELF binaries.

---
 grub-core/Makefile.am | 6 +++---
 grub-core/genemuinit.sh   | 4 ++--
 grub-core/genemuinitheader.sh | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index 826b3dd..61aa166 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
 
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
-   rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh 
$(TARGET_NM) > $@
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
+   rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh 
$(TARGET_NM) > $@
 CLEANFILES += grub_emu_init.h
 
 grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
-   rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > 
$@
+   rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh 
$(TARGET_NM) > $@
 CLEANFILES += grub_emu_init.c
 endif
 
diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh
index 45c15ec..8c6bb1c 100644
--- a/grub-core/genemuinit.sh
+++ b/grub-core/genemuinit.sh
@@ -47,7 +47,7 @@ EOF
 read mods
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-  echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
+  echo "grub_${line%%.*}_init ();"
   fi
 done
 
@@ -63,7 +63,7 @@ EOF
 
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-  echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
+  echo "grub_${line%%.*}_fini ();"
   fi
 done
 
diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh
index 6b83f59..a99a15d 100644
--- a/grub-core/genemuinitheader.sh
+++ b/grub-core/genemuinitheader.sh
@@ -44,9 +44,9 @@ EOF
 read mods
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-  echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
+  echo "void grub_${line%%.*}_init (void);"
   fi
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-  echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
+  echo "void grub_${line%%.*}_fini (void);"
   fi
 done
-- 
tg: (6c519b5..) u/mingw/use_MODULE_FILES_for_genemu (depends on: master)


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] fix removal of {cpu,machine} links on mingw/msys

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 19:32, Andrey Borzenkov wrote:
> В Sat, 18 Jan 2014 19:14:43 +0100
> Vladimir 'φ-coder/phcoder' Serbinenko  пишет:
> 
>> On 28.12.2013 10:58, Andrey Borzenkov wrote:
>>> At least on Windows 2003 using "ln -s dir1 dir2" in msys shell succeeds,
>>> but results in what looks like hard link. Subsequent "rm -f dir2" (e.g.
>>> during second config.status invocation) fails. Check that we also can
>>> remove link to directory.
>>>
>>> Make it more clear in message that we are checking "ln -s".
>>>
>> Is there a way to reliably remove result of such test? We don't want to
>> leave a weird file after the test behind. Perhaps rm -rf since we know
>> that we test with newly-created directory?
> 
> Test does "rm -rf testdir" at the end already and it removes this.
> 
Go ahead then.
> 
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 17:24:53 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 17:09, Andrey Borzenkov wrote:
> > In file included from util/misc.c:36:0:
> > ./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized 
> > format function type [-Werror=format=]
> >  char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ 
> > ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
> >  ^
> > ./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized 
> > format function type [-Werror=format=]
> > 
> > The reason is libintl.h which redefines printf as libintl_printf. The 
> > problem
> > is not present in native MinGW build which avoids redefinition.  Use
> > (format (__printf__) instead which is valid replacement in GCC.
> > 
> > v2: add grub-core/lib/libgcrypt/src/g10lib.h
> > 
> can we avoid modifying libgcrypt?

Well, we can do it during import?

From: Andrey Borzenkov 
Subject: [PATCH v3] fix Mingw W64-32 cross compile failure due to printf 
redefinition in libintl.h

In file included from util/misc.c:36:0:
./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized 
format function type [-Werror=format=]
 char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2))) WARN_UNUSED_RESULT;
 ^
./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized 
format function type [-Werror=format=]

The reason is libintl.h which redefines printf as libintl_printf. The problem
is not present in native MinGW build which avoids redefinition.  Use
(format (__printf__) instead which is valid replacement in GCC.

v2: add grub-core/lib/libgcrypt/src/g10lib.h
v3: modify g10lib.h during import

---
 include/grub/crypto.h   | 2 +-
 include/grub/emu/misc.h | 8 
 include/grub/err.h  | 2 +-
 util/import_gcry.py | 6 ++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/grub/crypto.h b/include/grub/crypto.h
index ec1b980..a24e89d 100644
--- a/include/grub/crypto.h
+++ b/include/grub/crypto.h
@@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char 
*file, int line,
   const char *func) __attribute__ ((noreturn));
 
 void _gcry_burn_stack (int bytes);
-void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format (printf, 
1, 2)));
+void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format 
(__printf__, 1, 2)));
 
 
 #ifdef GRUB_UTIL
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
index dde48c1..a588ba2 100644
--- a/include/grub/emu/misc.h
+++ b/include/grub/emu/misc.h
@@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev);
 void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
 void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
 char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
-char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2))) WARN_UNUSED_RESULT;
+char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2))) WARN_UNUSED_RESULT;
 
-void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2)));
-void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format 
(printf, 1, 2)));
-void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
((format (printf, 1, 2), noreturn));
+void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2)));
+void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format 
(__printf__, 1, 2)));
+void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ 
((format (__printf__, 1, 2), noreturn));
 
 grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
 
diff --git a/include/grub/err.h b/include/grub/err.h
index 9896fcc..1590c68 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void);
 void EXPORT_FUNC(grub_print_error) (void);
 extern int EXPORT_VAR(grub_err_printed_errors);
 int grub_err_printf (const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__ ((format (__printf__, 1, 2)));
 
 #endif /* ! GRUB_ERR_HEADER */
diff --git a/util/import_gcry.py b/util/import_gcry.py
index 63ebb90..a3a903e 100644
--- a/util/import_gcry.py
+++ b/util/import_gcry.py
@@ -534,6 +534,12 @@ for src in sorted (os.listdir (os.path.join (indir, 
"src"))):
 fw.close ()
 continue
 
+if src == "g10lib.h":
+fw.write (f.read ().replace ("(printf,f,a)", 
"(__printf__,f,a)").replace ("(printf,f,a)", "(__printf__,f,a)"))
+f.close ()
+fw.close ()
+continue
+
 fw.write (f.read ())
 f.close ()
 fw.close ()
-- 
tg: (e0a8509..) u/mingw/attribute_printf (depends on: master)


signature.asc
Description: PGP signature
___
Grub-devel mailing lis

Re: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 19:36, Andrey Borzenkov wrote:
>  grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
Forgot to update this one?
Otherwise go ahead.



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 20:02, Andrey Borzenkov wrote:
> +fw.write (f.read ().replace ("(printf,f,a)", 
> "(__printf__,f,a)").replace ("(printf,f,a)", "(__printf__,f,a)"))
Why replace twice?



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h

2014-01-18 Thread Andrey Borzenkov
В Sat, 18 Jan 2014 20:07:31 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 20:02, Andrey Borzenkov wrote:
> > +fw.write (f.read ().replace ("(printf,f,a)", 
> > "(__printf__,f,a)").replace ("(printf,f,a)", "(__printf__,f,a)"))
> Why replace twice?
> 

Somehow I though they had different number of arguments. Do not know
why. Sorry.


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] add GRUB_WINDOWS_DLLS to make windowsdir to allow shipping runtime files

2014-01-18 Thread Vladimir 'φ-coder/phcoder' Serbinenko
On 18.01.2014 17:26, Andrey Borzenkov wrote:
> export GRUB_EXTRA_DLLS="/path/to/liblzma.dll /path/to/libintl.dll"
> make
> make windowszip
Perhaps a better name to indicate that you could use it to add any extra
files to zip. Perhaps GRUB_WINDOWS_EXTRA_DIST ?



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] add GRUB_WINDOWS_DLLS to make windowsdir to allow shipping runtime files

2014-01-18 Thread Andrey Borzenkov
В Sun, 19 Jan 2014 02:23:41 +0100
Vladimir 'φ-coder/phcoder' Serbinenko  пишет:

> On 18.01.2014 17:26, Andrey Borzenkov wrote:
> > export GRUB_EXTRA_DLLS="/path/to/liblzma.dll /path/to/libintl.dll"
> > make
> > make windowszip
> Perhaps a better name to indicate that you could use it to add any extra
> files to zip. Perhaps GRUB_WINDOWS_EXTRA_DIST ?
> 

I thought about it, but was not sure - *DIST would imply arbitrary
file location inside archive and that becomes far too complicated. But I
do not have strong preference.


signature.asc
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel