nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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