dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

39700a
From 3bea802b45b9c98f70753370522fa6e47ba8966b Mon Sep 17 00:00:00 2001
39700a
From: Andrey Borzenkov <arvidjaar@gmail.com>
39700a
Date: Sat, 18 Jan 2014 19:50:54 +0400
39700a
Subject: [PATCH 022/143] 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
---
39700a
 ChangeLog             |  7 +++++++
39700a
 INSTALL               |  3 ++-
39700a
 Makefile.am           |  8 ++++----
39700a
 configure.ac          | 13 ++++++++-----
39700a
 grub-core/Makefile.am |  6 +++---
39700a
 5 files changed, 24 insertions(+), 13 deletions(-)
39700a
39700a
diff --git a/ChangeLog b/ChangeLog
39700a
index 8534158..9c3ef2e 100644
39700a
--- a/ChangeLog
39700a
+++ b/ChangeLog
39700a
@@ -1,3 +1,10 @@
39700a
+2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
39700a
+
39700a
+	* configure.ac: Add support for BUILD_LDFLAGS.
39700a
+	* Makefile.am: Use BUILD_LDFLAGS for build time programs here ...
39700a
+	* grub-core/Makefile.am: ... and here.
39700a
+	* INSTALL: Mention BUILD_LDFLAGS.
39700a
+
39700a
 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
 
39700a
 	* util/grub-mount.c: Extend GCC warning workaround to grub-mount.
39700a
diff --git a/INSTALL b/INSTALL
39700a
index db12530..b67cd7f 100644
39700a
--- a/INSTALL
39700a
+++ b/INSTALL
39700a
@@ -168,7 +168,8 @@ corresponding platform are not needed for the platform in question.
39700a
        generate sin and cos tables.
39700a
     2. BUILD_CFLAGS= for C options for build.
39700a
     3. BUILD_CPPFLAGS= for C preprocessor options for build.
39700a
-    4. BUILD_FREETYPE= for freetype-config for build (optional).
39700a
+    4. BUILD_LDFLAGS= for linker options for build.
39700a
+    5. BUILD_FREETYPE= for freetype-config for build (optional).
39700a
 
39700a
   - For host
39700a
     1. --host= to autoconf name of host.
39700a
diff --git a/Makefile.am b/Makefile.am
39700a
index 320e86f..1bbec0e 100644
39700a
--- a/Makefile.am
39700a
+++ b/Makefile.am
39700a
@@ -67,20 +67,20 @@ endif
39700a
 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
39700a
 
39700a
 build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
39700a
-	$(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)
39700a
+	$(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)
39700a
 CLEANFILES += build-grub-mkfont
39700a
 
39700a
 garbage-gen: util/garbage-gen.c
39700a
-	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS)  $^
39700a
+	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
39700a
 CLEANFILES += garbage-gen
39700a
 EXTRA_DIST += util/garbage-gen.c
39700a
 
39700a
 build-grub-gen-asciih: util/grub-gen-asciih.c
39700a
-	$(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
39700a
+	$(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
39700a
 CLEANFILES += build-grub-gen-asciih
39700a
 
39700a
 build-grub-gen-widthspec: util/grub-gen-widthspec.c
39700a
-	$(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
39700a
+	$(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
39700a
 CLEANFILES += build-grub-gen-widthspec
39700a
 
39700a
 if COND_STARFIELD
39700a
diff --git a/configure.ac b/configure.ac
39700a
index 7c5d080..2e4cf3c 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=
39700a
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
39700a
index 1b3142d..13b7979 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
39700a
-- 
39700a
1.9.3
39700a