dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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