Handle grub-pe2elf and grub-mkfont for cases when build != host.
* Makefile.am (build-grub-mkfont): Don't include gnulib. (build-grub-gen-asciih): Likewise. (build-grub-gen-widthspec): Likewise. * Makefile.util.def (grub-pe2elf): Remove. * config.h.in [GRUB_BUILD]: Use build rather than host constants. * configure.ac: Separate tests for build. Move ./build-grub-pe2elf to grub-core. Fix typo. * grub-core/Makefile.am (build-grub-pe2elf): New target. * grub-core/kern/emu/misc.c (xasprintf): Don't compile if GRUB_BUILD is defined. * include/grub/types.h [GRUB_BUILD]: Use build rather than host constants. * util/grub-mkfont.c [GRUB_BUILD]: Simplify not to rely on argp. * util/grub-pe2elf.c: Simplify not to rely on getopt. * util/misc.c (program_name) [GRUB_BUILD]: Define to static string.
This commit is contained in:
parent
984cfd8a79
commit
7b780018f5
11 changed files with 174 additions and 102 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
||||||
|
2013-08-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Handle grub-pe2elf and grub-mkfont for cases when build != host.
|
||||||
|
|
||||||
|
* Makefile.am (build-grub-mkfont): Don't include gnulib.
|
||||||
|
(build-grub-gen-asciih): Likewise.
|
||||||
|
(build-grub-gen-widthspec): Likewise.
|
||||||
|
* Makefile.util.def (grub-pe2elf): Remove.
|
||||||
|
* config.h.in [GRUB_BUILD]: Use build rather than host constants.
|
||||||
|
* configure.ac: Separate tests for build.
|
||||||
|
Move ./build-grub-pe2elf to grub-core.
|
||||||
|
Fix typo.
|
||||||
|
* grub-core/Makefile.am (build-grub-pe2elf): New target.
|
||||||
|
* grub-core/kern/emu/misc.c (xasprintf): Don't compile if GRUB_BUILD is
|
||||||
|
defined.
|
||||||
|
* include/grub/types.h [GRUB_BUILD]: Use build rather than host
|
||||||
|
constants.
|
||||||
|
* util/grub-mkfont.c [GRUB_BUILD]: Simplify not to rely on argp.
|
||||||
|
* util/grub-pe2elf.c: Simplify not to rely on getopt.
|
||||||
|
* util/misc.c (program_name) [GRUB_BUILD]: Define to static string.
|
||||||
|
|
||||||
2013-08-22 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-08-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_size): Adapt for
|
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_size): Adapt for
|
||||||
|
|
|
@ -66,14 +66,14 @@ 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
|
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/argp_common.c grub-core/kern/emu/misc.c util/misc.c grub-core/gnulib/progname.c
|
build-grub-mkfont: 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) -I$(top_srcdir)/grub-core/gnulib -DGRUB_MKFONT=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) $(LIBINTL)
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
|
||||||
|
|
||||||
build-grub-gen-asciih: util/grub-gen-asciih.c
|
build-grub-gen-asciih: util/grub-gen-asciih.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -I$(top_srcdir)/grub-core/gnulib -DGRUB_MKFONT=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) $(LIBINTL) -Wall -Werror
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||||
|
|
||||||
build-grub-gen-widthspec: util/grub-gen-widthspec.c
|
build-grub-gen-widthspec: util/grub-gen-widthspec.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -I$(top_srcdir)/grub-core/gnulib -DGRUB_MKFONT=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) $(LIBINTL) -Wall -Werror
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||||
|
|
||||||
if COND_STARFIELD
|
if COND_STARFIELD
|
||||||
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
||||||
|
|
|
@ -231,19 +231,6 @@ program = {
|
||||||
condition = COND_APPLE_CC;
|
condition = COND_APPLE_CC;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
|
||||||
name = grub-pe2elf;
|
|
||||||
mansection = 1;
|
|
||||||
common = util/grub-pe2elf.c;
|
|
||||||
|
|
||||||
ldadd = libgrubmods.a;
|
|
||||||
ldadd = libgrubgcry.a;
|
|
||||||
ldadd = libgrubkern.a;
|
|
||||||
ldadd = grub-core/gnulib/libgnu.a;
|
|
||||||
ldadd = '$(LIBINTL)';
|
|
||||||
condition = COND_GRUB_PE2ELF;
|
|
||||||
};
|
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
name = grub-fstest;
|
name = grub-fstest;
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
|
|
14
config.h.in
14
config.h.in
|
@ -10,7 +10,19 @@
|
||||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||||
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
||||||
|
|
||||||
#if defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
#if defined (GRUB_BUILD)
|
||||||
|
#define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@
|
||||||
|
#define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@
|
||||||
|
#if defined __APPLE__
|
||||||
|
# if defined __BIG_ENDIAN__
|
||||||
|
# define BUILD_WORDS_BIGENDIAN 1
|
||||||
|
# else
|
||||||
|
# define BUILD_WORDS_BIGENDIAN 0
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
#define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@
|
||||||
|
#endif
|
||||||
|
#elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
||||||
#include <config-util.h>
|
#include <config-util.h>
|
||||||
#else
|
#else
|
||||||
/* Define if C symbols get an underscore after compilation. */
|
/* Define if C symbols get an underscore after compilation. */
|
||||||
|
|
31
configure.ac
31
configure.ac
|
@ -331,6 +331,8 @@ AM_GNU_GETTEXT([external])
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
# Identify characteristics of the host architecture.
|
# Identify characteristics of the host architecture.
|
||||||
|
unset ac_cv_c_bigendian
|
||||||
|
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
AC_CHECK_SIZEOF(void *)
|
AC_CHECK_SIZEOF(void *)
|
||||||
AC_CHECK_SIZEOF(long)
|
AC_CHECK_SIZEOF(long)
|
||||||
|
@ -556,7 +558,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
||||||
# For platforms where ELF is not the default link format.
|
# For platforms where ELF is not the default link format.
|
||||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||||
case "${target_os}" in
|
case "${target_os}" in
|
||||||
cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf';
|
cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf';
|
||||||
# FIXME: put proper test here
|
# FIXME: put proper test here
|
||||||
NEED_REGISTER_FRAME_INFO=1
|
NEED_REGISTER_FRAME_INFO=1
|
||||||
;;
|
;;
|
||||||
|
@ -966,6 +968,8 @@ if test x"$grub_mkfont_excuse" = x ; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset ac_cv_header_ft2build_h
|
||||||
|
|
||||||
if test x"$grub_mkfont_excuse" = x ; then
|
if test x"$grub_mkfont_excuse" = x ; then
|
||||||
# Check for freetype libraries.
|
# Check for freetype libraries.
|
||||||
freetype_cflags=`$FREETYPE --cflags`
|
freetype_cflags=`$FREETYPE --cflags`
|
||||||
|
@ -994,11 +998,26 @@ SAVED_CFLAGS="$CFLAGS"
|
||||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
CC="$BUILD_CC"
|
CC="$BUILD_CC"
|
||||||
CFLAGS="$BUILD_CFLAGS"
|
CFLAGS="$BUILD_CFLAGS"
|
||||||
CPPFLAGS="$SAVED_CPPFLAGS"
|
CPPFLAGS="$BUILD_CPPFLAGS"
|
||||||
|
|
||||||
|
unset ac_cv_c_bigendian
|
||||||
|
unset ac_cv_header_ft2build_h
|
||||||
|
|
||||||
|
AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
|
||||||
|
AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
|
||||||
|
AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
|
||||||
|
|
||||||
|
if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
|
||||||
|
AC_MSG_ERROR([couldnt determine build endianness])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST([BUILD_SIZEOF_LONG])
|
||||||
|
AC_SUBST([BUILD_SIZEOF_VOID_P])
|
||||||
|
AC_SUBST([BUILD_WORDS_BIGENDIAN])
|
||||||
|
|
||||||
if test x"$grub_build_mkfont_excuse" = x ; then
|
if test x"$grub_build_mkfont_excuse" = x ; then
|
||||||
# Check for freetype libraries.
|
# Check for freetype libraries.
|
||||||
AC_CHECK_TOOLS([BUILD_FREETYPE], [freetype-config])
|
AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
|
||||||
if test "x$BUILD_FREETYPE" = x ; then
|
if test "x$BUILD_FREETYPE" = x ; then
|
||||||
grub_build_mkfont_excuse=["need freetype2 library"]
|
grub_build_mkfont_excuse=["need freetype2 library"]
|
||||||
fi
|
fi
|
||||||
|
@ -1081,7 +1100,7 @@ fi
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
|
|
||||||
if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x; then
|
if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
|
||||||
grub_build_mkfont_excuse="no fonts"
|
grub_build_mkfont_excuse="no fonts"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1376,7 +1395,7 @@ echo With libzfs support: Yes
|
||||||
else
|
else
|
||||||
echo With libzfs support: No "($libzfs_excuse)"
|
echo With libzfs support: No "($libzfs_excuse)"
|
||||||
fi
|
fi
|
||||||
if [ x"$build_grub_mkfont_excuse" = x ]; then
|
if [ x"$grub_build_mkfont_excuse" = x ]; then
|
||||||
echo Build-time grub-mkfont: Yes
|
echo Build-time grub-mkfont: Yes
|
||||||
if test "x$FONT_SOURCE" = x ; then
|
if test "x$FONT_SOURCE" = x ; then
|
||||||
echo "Without unifont"
|
echo "Without unifont"
|
||||||
|
@ -1384,7 +1403,7 @@ if [ x"$build_grub_mkfont_excuse" = x ]; then
|
||||||
echo "With unifont from $FONT_SOURCE"
|
echo "With unifont from $FONT_SOURCE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo Build-time grub-mkfont: No "($build_grub_mkfont_excuse)"
|
echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
|
||||||
echo "Without unifont (no build-time grub-mkfont)"
|
echo "Without unifont (no build-time grub-mkfont)"
|
||||||
fi
|
fi
|
||||||
if test "x$LIBLZMA" = x ; then
|
if test "x$LIBLZMA" = x ; then
|
||||||
|
|
|
@ -28,6 +28,9 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
|
||||||
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
|
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
|
||||||
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
|
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
|
||||||
|
|
||||||
|
build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
||||||
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
|
||||||
|
|
||||||
# gentrigtables
|
# gentrigtables
|
||||||
gentrigtables: gentrigtables.c
|
gentrigtables: gentrigtables.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -lm
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -lm
|
||||||
|
|
|
@ -137,7 +137,7 @@ xstrdup (const char *str)
|
||||||
return newstr;
|
return newstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_MKFONT
|
#if !defined (GRUB_MKFONT) && !defined (GRUB_BUILD)
|
||||||
char *
|
char *
|
||||||
xasprintf (const char *fmt, ...)
|
xasprintf (const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,15 @@
|
||||||
#include <grub/cpu/types.h>
|
#include <grub/cpu/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_BUILD
|
||||||
|
# define GRUB_CPU_SIZEOF_VOID_P BUILD_SIZEOF_VOID_P
|
||||||
|
# define GRUB_CPU_SIZEOF_LONG BUILD_SIZEOF_LONG
|
||||||
|
# if BUILD_WORDS_BIGENDIAN
|
||||||
|
# define GRUB_CPU_WORDS_BIGENDIAN 1
|
||||||
|
# else
|
||||||
|
# undef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
|
# endif
|
||||||
|
#elif defined (GRUB_UTIL)
|
||||||
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
|
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
|
||||||
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG
|
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG
|
||||||
# ifdef WORDS_BIGENDIAN
|
# ifdef WORDS_BIGENDIAN
|
||||||
|
|
|
@ -31,10 +31,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef GRUB_BUILD
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include FT_TRUETYPE_TAGS_H
|
#include FT_TRUETYPE_TAGS_H
|
||||||
|
@ -47,7 +51,9 @@
|
||||||
#define FT_ERROR_END_LIST };
|
#define FT_ERROR_END_LIST };
|
||||||
#include FT_ERRORS_H
|
#include FT_ERRORS_H
|
||||||
|
|
||||||
|
#ifndef GRUB_BUILD
|
||||||
#include "progname.h"
|
#include "progname.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GRUB_FONT_DEFAULT_SIZE 16
|
#define GRUB_FONT_DEFAULT_SIZE 16
|
||||||
|
|
||||||
|
@ -919,13 +925,10 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
|
||||||
fclose (file);
|
fclose (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GRUB_BUILD
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{"output", 'o', N_("FILE"), 0, N_("save output in FILE [required]"), 0},
|
{"output", 'o', N_("FILE"), 0, N_("save output in FILE [required]"), 0},
|
||||||
/* TRANSLATORS: bitmaps are images like e.g. in JPEG. */
|
/* TRANSLATORS: bitmaps are images like e.g. in JPEG. */
|
||||||
{"width-spec", 0x103, 0, 0,
|
|
||||||
/* TRANSLATORS: this refers to creating a file containing the width of
|
|
||||||
every glyph but not the glyphs themselves. */
|
|
||||||
N_("create width summary file"), 0},
|
|
||||||
{"index", 'i', N_("NUM"), 0,
|
{"index", 'i', N_("NUM"), 0,
|
||||||
/* TRANSLATORS: some font files may have multiple faces (fonts).
|
/* TRANSLATORS: some font files may have multiple faces (fonts).
|
||||||
This option is used to chose among them, the first face being '0'.
|
This option is used to chose among them, the first face being '0'.
|
||||||
|
@ -953,6 +956,23 @@ static struct argp_option options[] = {
|
||||||
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
||||||
{ 0, 0, 0, 0, 0, 0 }
|
{ 0, 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
#define my_argp_parse argp_parse
|
||||||
|
#define MY_ARGP_KEY_ARG ARGP_KEY_ARG
|
||||||
|
#define my_error_t error_t
|
||||||
|
#define MY_ARGP_ERR_UNKNOWN ARGP_ERR_UNKNOWN
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define my_error_t int
|
||||||
|
#define MY_ARGP_ERR_UNKNOWN -1
|
||||||
|
#define MY_ARGP_KEY_ARG -1
|
||||||
|
#define my_argp_parse(a, argc, argv, b, c, st) my_argp_parse_real(argc, argv, st)
|
||||||
|
struct my_argp_state
|
||||||
|
{
|
||||||
|
void *input;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct arguments
|
struct arguments
|
||||||
{
|
{
|
||||||
|
@ -966,8 +986,15 @@ struct arguments
|
||||||
enum file_formats file_format;
|
enum file_formats file_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
static error_t
|
static int
|
||||||
argp_parser (int key, char *arg, struct argp_state *state)
|
has_argument (int v)
|
||||||
|
{
|
||||||
|
return v =='o' || v == 'i' || v == 'r' || v == 'n' || v == 's'
|
||||||
|
|| v == 'd' || v == 'c';
|
||||||
|
}
|
||||||
|
|
||||||
|
static my_error_t
|
||||||
|
argp_parser (int key, char *arg, struct my_argp_state *state)
|
||||||
{
|
{
|
||||||
/* Get the input argument from argp_parse, which we
|
/* Get the input argument from argp_parse, which we
|
||||||
know is a pointer to our arguments structure. */
|
know is a pointer to our arguments structure. */
|
||||||
|
@ -1055,22 +1082,66 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
||||||
font_verbosity++;
|
font_verbosity++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARGP_KEY_ARG:
|
case MY_ARGP_KEY_ARG:
|
||||||
assert (arguments->nfiles < arguments->files_max);
|
assert (arguments->nfiles < arguments->files_max);
|
||||||
arguments->files[arguments->nfiles++] = xstrdup(arg);
|
arguments->files[arguments->nfiles++] = xstrdup(arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ARGP_ERR_UNKNOWN;
|
return MY_ARGP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GRUB_BUILD
|
||||||
|
|
||||||
|
/* We don't require host platform to have argp. In the same time configuring
|
||||||
|
gnulib for build would result in even worse mess. So we have our
|
||||||
|
minimalistic argp replacement just enough for build system. Most
|
||||||
|
argp features are omitted. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
my_argp_parse_real (int argc, char **argv, void *st)
|
||||||
|
{
|
||||||
|
int curar;
|
||||||
|
struct my_argp_state p;
|
||||||
|
|
||||||
|
p.input = st;
|
||||||
|
|
||||||
|
for (curar = 1; curar < argc; )
|
||||||
|
{
|
||||||
|
if (argv[curar][0] == '-')
|
||||||
|
{
|
||||||
|
if (has_argument (argv[curar][1])
|
||||||
|
&& curar + 1 >= argc)
|
||||||
|
return 1;
|
||||||
|
if (has_argument (argv[curar][1]))
|
||||||
|
{
|
||||||
|
if (argp_parser (argv[curar][1], argv[curar + 1], &p))
|
||||||
|
return 1;
|
||||||
|
curar += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (argp_parser (argv[curar][1], NULL, &p))
|
||||||
|
return 1;
|
||||||
|
curar++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (argp_parser (MY_ARGP_KEY_ARG, argv[curar], &p))
|
||||||
|
return 1;
|
||||||
|
curar++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GRUB_BUILD
|
||||||
static struct argp argp = {
|
static struct argp argp = {
|
||||||
options, argp_parser, N_("[OPTIONS] FONT_FILES"),
|
options, argp_parser, N_("[OPTIONS] FONT_FILES"),
|
||||||
N_("Convert common font file formats into PF2"),
|
N_("Convert common font file formats into PF2"),
|
||||||
NULL, NULL, NULL
|
NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
|
@ -1078,7 +1149,9 @@ main (int argc, char *argv[])
|
||||||
FT_Library ft_lib;
|
FT_Library ft_lib;
|
||||||
struct arguments arguments;
|
struct arguments arguments;
|
||||||
|
|
||||||
|
#ifndef GRUB_BUILD
|
||||||
set_program_name (argv[0]);
|
set_program_name (argv[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
grub_util_init_nls ();
|
grub_util_init_nls ();
|
||||||
|
|
||||||
|
@ -1090,7 +1163,7 @@ main (int argc, char *argv[])
|
||||||
memset (arguments.files, 0, (arguments.files_max + 1)
|
memset (arguments.files, 0, (arguments.files_max + 1)
|
||||||
* sizeof (arguments.files[0]));
|
* sizeof (arguments.files[0]));
|
||||||
|
|
||||||
if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
if (my_argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s", _("Error in parsing command line arguments\n"));
|
fprintf (stderr, "%s", _("Error in parsing command line arguments\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -30,37 +30,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "progname.h"
|
|
||||||
|
|
||||||
/* Please don't internationalise this file. It's pointless. */
|
/* Please don't internationalise this file. It's pointless. */
|
||||||
|
|
||||||
static struct option options[] = {
|
|
||||||
{"help", no_argument, 0, 'h'},
|
|
||||||
{"version", no_argument, 0, 'V'},
|
|
||||||
{"verbose", no_argument, 0, 'v'},
|
|
||||||
{0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void __attribute__ ((noreturn))
|
|
||||||
usage (int status)
|
|
||||||
{
|
|
||||||
if (status)
|
|
||||||
fprintf (stderr, "Try `%s --help' for more information.\n", program_name);
|
|
||||||
else
|
|
||||||
printf ("\
|
|
||||||
Usage: %s [OPTIONS] input [output]\n\
|
|
||||||
\n\
|
|
||||||
Tool to convert pe image to elf.\n\
|
|
||||||
\nOptions:\n\
|
|
||||||
-h, --help display this message and exit\n\
|
|
||||||
-V, --version print version information and exit\n\
|
|
||||||
-v, --verbose print verbose messages\n\
|
|
||||||
\n\
|
|
||||||
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
|
|
||||||
|
|
||||||
exit (status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Section layout
|
* Section layout
|
||||||
*
|
*
|
||||||
|
@ -490,54 +462,27 @@ main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *image;
|
char *image;
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
char *in, *out;
|
||||||
set_program_name (argv[0]);
|
|
||||||
|
|
||||||
/* Check for options. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int c = getopt_long (argc, argv, "hVv", options, 0);
|
|
||||||
|
|
||||||
if (c == -1)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 'h':
|
|
||||||
usage (0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V':
|
|
||||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
verbosity++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
usage (1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Obtain PATH. */
|
/* Obtain PATH. */
|
||||||
if (optind >= argc)
|
if (1 >= argc)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Filename not specified.\n");
|
fprintf (stderr, "Filename not specified.\n");
|
||||||
usage (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
image = grub_util_read_image (argv[optind]);
|
in = argv[1];
|
||||||
|
if (argc > 2)
|
||||||
|
out = argv[2];
|
||||||
|
else
|
||||||
|
out = in;
|
||||||
|
image = grub_util_read_image (in);
|
||||||
|
|
||||||
if (optind + 1 < argc)
|
fp = fopen (out, "wb");
|
||||||
optind++;
|
|
||||||
|
|
||||||
fp = fopen (argv[optind], "wb");
|
|
||||||
if (! fp)
|
if (! fp)
|
||||||
grub_util_error ("cannot open %s", argv[optind]);
|
grub_util_error ("cannot open %s", out);
|
||||||
|
|
||||||
convert_pe (fp, argv[optind], image);
|
convert_pe (fp, out, image);
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,11 @@
|
||||||
#include <grub/script_sh.h>
|
#include <grub/script_sh.h>
|
||||||
|
|
||||||
#define ENABLE_RELOCATABLE 0
|
#define ENABLE_RELOCATABLE 0
|
||||||
|
#ifdef GRUB_BUILD
|
||||||
|
const char *program_name = GRUB_BUILD_PROGRAM_NAME;
|
||||||
|
#else
|
||||||
#include "progname.h"
|
#include "progname.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Include malloc.h, only if memalign is available. It is known that
|
/* Include malloc.h, only if memalign is available. It is known that
|
||||||
memalign is declared in malloc.h in all systems, if present. */
|
memalign is declared in malloc.h in all systems, if present. */
|
||||||
|
|
Loading…
Reference in a new issue