nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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