Fix default mkimage path determination

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-03 22:54:46 +02:00
parent a57c242287
commit a1a5c86985
2 changed files with 8 additions and 7 deletions

View file

@ -90,7 +90,7 @@ GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
ASFLAGS = @ASFLAGS@ ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@ $(LIBS) LDFLAGS = @LDFLAGS@ $(LIBS)
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \ CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(libdir)\" -DLOCALEDIR=\"$(localedir)\" -DGRUB_PKGLIBROOTDIR=\"$(libdir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`\" -DLOCALEDIR=\"$(localedir)\"
TARGET_CC = @TARGET_CC@ TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@ TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@ TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@

View file

@ -1182,7 +1182,7 @@ Make a bootable image of GRUB.\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
"), "),
program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY, program_name, GRUB_PKGLIBROOTDIR, DEFAULT_DIRECTORY,
formats, formats,
PACKAGE_BUGREPORT); PACKAGE_BUGREPORT);
free (formats); free (formats);
@ -1320,14 +1320,15 @@ main (int argc, char *argv[])
last = strchr (last + 1, '-'); last = strchr (last + 1, '-');
if (!last) if (!last)
last = image_target->name + strlen (image_target->name); last = image_target->name + strlen (image_target->name);
dir = xmalloc (sizeof (GRUB_LIBDIR) + (last - image_target->name)); dir = xmalloc (sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name));
memcpy (dir, GRUB_LIBDIR, sizeof (GRUB_LIBDIR) - 1); memcpy (dir, GRUB_PKGLIBROOTDIR, sizeof (GRUB_PKGLIBROOTDIR) - 1);
memcpy (dir + sizeof (GRUB_LIBDIR) - 1, image_target->name, *(dir + sizeof (GRUB_PKGLIBROOTDIR) - 1) = '/';
memcpy (dir + sizeof (GRUB_PKGLIBROOTDIR), image_target->name,
last - image_target->name); last - image_target->name);
*(dir + sizeof (GRUB_LIBDIR) - 1 + (last - image_target->name)) = 0; *(dir + sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name)) = 0;
} }
generate_image (dir ? : GRUB_LIBDIR, prefix ? : DEFAULT_DIRECTORY, fp, generate_image (dir, prefix ? : DEFAULT_DIRECTORY, fp,
argv + optind, memdisk, font, config, argv + optind, memdisk, font, config,
image_target, note); image_target, note);