From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W2Jt9-0006o0-7r for mharc-grub-devel@gnu.org; Sun, 12 Jan 2014 07:11:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Jt3-0006nl-DU for grub-devel@gnu.org; Sun, 12 Jan 2014 07:11:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Jsy-0001aB-SY for grub-devel@gnu.org; Sun, 12 Jan 2014 07:11:29 -0500 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:41978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Jsy-0001ZX-Et for grub-devel@gnu.org; Sun, 12 Jan 2014 07:11:24 -0500 Received: by mail-la0-f46.google.com with SMTP id b8so2695859lan.33 for ; Sun, 12 Jan 2014 04:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type; bh=b0l5PbayU/6LeeHL9Z4klegHeuWZ3Bj89+NqlN1UaKY=; b=OUaNFE/KwCVyOnnuep3sMglDZxJorbJb2J+fcNpMpMCbEjFkwo+C2gr67DWuqTBUo3 kAwf2d++0FhCxKQXjEasjGMrLIdbK0B8Meq9hnixpx/H6a2krfS/UksEHpNhDPDOenQg eHoHHqilQYqXK+xFSCDsNyZ1m0fU0HzbbQ1N2tf+iPdd3KFK77g2ZhnwAo8Pa71PA9wR xg/xc0ia0MESzoYLMU5FUewDfS20nNuxbNAcmZyElaZKScknjxFwddBLZZT4hbFx0P+o to0jJMEWyTmKmf0G9cifrQs4qfwkxydO+6q0smtLMLroHSpb0o2Sm8V3Pv5FIgn3SMWM JugA== X-Received: by 10.112.164.229 with SMTP id yt5mr1600132lbb.31.1389528683318; Sun, 12 Jan 2014 04:11:23 -0800 (PST) Received: from opensuse.site (ppp91-76-163-241.pppoe.mtu-net.ru. [91.76.163.241]) by mx.google.com with ESMTPSA id dw1sm7369965lbc.4.2014.01.12.04.11.21 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sun, 12 Jan 2014 04:11:22 -0800 (PST) Date: Sun, 12 Jan 2014 16:11:21 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: [PATCH] reintroduce BUILD_LDFLAGS for the cross-compile case Message-ID: <20140112161121.4d2d4b2b@opensuse.site> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/x/0ZjeMVXc6fwkZYDR99F/Q" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22e X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jan 2014 12:11:33 -0000 --MP_/x/0ZjeMVXc6fwkZYDR99F/Q Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline This allows providing separate LDFLAGS for build and host environment, which are not necessary the same for cross-compile case. In particular, it allows building host programs statically to not depend on presence of libraries at run-time (e.g. MinGW environment on Windows) while continue to use default build time dynamic linking. Also fix obsolete comments in confgure.ac - we do use different environment for build and host now. In principle, it would be enough to just reset LDFLAGS before performing build time tests, but I think this functionality is useful by itself (e.g. to be able to link with libraries in non-standard location). And patch itself it trivial enough. Attached because git won't send mail with so long lines. --MP_/x/0ZjeMVXc6fwkZYDR99F/Q Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=build_ldflags.patch From: Andrey Borzenkov Subject: [PATCH] reintroduce BUILD_LDFLAGS for the cross-compile case This allows providing separate LDFLAGS for build and host environment, which are not necessary the same for cross-compile case. In particular, it allows building host programs statically to not depend on presence of libraries at run-time (e.g. MinGW environment on Windows) while continue to use default build time dynamic linking. Also fix obsolete comments in confgure.ac - we do use different environment for build and host now. --- INSTALL | 3 ++- Makefile.am | 8 ++++---- configure.ac | 13 ++++++++----- grub-core/Makefile.am | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/INSTALL b/INSTALL index db12530..b67cd7f 100644 --- a/INSTALL +++ b/INSTALL @@ -168,7 +168,8 @@ corresponding platform are not needed for the platform in question. generate sin and cos tables. 2. BUILD_CFLAGS= for C options for build. 3. BUILD_CPPFLAGS= for C preprocessor options for build. - 4. BUILD_FREETYPE= for freetype-config for build (optional). + 4. BUILD_LDFLAGS= for linker options for build. + 5. BUILD_FREETYPE= for freetype-config for build (optional). - For host 1. --host= to autoconf name of host. diff --git a/Makefile.am b/Makefile.am index 320e86f..1bbec0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,20 +67,20 @@ endif 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 build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c - $(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) + $(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) CLEANFILES += build-grub-mkfont garbage-gen: util/garbage-gen.c - $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^ + $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ CLEANFILES += garbage-gen EXTRA_DIST += util/garbage-gen.c build-grub-gen-asciih: util/grub-gen-asciih.c - $(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 + $(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 CLEANFILES += build-grub-gen-asciih build-grub-gen-widthspec: util/grub-gen-widthspec.c - $(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 + $(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 CLEANFILES += build-grub-gen-widthspec if COND_STARFIELD diff --git a/configure.ac b/configure.ac index 7c5d080..2e4cf3c 100644 --- a/configure.ac +++ b/configure.ac @@ -26,11 +26,10 @@ dnl This is necessary because the target type in autoconf does not dnl describe such a system very well. dnl dnl The current strategy is to use variables with no prefix (such as -dnl CC, CFLAGS, etc.) for the host type as well as the build type, -dnl because GRUB does not need to use those variables for the build -dnl type, so there is no conflict. Variables with the prefix "TARGET_" -dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target -dnl type. +dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_" +dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables +dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are +dnl used for the target type. See INSTALL for full list of variables. AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org]) @@ -477,6 +476,7 @@ AC_SUBST(HOST_CC) AC_SUBST(BUILD_CC) AC_SUBST(BUILD_CFLAGS) AC_SUBST(BUILD_CPPFLAGS) +AC_SUBST(BUILD_LDFLAGS) AC_SUBST(TARGET_CC) AC_SUBST(TARGET_NM) AC_SUBST(TARGET_RANLIB) @@ -1290,10 +1290,12 @@ SAVED_CC="$CC" SAVED_CPP="$CPP" SAVED_CFLAGS="$CFLAGS" SAVED_CPPFLAGS="$CPPFLAGS" +SAVED_LDFLAGS="$LDFLAGS" CC="$BUILD_CC" CPP="$BUILD_CPP" CFLAGS="$BUILD_CFLAGS" CPPFLAGS="$BUILD_CPPFLAGS" +LDFLAGS="$BUILD_LDFAGS" unset ac_cv_c_bigendian unset ac_cv_header_ft2build_h @@ -1356,6 +1358,7 @@ CC="$SAVED_CC" CPP="$SAVED_CPP" CFLAGS="$SAVED_CFLAGS" CPPFLAGS="$SAVED_CPPFLAGS" +LDFLAGS="$SAVED_LDFLAGS" DJVU_FONT_SOURCE= diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 1b3142d..13b7979 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -27,14 +27,14 @@ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c - $(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\" $^ + $(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\" $^ build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c - $(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\" $^ + $(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\" $^ # gentrigtables gentrigtables: gentrigtables.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM) + $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) CLEANFILES += gentrigtables # trigtables.c -- tg: (0776112..) u/build_ldflags (depends on: master) --MP_/x/0ZjeMVXc6fwkZYDR99F/Q--