From 05568c2e857b77d54e5266b13d9e5afc172203c3 Mon Sep 17 00:00:00 2001 From: okuji Date: Mon, 8 May 2006 19:29:10 +0000 Subject: [PATCH] 2006-05-08 Yoshinori K. Okuji Add --with-platform to configure. Use pkglibdir instead of pkgdatadir. This is reported by Roger Leigh. * util/powerpc/ieee1275/grub-install.in (datadir): Removed. (host_vendor): Likewise. (host_os): Likewise. (pkgdatadir): Likewise. (platform): New variable. (pkglibdir): Likewise. Use PKGLIBDIR instead of PKGDATADIR. * util/i386/pc/grub-install.in (datadir): Removed. (host_vendor): Likewise. (host_os): Likewise. (pkgdatadir): Likewise. (platform): New variable. (pkglibdir): Likewise. Use PKGLIBDIR instead of PKGDATADIR. * util/powerpc/ieee1275/grub-mkimage.c (usage): Use GRUB_LIBDIR instead of GRUB_DATADIR. (main): Likewise. * util/i386/pc/grub-mkimage.c (usage): Likewise. (main): Likewise. * util/i386/efi/grub-mkimage.c (usage): Likewise. (main): Likewise. * configure.ac (--with-platform): New option. Use PLATFORM instead of HOST_VENDOR to specify a platform. * Makefile.in: Include a makefile based on PLATFORM instead of HOST_VENDOR. (pkgdatadir): Not appended by the machine type. (pkglibdir): Appended by the machine type. (host_vendor): Removed. (platform): New variable. (BUILD_CPPFLAGS): Specify GRUB_LIBDIR instead of GRUB_DATADIR. (install-local): Use PKGLIBDIR instead of PKGDATADIR. (uninstall): Likewise. --- ChangeLog | 42 ++++++++++++++++++++++++ Makefile.in | 16 ++++----- THANKS | 1 + configure | 47 ++++++++++++++++++++++----- configure.ac | 33 +++++++++++++++---- util/i386/efi/grub-mkimage.c | 4 +-- util/i386/pc/grub-install.in | 11 +++---- util/i386/pc/grub-mkimage.c | 4 +-- util/powerpc/ieee1275/grub-install.in | 13 ++++---- util/powerpc/ieee1275/grub-mkimage.c | 6 ++-- 10 files changed, 134 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index c31e53409..28419bf7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2006-05-08 Yoshinori K. Okuji + + Add --with-platform to configure. Use pkglibdir instead of + pkgdatadir. This is reported by Roger Leigh. + + * util/powerpc/ieee1275/grub-install.in (datadir): Removed. + (host_vendor): Likewise. + (host_os): Likewise. + (pkgdatadir): Likewise. + (platform): New variable. + (pkglibdir): Likewise. + Use PKGLIBDIR instead of PKGDATADIR. + + * util/i386/pc/grub-install.in (datadir): Removed. + (host_vendor): Likewise. + (host_os): Likewise. + (pkgdatadir): Likewise. + (platform): New variable. + (pkglibdir): Likewise. + Use PKGLIBDIR instead of PKGDATADIR. + + * util/powerpc/ieee1275/grub-mkimage.c (usage): Use GRUB_LIBDIR + instead of GRUB_DATADIR. + (main): Likewise. + * util/i386/pc/grub-mkimage.c (usage): Likewise. + (main): Likewise. + * util/i386/efi/grub-mkimage.c (usage): Likewise. + (main): Likewise. + + * configure.ac (--with-platform): New option. + Use PLATFORM instead of HOST_VENDOR to specify a platform. + + * Makefile.in: Include a makefile based on PLATFORM instead of + HOST_VENDOR. + (pkgdatadir): Not appended by the machine type. + (pkglibdir): Appended by the machine type. + (host_vendor): Removed. + (platform): New variable. + (BUILD_CPPFLAGS): Specify GRUB_LIBDIR instead of GRUB_DATADIR. + (install-local): Use PKGLIBDIR instead of PKGDATADIR. + (uninstall): Likewise. + 2006-05-07 Yoshinori K. Okuji Use the environment context in the menu. Remove the commands diff --git a/Makefile.in b/Makefile.in index 64d49a8fb..964826656 100644 --- a/Makefile.in +++ b/Makefile.in @@ -34,8 +34,8 @@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ -pkgdatadir = $(datadir)/@PACKAGE_TARNAME@/$(host_cpu)-$(host_vendor) -pkglibdir = $(libdir)/@PACKAGE_TARNAME@ +pkgdatadir = $(datadir)/@PACKAGE_TARNAME@ +pkglibdir = $(libdir)/@PACKAGE_TARNAME@/$(host_cpu)-$(platform) PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ @@ -44,7 +44,7 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ host_cpu = @host_cpu@ -host_vendor = @host_vendor@ +platform = @platform@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -61,7 +61,7 @@ CPPFLAGS = -I. -Iinclude -I$(srcdir)/include -Wall -W BUILD_CC = @BUILD_CC@ BUILD_CFLAGS = -g -O2 BUILD_CPPFLAGS = -I. -Iinclude -I$(srcdir)/include -Wall -W \ - -DGRUB_DATADIR=\"$(pkgdatadir)\" + -DGRUB_LIBDIR=\"$(pkglibdir)\" OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@ @@ -99,7 +99,7 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb $(RUBY) $(srcdir)/genmk.rb < $< > $@; \ fi -include $(srcdir)/conf/$(host_cpu)-$(host_vendor).mk +include $(srcdir)/conf/$(host_cpu)-$(platform).mk ### General targets. @@ -120,12 +120,12 @@ all-local: $(PROGRAMS) $(DATA) $(SCRIPTS) $(MKFILES) install: install-local install-local: all - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) + $(mkinstalldirs) $(DESTDIR)$(pkglibdir) @list='$(DATA)'; \ for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ dest="`echo $$file | sed 's,.*/,,'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \ + $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkglibdir)/$$dest; \ done $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_UTILITIES)'; for file in $$list; do \ @@ -152,7 +152,7 @@ uninstall: @list='$(DATA)'; \ for file in $$list; do \ dest="`echo $$file | sed 's,.*/,,'`"; \ - rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \ + rm -f $(DESTDIR)$(pkglibdir)/$$dest; \ done @list='$(bin_UTILITIES)'; for file in $$list; do \ dest="`echo $$file | sed 's,.*/,,'`"; \ diff --git a/THANKS b/THANKS index cb239c15c..82252cfb7 100644 --- a/THANKS +++ b/THANKS @@ -14,6 +14,7 @@ Marco Gerards NIIBE Yutaka Omniflux Robert Bihlmeyer +Roger Leigh Ruslan Nikolaev Timothy Baldwin Tomas Ebenlendr diff --git a/configure b/configure index 86d7ab227..f4f51d8cf 100644 --- a/configure +++ b/configure @@ -311,7 +311,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE OBJCOPY ac_ct_OBJCOPY STRIP ac_ct_STRIP NM ac_ct_NM LD ac_ct_LD RUBY BUILD_CC CPP EGREP LIBLZO LIBCURSES LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os platform CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT YACC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE OBJCOPY ac_ct_OBJCOPY STRIP ac_ct_STRIP NM ac_ct_NM LD ac_ct_LD RUBY BUILD_CC CPP EGREP LIBLZO LIBCURSES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -851,6 +851,12 @@ Optional Features: --disable-largefile omit support for large files --enable-mm-debug include memory manger debugging +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-platform=PLATFORM + select the host platform guessed + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1406,11 +1412,35 @@ echo "$as_me: error: unsupported CPU type" >&2;} { (exit 1); exit 1; }; } ;; esac -case "$host_cpu"-"$host_vendor" in - i386-apple | *-efi) host_vendor=efi ;; - i386-*) host_vendor=pc ;; - powerpc-*) host_vendor=ieee1275 ;; - sparc64-*) host_vendor=ieee1275 ;; +# Specify the platform (such as firmware). + +# Check whether --with-platform or --without-platform was given. +if test "${with_platform+set}" = set; then + withval="$with_platform" + +fi; + +# Guess the platform if not specified. +if test "x$with_platform" = x; then + case "$host_cpu"-"$host_vendor" in + i386-apple) platform=efi ;; + i386-*) platform=pc ;; + powerpc-*) platform=ieee1275 ;; + sparc64-*) platform=ieee1275 ;; + *) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5 +echo "$as_me: error: unsupported machine type" >&2;} + { (exit 1); exit 1; }; } ;; + esac +else + platform="$with_platform" +fi + +# Sanity check. +case "$host_cpu"-"$platform" in + i386-efi) ;; + i386-pc) ;; + powerpc-ieee1275) ;; + sparc64-ieee1275) ;; *) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5 echo "$as_me: error: unsupported machine type" >&2;} { (exit 1); exit 1; }; } ;; @@ -6576,7 +6606,7 @@ _ACEOF fi; # Output files. - ac_config_links="$ac_config_links include/grub/cpu:include/grub/$host_cpu include/grub/machine:include/grub/$host_cpu/$host_vendor" + ac_config_links="$ac_config_links include/grub/cpu:include/grub/$host_cpu include/grub/machine:include/grub/$host_cpu/$platform" ac_config_files="$ac_config_files Makefile gensymlist.sh genkernsyms.sh" @@ -7115,7 +7145,7 @@ do "genkernsyms.sh" ) CONFIG_FILES="$CONFIG_FILES genkernsyms.sh" ;; "stamp-h" ) CONFIG_FILES="$CONFIG_FILES stamp-h" ;; "include/grub/cpu" ) CONFIG_LINKS="$CONFIG_LINKS include/grub/cpu:include/grub/$host_cpu" ;; - "include/grub/machine" ) CONFIG_LINKS="$CONFIG_LINKS include/grub/machine:include/grub/$host_cpu/$host_vendor" ;; + "include/grub/machine" ) CONFIG_LINKS="$CONFIG_LINKS include/grub/machine:include/grub/$host_cpu/$platform" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -7210,6 +7240,7 @@ s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t +s,@platform@,$platform,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t diff --git a/configure.ac b/configure.ac index be80ce517..f3fe968b1 100644 --- a/configure.ac +++ b/configure.ac @@ -29,16 +29,35 @@ case "$host_cpu" in *) AC_MSG_ERROR([unsupported CPU type]) ;; esac -case "$host_cpu"-"$host_vendor" in - i386-apple | *-efi) host_vendor=efi ;; - i386-*) host_vendor=pc ;; - powerpc-*) host_vendor=ieee1275 ;; - sparc64-*) host_vendor=ieee1275 ;; +# Specify the platform (such as firmware). +AC_ARG_WITH([platform], + AS_HELP_STRING([--with-platform=PLATFORM], + [select the host platform [guessed]])) + +# Guess the platform if not specified. +if test "x$with_platform" = x; then + case "$host_cpu"-"$host_vendor" in + i386-apple) platform=efi ;; + i386-*) platform=pc ;; + powerpc-*) platform=ieee1275 ;; + sparc64-*) platform=ieee1275 ;; + *) AC_MSG_ERROR([unsupported machine type]) ;; + esac +else + platform="$with_platform" +fi + +# Sanity check. +case "$host_cpu"-"$platform" in + i386-efi) ;; + i386-pc) ;; + powerpc-ieee1275) ;; + sparc64-ieee1275) ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac AC_SUBST(host_cpu) -AC_SUBST(host_vendor) +AC_SUBST(platform) # Checks for programs. if test "x$CFLAGS" = x; then @@ -189,7 +208,7 @@ AC_ARG_ENABLE([mm-debug], # Output files. AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu - include/grub/machine:include/grub/$host_cpu/$host_vendor]) + include/grub/machine:include/grub/$host_cpu/$platform]) AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) AC_OUTPUT diff --git a/util/i386/efi/grub-mkimage.c b/util/i386/efi/grub-mkimage.c index aae418db2..acbfc7a8a 100644 --- a/util/i386/efi/grub-mkimage.c +++ b/util/i386/efi/grub-mkimage.c @@ -937,7 +937,7 @@ Make a bootable image of GRUB.\n\ -v, --verbose print verbose messages\n\ \n\ Report bugs to <%s>.\n\ -", GRUB_DATADIR, PACKAGE_BUGREPORT); +", GRUB_LIBDIR, PACKAGE_BUGREPORT); exit (status); } @@ -991,7 +991,7 @@ main (int argc, char *argv[]) if (! fp) grub_util_error ("cannot open %s", output); - convert_elf (dir ? : GRUB_DATADIR, fp, argv + optind); + convert_elf (dir ? : GRUB_LIBDIR, fp, argv + optind); fclose (fp); diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in index aceb7fe76..6be218bb5 100644 --- a/util/i386/pc/grub-install.in +++ b/util/i386/pc/grub-install.in @@ -1,7 +1,7 @@ #! /bin/sh # Install GRUB on your drive. -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -21,14 +21,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ sbindir=@sbindir@ -datadir=@datadir@ +libdir=@libdir@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ host_cpu=@host_cpu@ -host_os=@host_os@ -host_vendor=@host_vendor@ -pkgdatadir=${datadir}/${PACKAGE_TARNAME}/${host_cpu}-${host_vendor} +platform=@platform@ +pkglibdir=${libdir}/${PACKAGE_TARNAME}/${host_cpu}-${platform} grub_setup=${sbindir}/grub-setup grub_mkimage=${sbindir}/grub-mkimage @@ -202,7 +201,7 @@ for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do rm -f $file || exit 1 fi done -for file in ${pkgdatadir}/*.mod ${pkgdatadir}/*.lst ${pkgdatadir}/*.img; do +for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do cp -f $file ${grubdir} || exit 1 done diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index 99a331101..3cd1d589d 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -207,7 +207,7 @@ Make a bootable image of GRUB.\n\ -v, --verbose print verbose messages\n\ \n\ Report bugs to <%s>.\n\ -", GRUB_DATADIR, PACKAGE_BUGREPORT); +", GRUB_LIBDIR, PACKAGE_BUGREPORT); exit (status); } @@ -269,7 +269,7 @@ main (int argc, char *argv[]) grub_util_error ("cannot open %s", output); } - generate_image (dir ? : GRUB_DATADIR, fp, argv + optind); + generate_image (dir ? : GRUB_LIBDIR, fp, argv + optind); fclose (fp); diff --git a/util/powerpc/ieee1275/grub-install.in b/util/powerpc/ieee1275/grub-install.in index 42542bd2b..81ddb6263 100644 --- a/util/powerpc/ieee1275/grub-install.in +++ b/util/powerpc/ieee1275/grub-install.in @@ -1,7 +1,7 @@ #! /bin/sh # Install GRUB on your drive. -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. +# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,14 +24,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ sbindir=@sbindir@ -datadir=@datadir@ +libdir=@libdir@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ host_cpu=@host_cpu@ -host_os=@host_os@ -host_vendor=@host_vendor@ -pkgdatadir=${datadir}/${PACKAGE_TARNAME}/${host_cpu}-${host_vendor} +platform=@platform@ +pkglibdir=${libdir}/${PACKAGE_TARNAME}/${host_cpu}-${platform} grub_mkimage=${sbindir}/grub-mkimage rootdir= @@ -138,14 +137,14 @@ for file in ${grubdir}/*.mod ${grubdir}/*.lst ; do rm -f $file || exit 1 fi done -for file in ${pkgdatadir}/*.mod ${pkgdatadir}/*.lst ; do +for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ; do cp -f $file ${grubdir} || exit 1 done # Create the core image with all modules, unless user specified a subset. # XXX probe for partition map and filesystem? if test "x$modules" = x; then - modules="$pkgdatadir"/*.mod + modules="$pkglibdir"/*.mod fi # Now perform the installation. diff --git a/util/powerpc/ieee1275/grub-mkimage.c b/util/powerpc/ieee1275/grub-mkimage.c index f05784996..cb4d0c64c 100644 --- a/util/powerpc/ieee1275/grub-mkimage.c +++ b/util/powerpc/ieee1275/grub-mkimage.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004, 2005 Free Software Foundation, Inc. + * Copyright (C) 2004,2005,2006 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,7 +278,7 @@ Make a bootable image of GRUB.\n\ -v, --verbose print verbose messages\n\ \n\ Report bugs to <%s>.\n\ -", GRUB_DATADIR, PACKAGE_BUGREPORT); +", GRUB_LIBDIR, PACKAGE_BUGREPORT); exit (status); } @@ -336,7 +336,7 @@ main (int argc, char *argv[]) if (! fp) grub_util_error ("cannot open %s", output); - add_segments (dir ? : GRUB_DATADIR, fp, chrp, argv + optind); + add_segments (dir ? : GRUB_LIBDIR, fp, chrp, argv + optind); fclose (fp);