Blame SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch

4fe85b
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4fe85b
From: Andrey Borzenkov <arvidjaar@gmail.com>
4fe85b
Date: Sat, 18 Jan 2014 23:15:40 +0400
4fe85b
Subject: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES
4fe85b
4fe85b
MinGW native nm does not support ELF binaries.
4fe85b
---
4fe85b
 ChangeLog                     | 8 ++++++++
4fe85b
 grub-core/Makefile.am         | 8 ++++----
4fe85b
 grub-core/genemuinit.sh       | 4 ++--
4fe85b
 grub-core/genemuinitheader.sh | 4 ++--
4fe85b
 4 files changed, 16 insertions(+), 8 deletions(-)
4fe85b
4fe85b
diff --git a/ChangeLog b/ChangeLog
4fe85b
index 9360345efc2..4688ff4e6d3 100644
4fe85b
--- a/ChangeLog
4fe85b
+++ b/ChangeLog
4fe85b
@@ -1,3 +1,11 @@
4fe85b
+2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
4fe85b
+
4fe85b
+	* grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES
4fe85b
+	instead of MOD_FILES.
4fe85b
+	* grub-core/genemuinit.sh: Simplify stripping of suffix so it works
4fe85b
+	both with and without .exe.
4fe85b
+	* grub-core/genemuinitheader.sh: Same.
4fe85b
+
4fe85b
 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
4fe85b
 
4fe85b
 	* util/grub-install.c: Fix a typo.
4fe85b
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
4fe85b
index 826b3dd7c1a..5c087c83b8f 100644
4fe85b
--- a/grub-core/Makefile.am
4fe85b
+++ b/grub-core/Makefile.am
4fe85b
@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
4fe85b
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
4fe85b
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
4fe85b
 
4fe85b
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
4fe85b
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
4fe85b
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
4fe85b
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
4fe85b
 CLEANFILES += grub_emu_init.h
4fe85b
 
4fe85b
-grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
4fe85b
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
4fe85b
+grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
4fe85b
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
4fe85b
 CLEANFILES += grub_emu_init.c
4fe85b
 endif
4fe85b
 
4fe85b
diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh
4fe85b
index 45c15ecb9f4..8c6bb1c18ff 100644
4fe85b
--- a/grub-core/genemuinit.sh
4fe85b
+++ b/grub-core/genemuinit.sh
4fe85b
@@ -47,7 +47,7 @@ EOF
4fe85b
 read mods
4fe85b
 for line in $mods; do
4fe85b
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
4fe85b
-      echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
4fe85b
+      echo "grub_${line%%.*}_init ();"
4fe85b
   fi
4fe85b
 done
4fe85b
 
4fe85b
@@ -63,7 +63,7 @@ EOF
4fe85b
 
4fe85b
 for line in $mods; do
4fe85b
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
4fe85b
-      echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
4fe85b
+      echo "grub_${line%%.*}_fini ();"
4fe85b
   fi
4fe85b
 done
4fe85b
 
4fe85b
diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh
4fe85b
index 6b83f599317..a99a15d06f1 100644
4fe85b
--- a/grub-core/genemuinitheader.sh
4fe85b
+++ b/grub-core/genemuinitheader.sh
4fe85b
@@ -44,9 +44,9 @@ EOF
4fe85b
 read mods
4fe85b
 for line in $mods; do
4fe85b
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
4fe85b
-      echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
4fe85b
+      echo "void grub_${line%%.*}_init (void);"
4fe85b
   fi
4fe85b
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
4fe85b
-      echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
4fe85b
+      echo "void grub_${line%%.*}_fini (void);"
4fe85b
   fi
4fe85b
 done