From patchwork Sat Jun 7 21:46:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 357160 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 7F4351400B0 for ; Sun, 8 Jun 2014 07:46:17 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8CC548BF81; Sat, 7 Jun 2014 21:46:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b-BsXW6G9mZs; Sat, 7 Jun 2014 21:46:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8FF9C8BEEE; Sat, 7 Jun 2014 21:46:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 594931BF9D3 for ; Sat, 7 Jun 2014 21:46:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 537BC8C043 for ; Sat, 7 Jun 2014 21:46:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zLKurqKD9ABW for ; Sat, 7 Jun 2014 21:46:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by whitealder.osuosl.org (Postfix) with ESMTP id 542578BF1E for ; Sat, 7 Jun 2014 21:46:11 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 6675192A; Sat, 7 Jun 2014 23:46:12 +0200 (CEST) Received: from localhost (81.89.92.92.rev.sfr.net [92.92.89.81]) by mail.free-electrons.com (Postfix) with ESMTPSA id B08977AC; Sat, 7 Jun 2014 23:46:11 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Sat, 7 Jun 2014 23:46:04 +0200 Message-Id: <1402177567-8021-2-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1402177567-8021-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1402177567-8021-1-git-send-email-thomas.petazzoni@free-electrons.com> Cc: Thomas Petazzoni Subject: [Buildroot] [RFCv1 1/4] toolchain-external: split target installation from staging installation X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Currently, all the installation work of the toolchain-external package is done during the install-staging step. However, in order to be able to properly collect the size added by each package to the target filesystem, we need to make sure that toolchain-external installs its files to $(TARGET_DIR) during the install-target step. Signed-off-by: Thomas Petazzoni Reviewed-by: "Yann E. MORIN" Tested-by: "Yann E. MORIN" --- toolchain/toolchain-external/toolchain-external.mk | 36 +++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index c73cc4a..45926cf 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -551,7 +551,7 @@ endif # considered when searching libraries for copy # to the target filesystem. -define TOOLCHAIN_EXTERNAL_INSTALL_CORE +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ if test -z "$${SYSROOT_DIR}" ; then \ @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ @@ -576,8 +576,6 @@ define TOOLCHAIN_EXTERNAL_INSTALL_CORE $(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \ done ; \ fi ; \ - $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ - $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \ if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \ $(call MESSAGE,"Copying gdbserver") ; \ gdbserver_found=0 ; \ @@ -595,6 +593,26 @@ define TOOLCHAIN_EXTERNAL_INSTALL_CORE fi endef +define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS + $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ + if test -z "$${SYSROOT_DIR}" ; then \ + @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ + exit 1 ; \ + fi ; \ + ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + SUPPORT_LIB_DIR="" ; \ + if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ + LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ + if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \ + SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \ + fi ; \ + fi ; \ + ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \ + $(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \ + $(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) +endef + # Special installation target used on the Blackfin architecture when # FDPIC is not the primary binary format being used, but the user has # nonetheless requested the installation of the FDPIC libraries to the @@ -685,15 +703,19 @@ define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT fi endef +define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS + $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) + $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) + $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) +endef + # Even though we're installing things in both the staging, the host # and the target directory, we do everything within the # install-staging step, arbitrarily. -define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS - $(TOOLCHAIN_EXTERNAL_INSTALL_CORE) +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS + $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT) - $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) - $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) endef $(eval $(generic-package))