On Sat, Jun 20, 2009 at 1:13 AM, Carles Pina i Estany <[email protected]>wrote:
>
> Hi,
>
> On Jun/19/2009, Vladimir 'phcoder' Serbinenko wrote:
> > On Thu, Jun 18, 2009 at 11:07 PM, Carles Pina i Estany <[email protected]
> >wrote:
> >
> > >
> > > Hi,
> > >
> > > On Jun/18/2009, Vladimir 'phcoder' Serbinenko wrote:
> > >
> > > > If you want I'll add compilation po to mo to build system.
> > >
> > > this would be very nice and speed up the process :-)
> > >
> > > As it's written in the TODO in grub/po, we need:
> > >
> > > -Compile all .po to .mo (msgfmt $LANG.po -o $LANG.mo) (during the make
> > > of Grub?)
> > >
> > > -Copy to /usr/share/locale/$LANG/LC_MESSAGES/grub.mo (or
> > > /usr/local/share/locale/$LANG/LC_MESSAGES/..., so $prefix...)
> > > ((Well, now with the last changes I suggest to copy *.mo to
> > > $prefix/locale/ :-) ))
> >
> > In my git repository you can find a possible way how to do it (branch
>
> Could you send the details of your git repository? (I don't have it
> handy)
To recieve the branch for-carles initially you do:
git clone git://repo.or.cz/grub2/phcoder.git
cd phcoder/
git checkout -b for-carles origin/for-carles
Later to update do:
git pull
Alternatively you find the attached patch
>
>
> > for-carles). There is a possibility with minimal modification to copy
>
> thanks :-)
>
> > languages to both ls /usr/local/lib/grub/<platform>/ and $prefix like
> it's
> > the case with modules. It still needs work because I haven't updated non
> > i386-pc scripts yet and because putting to lib/grub/platform is
> > inappropriate. But you can already get the idea Would it be ok if it will
> go
> > to /usr/local/share/grub and $prefix/locale ? Can you make gettext in
> > utilities to use /usr/local/share/grub/$LANG.mo
>
> As far as I remember, gettext utilities uses a shell variable to search
> for the .mo file (or to the directory where the .mo file is located). So
> yes, we could test if /usr/locale/share/grub exists and failback to
> /usr/share/locale/grub, etc.
> (I can do something like this during the weekend)
>
> > > -Make uptrans should execute:
> > > uptrans:
> > > xgettext -k_ -LC -o - `find "$(srcdir)/" -name '*.c'` -o
> po/grub.pot
> > > xgettext -k_ -Lshell -o - $(GRUBD)/* -j -o po/grub.pot
> > >
> > This will need to be adjusted to use DISTLIST
>
> I leave it to you since I'm not familiar with DISTLIST, etc.
>
ok. Remember to pull the updates
>
> > > (first line generates the new po template from the *.c files and otehr
> > > one from the grub.d scripts)
> > >
> > > Then we have other things to do, like be sure that the scripts that
> > > generates grub.cfg are using the appropiate location of the files. For
> > > example, 10_linux.d is using $eval_gettext, and the system has the
> > > grub-gettext_lib.in that setups some paths and includes gettext.sh
> (this
> > > is a generic script that comes with gettext-base package).
> > >
> > > Maybe we can, now (next days) add gettext support in Grub booting time
> > > and then to the scripts?
> > >
> > Works for me
>
> ok. I think that adding Gettext to Grub is not a very BIG patch itself,
> but it touches many places (Grub itself, Scripts, building system) that
> makes difficult to prepare only one patch for everything.
>
Make several patches. It's also much better for review and goes faster
>
> --
> Carles Pina i Estany
> http://pinux.info
>
>
> _______________________________________________
> Grub-devel mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
diff --git a/Makefile.in b/Makefile.in
index f82566a..77e9250 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,6 +92,7 @@ HELP2MAN = true
else
HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF
endif
+MSGFMT = @MSGFMT@
AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBLZO = @LIBLZO@
@@ -108,6 +109,7 @@ enable_grub_mkfont = @enable_grub_mkfont@
freetype_cflags = @freetype_cflags@
freetype_libs = @freetype_libs@
enable_efiemu = @enable_efiemu@
+enable_languages = @enable_languages@
### General variables.
diff --git a/conf/common.rmk b/conf/common.rmk
index fbca2e4..2fa6836 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -598,3 +598,10 @@ pkglib_MODULES += xnu_uuid.mod
xnu_uuid_mod_SOURCES = commands/xnu_uuid.c
xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+LANGUAGES = ca.mo
+ifeq ($(enable_languages), yes)
+pkglib_DATA += $(LANGUAGES)
+%.mo: po/%.po
+ $(MSGFMT) $< -o $@
+endif
diff --git a/configure.ac b/configure.ac
index a8cb234..34570a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -433,6 +433,34 @@ AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
#define NESTED_FUNC_ATTR
#endif])
+AC_ARG_ENABLE([efiemu],
+ [AS_HELP_STRING([--enable-efiemu],
+ [build and install the efiemu runtimes (default=guessed)])])
+if test x"$enable_efiemu" = xno ; then
+ efiemu_excuse="explicitely disabled"
+fi
+if test x"$efiemu_excuse" = x ; then
+ AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_no_red_zone, [
+ CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [grub_cv_cc_efiemu=yes],
+ [grub_cv_cc_efiemu=no])
+ ])
+ if test x$grub_cv_cc_efiemu = x$no; then
+ efiemu_excuse="compiler doesn't support compiling with -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
+ fi
+fi
+if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
+ AC_MSG_ERROR([efiemu runtime was explicitely requested but can't be compiled])
+fi
+if test x"$efiemu_excuse" = x ; then
+enable_efiemu=yes
+else
+enable_efiemu=no
+fi
+AC_SUBST([enable_efiemu])
+
+
# Restore the flags.
CC="$tmp_CC"
CFLAGS="$tmp_CFLAGS"
@@ -453,40 +481,75 @@ AC_ARG_ENABLE([mm-debug],
AC_ARG_ENABLE([grub-emu],
[AS_HELP_STRING([--enable-grub-emu],
- [build and install the `grub-emu' debugging utility])])
+ [build and install the `grub-emu' debugging utility (default=guessed)])])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
- [build and install the `grub-emu' debugging utility with USB support])])
-[if [ x"$enable_grub_emu" = xyes ]; then
- # Check for curses libraries.]
+ [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
+if test x"$enable_grub_emu" = xno ; then
+ grub_emu_excuse="explicitely disabled"
+fi
+
+ [# Check for curses libraries.]
+[if [ x"$grub_emu_excuse" = x ]; then ]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
- [AC_MSG_ERROR([(n)curses libraries are required to build `grub-emu'])])])
+ [grub_emu_excuse=["(n)curses libraries are required to build \`grub-emu'"]])])
AC_SUBST([LIBCURSES])
-
+[fi]
+[if [ x"$grub_emu_excuse" = x ]; then ]
[# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [],
- [AC_MSG_ERROR([(n)curses header files are required to build `grub-emu'])])])])
+ [grub_emu_excuse=["(n)curses header files are required to build \`grub-emu'"]])])])
+[fi]
- [if [ x"$enable_grub_emu_usb" = xyes ]; then
+if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
+ AC_MSG_ERROR([grub-emu was explicitely requested but can't be compiled])
+fi
+if test x"$grub_emu_excuse" = x ; then
+enable_grub_emu=yes
+else
+enable_grub_emu=no
+grub_emu_usb_excuse="grub-emu isn't built"
+fi
+if test x"$enable_grub_emu_usb" = xno ; then
+ grub_emu_usb_excuse="explicitely disabled"
+fi
+[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for libusb libraries.]
- AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
- [AC_MSG_ERROR([libusb libraries are required to build `grub-emu' with USB support])])
+AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
+ [grub_emu_usb_excuse=["libusb libraries are required to build \`grub-emu' with USB support"]])
AC_SUBST([LIBUSB])
-
- [# Check for headers.]
+[fi]
+[if [ x"$grub_emu_usb_excuse" = x ]; then
+ # Check for headers.]
AC_CHECK_HEADERS([usb.h], [],
- [AC_MSG_ERROR([libusb header file is required to build `grub-emu' with USB support])])
- [fi]
+ [grub_emu_usb_excuse=["libusb header file is required to build \`grub-emu' with USB support"]])
[fi]
+if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
+ AC_MSG_ERROR([USB support for grub-emu was explicitely requested but can't be compiled])
+fi
+if test x"$grub_emu_usb_excuse" = x ; then
+enable_grub_emu_usb=yes
+else
+enable_grub_emu_usb=no
+fi
+
AC_SUBST([enable_grub_emu])
AC_SUBST([enable_grub_emu_usb])
AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest],
- [build and install the `grub-fstest' debugging utility])])
+ [build and install the `grub-fstest' debugging utility (default=guessed)])])
+if test x"$enable_grub_fstest" = xno ; then
+ grub_fstest_excuse="explicitely disabled"
+fi
+if test x"$grub_fstest_excuse" = x ; then
+enable_grub_fstest=yes
+else
+enable_grub_fstest=no
+fi
AC_SUBST([enable_grub_fstest])
AC_ARG_ENABLE([grub-pe2elf],
@@ -494,26 +557,58 @@ AC_ARG_ENABLE([grub-pe2elf],
[build and install the `grub-pe2elf' conversion utility])])
AC_SUBST([enable_grub_pe2elf])
+AC_ARG_ENABLE([languages],
+ [AS_HELP_STRING([--enable-languages],
+ [build and install languages (default=guessed)])])
+if test x"$enable_languages" = xno ; then
+ languages_excuse="explicitely disabled"
+fi
+
+if test x"$languages_excuse" = x ; then
+ # Check for freetype libraries.
+ AC_CHECK_PROGS([MSGFMT], [msgfmt])
+ if test "x$MSGFMT" = x ; then
+ languages_excuse="msgfmt not found"
+ fi
+fi
+if test x"$languages_excuse" = x ; then
+enable_languages=yes
+else
+enable_languages=no
+fi
+if test x"$enable_languages" = xyes && test x"$languages_excuse" != x ; then
+ AC_MSG_ERROR([language files explicitely requested but can't be compiled])
+fi
+AC_SUBST([enable_languages])
+
AC_ARG_ENABLE([grub-mkfont],
[AS_HELP_STRING([--enable-grub-mkfont],
- [build and install the `grub-mkfont' utility])])
-if test x"$enable_grub_mkfont" = xyes ; then
+ [build and install the `grub-mkfont' utility (default=guessed)])])
+if test x"$enable_grub_mkfont" = xno ; then
+ grub_mkfont_excuse="explicitely disabled"
+fi
+
+if test x"$grub_mkfont_excuse" = x ; then
# Check for freetype libraries.
AC_CHECK_PROGS([FREETYPE], [freetype-config])
if test "x$FREETYPE" = x ; then
- AC_MSG_ERROR([freetype2 libraries are required to build `grub-mkfont'])
+ grub_mkfont_excuse=["freetype2 libraries are required to build \`grub-mkfont'"]
fi
freetype_cflags=`freetype-config --cflags`
freetype_libs=`freetype-config --libs`
fi
+if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
+ AC_MSG_ERROR([grub-mkfont was explicitely requested but can't be compiled])
+fi
+if test x"$grub_mkfont_excuse" = x ; then
+enable_grub_mkfont=yes
+else
+enable_grub_mkfont=no
+fi
AC_SUBST([enable_grub_mkfont])
AC_SUBST([freetype_cflags])
AC_SUBST([freetype_libs])
-AC_ARG_ENABLE([efiemu],
- [AS_HELP_STRING([--enable-efiemu],
- [build and install the efiemu runtimes])])
-AC_SUBST([enable_efiemu])
AC_SUBST(ASFLAGS)
# Output files.
@@ -531,3 +626,58 @@ fi
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_OUTPUT
+[
+echo "*******************************************************"
+echo GRUB2 will be compiled with following components:
+echo Platform: "$target_cpu"-"$platform"
+if test "$target_cpu"-"$platform" = i386-pc; then
+if [ x"$enable_lzo" = xyes ]; then
+echo Compression: LZO
+else
+echo Compression: LZMA
+fi
+fi
+if [ x"$grub_emu_excuse" = x ]; then
+echo grub-emu: Yes
+else
+echo grub-emu: No "($grub_emu_excuse)"
+fi
+if [ x"$grub_emu_usb_excuse" = x ]; then
+echo USB support for grub-emu: Yes
+else
+echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
+fi
+if [ x"$enable_mm_debug" = xyes ]; then
+echo With memory debugging: Yes
+else
+echo With memory debugging: No
+fi
+if [ x"$enable_grub_pe2elf" = xyes ]; then
+echo grub-pe2elf will be built and installed
+elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
+echo grub-pe2elf will be built but not installed
+else
+echo grub-pe2elf will not be built
+fi
+if [ x"$languages_excuse" = x ]; then
+echo languages: Yes
+else
+echo languages: No "($efiemu_excuse)"
+fi
+if [ x"$efiemu_excuse" = x ]; then
+echo efiemu runtime: Yes
+else
+echo efiemu runtime: No "($efiemu_excuse)"
+fi
+if [ x"$grub_fstest_excuse" = x ]; then
+echo grub-fstest: Yes
+else
+echo grub-fstest: No "($grub_fstest_excuse)"
+fi
+if [ x"$grub_mkfont_excuse" = x ]; then
+echo grub-mkfont: Yes
+else
+echo grub-mkfont: No "($grub_mkfont_excuse)"
+fi
+echo "*******************************************************"
+]
diff --git a/disk/scsi.c b/disk/scsi.c
index 353e639..046dcb8 100644
--- a/disk/scsi.c
+++ b/disk/scsi.c
@@ -246,65 +246,66 @@ grub_scsi_open (const char *name, grub_disk_t disk)
for (p = grub_scsi_dev_list; p; p = p->next)
{
- if (p->open (name, scsi))
- continue;
- disk->id = (unsigned long) "scsi"; /* XXX */
- disk->data = scsi;
- scsi->dev = p;
- scsi->lun = lun;
- scsi->name = grub_strdup (name);
- if (! scsi->name)
+ if (! p->open (name, scsi))
{
- grub_free (scsi);
- return grub_errno;
+ disk->id = (unsigned long) "scsi"; /* XXX */
+ disk->data = scsi;
+ scsi->dev = p;
+ scsi->lun = lun;
+ scsi->name = grub_strdup (name);
+ if (! scsi->name)
+ {
+ grub_free (scsi);
+ return grub_errno;
+ }
+
+ grub_dprintf ("scsi", "dev opened\n");
+
+ err = grub_scsi_inquiry (scsi);
+ if (err)
+ {
+ grub_free (scsi);
+ grub_dprintf ("scsi", "inquiry failed\n");
+ return grub_errno;
+ }
+
+ grub_dprintf ("scsi", "inquiry: devtype=0x%02x removable=%d\n",
+ scsi->devtype, scsi->removable);
+
+ /* Try to be conservative about the device types
+ supported. */
+ if (scsi->devtype != grub_scsi_devtype_direct
+ && scsi->devtype != grub_scsi_devtype_cdrom)
+ {
+ grub_free (scsi);
+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
+ "unknown SCSI device");
+ }
+
+ if (scsi->devtype == grub_scsi_devtype_cdrom)
+ disk->has_partitions = 0;
+ else
+ disk->has_partitions = 1;
+
+ err = grub_scsi_read_capacity (scsi);
+ if (err)
+ {
+ grub_free (scsi);
+ grub_dprintf ("scsi", "READ CAPACITY failed\n");
+ return grub_errno;
+ }
+
+ /* SCSI blocks can be something else than 512, although GRUB
+ wants 512 byte blocks. */
+ disk->total_sectors = ((scsi->size * scsi->blocksize)
+ << GRUB_DISK_SECTOR_BITS);
+
+ grub_dprintf ("scsi", "capacity=%llu, blksize=%d\n",
+ (unsigned long long) disk->total_sectors,
+ scsi->blocksize);
+
+ return GRUB_ERR_NONE;
}
-
- grub_dprintf ("scsi", "dev opened\n");
-
- err = grub_scsi_inquiry (scsi);
- if (err)
- {
- grub_free (scsi);
- grub_dprintf ("scsi", "inquiry failed\n");
- return grub_errno;
- }
-
- grub_dprintf ("scsi", "inquiry: devtype=0x%02x removable=%d\n",
- scsi->devtype, scsi->removable);
-
- /* Try to be conservative about the device types
- supported. */
- if (scsi->devtype != grub_scsi_devtype_direct
- && scsi->devtype != grub_scsi_devtype_cdrom)
- {
- grub_free (scsi);
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
- "unknown SCSI device");
- }
-
- if (scsi->devtype == grub_scsi_devtype_cdrom)
- disk->has_partitions = 0;
- else
- disk->has_partitions = 1;
-
- err = grub_scsi_read_capacity (scsi);
- if (err)
- {
- grub_free (scsi);
- grub_dprintf ("scsi", "READ CAPACITY failed\n");
- return grub_errno;
- }
-
- /* SCSI blocks can be something else than 512, although GRUB
- wants 512 byte blocks. */
- disk->total_sectors = ((scsi->size * scsi->blocksize)
- << GRUB_DISK_SECTOR_BITS);
-
- grub_dprintf ("scsi", "capacity=%llu, blksize=%d\n",
- (unsigned long long) disk->total_sectors,
- scsi->blocksize);
-
- return GRUB_ERR_NONE;
}
grub_free (scsi);
diff --git a/genmk.rb b/genmk.rb
index 36f4020..f60e377 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -310,7 +310,9 @@ class Script
"CLEANFILES += #...@name}
#...@name}: #{src} $(#{src}_DEPENDENCIES) config.status
- ./config.status --file=#{name}:#{src}
+ ./config.status --file=#{name}.tmp:#{src}
+ cat [email protected] | sed 's/@pkglib_DATA@/$(pkglib_DATA)/g;' > $@
+ -rm -f [email protected]
chmod +x $@
"
diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in
index 5c3ffcd..d266b35 100644
--- a/util/i386/pc/grub-install.in
+++ b/util/i386/pc/grub-install.in
@@ -231,16 +231,19 @@ if test -n "$tmp"; then
fi
# Copy the GRUB images to the GRUB directory.
-for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/efiemu??.o; do
+for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/*.mo ${grubdir}/efiemu??.o; do
if test -f $file && [ "`basename $file`" != menu.lst ]; then
rm -f $file || exit 1
fi
done
-for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
+for file in ${pkglibdir}/*.mod; do
cp -f $file ${grubdir} || exit 1
done
+for file in @pkglib_DATA@; do
+ cp -f ${pkglibdir}/$file ${grubdir} || exit 1
+done
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
- for file in ${pkglibdir}/*.img ${pkglibdir}/efiemu??.o; do
+ for file in ${pkglibdir}/*.img; do
if test -f $file; then
cp -f $file ${grubdir} || exit 1
fi
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel