grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Re-enable grub-extras


From: Colin Watson
Subject: [PATCH] Re-enable grub-extras
Date: Tue, 21 Sep 2010 19:35:30 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Here's a patch to re-enable grub-extras by allowing extra modules to
provide Autogen definitions files.  A few things to note:

  * I had to have autogen.sh create 'contrib' symlinks in the source
    tree, as Automake got hopelessly confused when I had $(GRUB_CONTRIB)
    in source file names - automatic dependency handling in particular
    broke in some thoroughly tortuous ways.  I don't think this is too
    ugly but you might like to know why I did it!

  * I added the facility for image blocks in .def files to override the
    image extension, in order to translate ntldr-img's build system
    reasonably faithfully.

  * This patch supports extra modules providing either Makefile.core.def
    (for extra target objects, built from grub-core) or
    Makefile.util.def (for extra utility programs, built from the top
    level).  I don't have any examples of the latter right now, but it
    was easy to provide both and might save somebody scratching their
    head working out how to do it later.

  * Extra modules may also provide Makefile.common with literal Automake
    input, for those cases where it's too hard to cram things into
    Autogen.

  * I know we don't normally discuss grub-extras patches here, but it
    seems difficult not to in this case.  I've attached the patches
    required for each of the five grub-extras modules I know about to
    this mail.

  * grldr.img used to have build rules but not actually be built
    automatically; it's now built automatically.  I didn't think it was
    worth the contortions to try to fix this.

2010-09-21  Colin Watson  <address@hidden>

        Re-enable grub-extras.

        * Makefile.am: Include Makefile.extras.am.
        * grub-core/Makefile.am: Likewise.
        * autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to
        avoid confusing Automake.  Run autogen for each extra module.
        * .bzrignore: Add Makefile.extras.am, contrib,
        grub-core/Makefile.extras.am, and grub-core/contrib.

        * gentpl.py (image): Allow definitions files to override the image
        extension.

=== modified file '.bzrignore'
--- .bzrignore  2010-09-20 13:03:47 +0000
+++ .bzrignore  2010-09-21 18:05:33 +0000
@@ -104,9 +104,13 @@ grub-core/lib/libgcrypt-grub
 **/.deps-core
 **/.dirstamp
 Makefile.util.am
+Makefile.extras.am
+contrib
 grub-core/Makefile.core.am
 grub-core/Makefile.gcry.am
 grub-core/Makefile.gcry.def
+grub-core/Makefile.extras.am
+grub-core/contrib
 grub-core/genmod.sh
 grub-core/gensyminfo.sh
 grub-core/*.module

=== modified file 'Makefile.am'
--- Makefile.am 2010-09-20 12:55:49 +0000
+++ Makefile.am 2010-09-21 13:18:03 +0000
@@ -19,6 +19,7 @@ CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB)
 CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB)
 
 include $(srcdir)/Makefile.util.am
+include $(srcdir)/Makefile.extras.am
 
 # XXX Use Automake's LEX & YACC support
 grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y

=== modified file 'autogen.sh'
--- autogen.sh  2010-08-23 08:37:29 +0000
+++ autogen.sh  2010-09-21 16:09:03 +0000
@@ -18,6 +18,37 @@ autogen -T Makefile.tpl Makefile.util.de
 autogen -T Makefile.tpl grub-core/Makefile.core.def | sed -e 
'/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
 autogen -T Makefile.tpl grub-core/Makefile.gcry.def | sed -e 
'/^$/{N;/^\n$/D;}' > grub-core/Makefile.gcry.am
 
+# Automake doesn't like including files from a path outside the project.
+if [ "x${GRUB_CONTRIB}" != x ] && [ "x${GRUB_CONTRIB}" != xcontrib ]; then
+  rm -f contrib grub-core/contrib
+  ln -s "${GRUB_CONTRIB}" contrib
+  ln -s ../contrib grub-core/contrib
+fi
+
+> grub-core/Makefile.extras.am
+for extra in contrib/*/Makefile.core.def; do
+  if test -e "$extra"; then
+    extra_name="$(basename "$(dirname "$extra")")"
+    autogen -T Makefile.tpl "$extra" | sed -e '/^$/{N;/^\n$/D;}' > 
"contrib/$extra_name/Makefile.core.am"
+    if test -e "contrib/$extra_name/Makefile.common"; then
+      echo "include contrib/$extra_name/Makefile.common" >> 
grub-core/Makefile.extras.am
+    fi
+    echo "include contrib/$extra_name/Makefile.core.am" >> 
grub-core/Makefile.extras.am
+  fi
+done
+
+> Makefile.extras.am
+for extra in contrib/*/Makefile.util.def; do
+  if test -e "$extra"; then
+    extra_name="$(basename "$(dirname "$extra")")"
+    autogen -T Makefile.tpl "$extra" | sed -e '/^$/{N;/^\n$/D;}' > 
"contrib/$extra_name/Makefile.util.am"
+    if test -e "contrib/$extra_name/Makefile.common"; then
+      echo "include contrib/$extra_name/Makefile.common" >> Makefile.extras.am
+    fi
+    echo "include contrib/$extra_name/Makefile.util.am" >> Makefile.extras.am
+  fi
+done
+
 echo "Saving timestamps..."
 echo timestamp > stamp-h.in
 

=== modified file 'gentpl.py'
--- gentpl.py   2010-09-19 13:24:45 +0000
+++ gentpl.py   2010-09-21 17:35:56 +0000
@@ -328,9 +328,10 @@ def image(platform):
     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
 
-    r += gvar_add("platform_DATA", "[+ name +].img")
-    r += gvar_add("CLEANFILES", "[+ name +].img")
-    r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """
+    extension = "[+ IF extension defined +][+ extension +][+ ELSE +]img[+ 
ENDIF +]"
+    r += gvar_add("platform_DATA", "[+ name +]." + extension)
+    r += gvar_add("CLEANFILES", "[+ name +]." + extension)
+    r += rule("[+ name +]." + extension, "[+ name +].image$(EXEEXT)", """
 if test x$(USE_APPLE_CC_FIXES) = xyes; then \
   $(MACHO2IMG) $< $@; \
 else \

=== modified file 'grub-core/Makefile.am'
--- grub-core/Makefile.am       2010-09-19 20:22:43 +0000
+++ grub-core/Makefile.am       2010-09-21 13:17:52 +0000
@@ -52,6 +52,7 @@ CLEANFILES += grub_script.yy.c grub_scri
 
 include $(srcdir)/Makefile.core.am
 include $(srcdir)/Makefile.gcry.am
+include $(srcdir)/Makefile.extras.am
 
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h

-- 
Colin Watson                                       address@hidden

Attachment: 915resolution.patch
Description: Text Data

Attachment: gpxe.patch
Description: Text Data

Attachment: lua.patch
Description: Text Data

Attachment: ntldr-img.patch
Description: Text Data

Attachment: zfs.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]