Blame SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
39700a
From: Andrey Borzenkov <arvidjaar@gmail.com>
39700a
Date: Sat, 18 Jan 2014 19:50:54 +0400
28f7f8
Subject: [PATCH] reintroduce BUILD_LDFLAGS for the cross-compile case
39700a
39700a
This allows providing separate LDFLAGS for build and host environments, which
39700a
are not necessary the same for cross-compile case. In particular, it allows
39700a
building host programs statically to not depend on presence of libraries at
39700a
run-time (e.g. MinGW DLLs on Windows) while continue to use default dynamic
39700a
linking at build time.
39700a
39700a
Also fix obsolete comments in confgure.ac - we do use different environment
39700a
for build and host now.
39700a
---
28f7f8
 configure.ac          | 13 ++++++++-----
28f7f8
 Makefile.am           |  8 ++++----
39700a
 ChangeLog             |  7 +++++++
39700a
 INSTALL               |  3 ++-
39700a
 grub-core/Makefile.am |  6 +++---
39700a
 5 files changed, 24 insertions(+), 13 deletions(-)
39700a
39700a
diff --git a/configure.ac b/configure.ac
28f7f8
index 7c5d080b8a2..2e4cf3c2e22 100644
39700a
--- a/configure.ac
39700a
+++ b/configure.ac
39700a
@@ -26,11 +26,10 @@ dnl This is necessary because the target type in autoconf does not
39700a
 dnl describe such a system very well.
39700a
 dnl
39700a
 dnl The current strategy is to use variables with no prefix (such as
39700a
-dnl CC, CFLAGS, etc.) for the host type as well as the build type,
39700a
-dnl because GRUB does not need to use those variables for the build
39700a
-dnl type, so there is no conflict. Variables with the prefix "TARGET_"
39700a
-dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
39700a
-dnl type.
39700a
+dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
39700a
+dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
39700a
+dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
39700a
+dnl used for the target type. See INSTALL for full list of variables.
39700a
 
39700a
 AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
39700a
 
39700a
@@ -477,6 +476,7 @@ AC_SUBST(HOST_CC)
39700a
 AC_SUBST(BUILD_CC)
39700a
 AC_SUBST(BUILD_CFLAGS)
39700a
 AC_SUBST(BUILD_CPPFLAGS)
39700a
+AC_SUBST(BUILD_LDFLAGS)
39700a
 AC_SUBST(TARGET_CC)
39700a
 AC_SUBST(TARGET_NM)
39700a
 AC_SUBST(TARGET_RANLIB)
39700a
@@ -1290,10 +1290,12 @@ SAVED_CC="$CC"
39700a
 SAVED_CPP="$CPP"
39700a
 SAVED_CFLAGS="$CFLAGS"
39700a
 SAVED_CPPFLAGS="$CPPFLAGS"
39700a
+SAVED_LDFLAGS="$LDFLAGS"
39700a
 CC="$BUILD_CC"
39700a
 CPP="$BUILD_CPP"
39700a
 CFLAGS="$BUILD_CFLAGS"
39700a
 CPPFLAGS="$BUILD_CPPFLAGS"
39700a
+LDFLAGS="$BUILD_LDFAGS"
39700a
 
39700a
 unset ac_cv_c_bigendian
39700a
 unset ac_cv_header_ft2build_h
39700a
@@ -1356,6 +1358,7 @@ CC="$SAVED_CC"
39700a
 CPP="$SAVED_CPP"
39700a
 CFLAGS="$SAVED_CFLAGS"
39700a
 CPPFLAGS="$SAVED_CPPFLAGS"
39700a
+LDFLAGS="$SAVED_LDFLAGS"
39700a
 
39700a
 
39700a
 DJVU_FONT_SOURCE=
28f7f8
diff --git a/Makefile.am b/Makefile.am
28f7f8
index 320e86f8f55..1bbec0e79d3 100644
28f7f8
--- a/Makefile.am
28f7f8
+++ b/Makefile.am
28f7f8
@@ -67,20 +67,20 @@ endif
28f7f8
 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
28f7f8
 
28f7f8
 build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
28f7f8
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
28f7f8
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
28f7f8
 CLEANFILES += build-grub-mkfont
28f7f8
 
28f7f8
 garbage-gen: util/garbage-gen.c
28f7f8
-	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS)  $^
28f7f8
+	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
28f7f8
 CLEANFILES += garbage-gen
28f7f8
 EXTRA_DIST += util/garbage-gen.c
28f7f8
 
28f7f8
 build-grub-gen-asciih: util/grub-gen-asciih.c
28f7f8
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
28f7f8
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
28f7f8
 CLEANFILES += build-grub-gen-asciih
28f7f8
 
28f7f8
 build-grub-gen-widthspec: util/grub-gen-widthspec.c
28f7f8
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
28f7f8
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
28f7f8
 CLEANFILES += build-grub-gen-widthspec
28f7f8
 
28f7f8
 if COND_STARFIELD
28f7f8
diff --git a/ChangeLog b/ChangeLog
28f7f8
index 8534158b6c0..9c3ef2e2150 100644
28f7f8
--- a/ChangeLog
28f7f8
+++ b/ChangeLog
28f7f8
@@ -1,3 +1,10 @@
28f7f8
+2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
28f7f8
+
28f7f8
+	* configure.ac: Add support for BUILD_LDFLAGS.
28f7f8
+	* Makefile.am: Use BUILD_LDFLAGS for build time programs here ...
28f7f8
+	* grub-core/Makefile.am: ... and here.
28f7f8
+	* INSTALL: Mention BUILD_LDFLAGS.
28f7f8
+
28f7f8
 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
28f7f8
 
28f7f8
 	* util/grub-mount.c: Extend GCC warning workaround to grub-mount.
28f7f8
diff --git a/INSTALL b/INSTALL
28f7f8
index db12530dff3..b67cd7f3476 100644
28f7f8
--- a/INSTALL
28f7f8
+++ b/INSTALL
28f7f8
@@ -168,7 +168,8 @@ corresponding platform are not needed for the platform in question.
28f7f8
        generate sin and cos tables.
28f7f8
     2. BUILD_CFLAGS= for C options for build.
28f7f8
     3. BUILD_CPPFLAGS= for C preprocessor options for build.
28f7f8
-    4. BUILD_FREETYPE= for freetype-config for build (optional).
28f7f8
+    4. BUILD_LDFLAGS= for linker options for build.
28f7f8
+    5. BUILD_FREETYPE= for freetype-config for build (optional).
28f7f8
 
28f7f8
   - For host
28f7f8
     1. --host= to autoconf name of host.
39700a
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
28f7f8
index 1b3142d2160..13b7979106f 100644
39700a
--- a/grub-core/Makefile.am
39700a
+++ b/grub-core/Makefile.am
39700a
@@ -27,14 +27,14 @@ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
39700a
 CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
39700a
 
39700a
 build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
39700a
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
39700a
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
39700a
 
39700a
 build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
39700a
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
39700a
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
39700a
 
39700a
 # gentrigtables
39700a
 gentrigtables: gentrigtables.c
39700a
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM)
39700a
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
39700a
 CLEANFILES += gentrigtables
39700a
 
39700a
 # trigtables.c