All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next v8 3/6] package/pkg-generic: make libtool .la files compatible with per-package directories
Date: Tue,  5 Nov 2019 17:46:42 +0100	[thread overview]
Message-ID: <20191105164646.23820-4-thomas.petazzoni@bootlin.com> (raw)
In-Reply-To: <20191105164646.23820-1-thomas.petazzoni@bootlin.com>

Libtool .la files unfortunately contain a number of absolute paths,
which now refer to per-package directories. Due to this, when building
package A, .la files may contain absolute paths referring to
directories in package B per-package sysroot. This causes some -L
flags referring to other sysroot from being added, which doesn't work
as the linker no longer realizes that such paths are within its
sysroot.

To fix this, we introduce a replacement step of .la files in the
configure step, to make sure all paths refer to this package
per-package directory.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/pkg-generic.mk | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index b7b211e6e4..71792d58a9 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -134,6 +134,21 @@ endef
 GLOBAL_INSTRUMENTATION_HOOKS += step_user
 endif
 
+#######################################
+# Helper functions
+
+# Make sure .la files only reference the current per-package
+# directory.
+
+# $1: package name (lower case)
+# $2: staging directory of the package
+ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
+define fixup-libtool-files
+	$(Q)find $(2)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
+		$(SED) "s:$(PER_PACKAGE_DIR)/[^/]+/:$(PER_PACKAGE_DIR)/$(1)/:g"
+endef
+endif
+
 ################################################################################
 # Implicit targets -- produce a stamp file for each step of a package build
 ################################################################################
@@ -230,6 +245,7 @@ $(BUILD_DIR)/%/.stamp_configured:
 	@$(call step_start,configure)
 	@$(call MESSAGE,"Configuring")
 	$(call prepare-per-package-directory,$($(PKG)_FINAL_DEPENDENCIES))
+	$(call fixup-libtool-files,$(NAME),$(STAGING_DIR))
 	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_CONFIGURE_CMDS)
 	$(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
@@ -919,6 +935,7 @@ $$($(2)_TARGET_INSTALL_IMAGES):		PKG=$(2)
 $$($(2)_TARGET_INSTALL_HOST):		PKG=$(2)
 $$($(2)_TARGET_BUILD):			PKG=$(2)
 $$($(2)_TARGET_CONFIGURE):		PKG=$(2)
+$$($(2)_TARGET_CONFIGURE):		NAME=$(1)
 $$($(2)_TARGET_RSYNC):			SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
 $$($(2)_TARGET_RSYNC):			PKG=$(2)
 $$($(2)_TARGET_PATCH):			PKG=$(2)
-- 
2.21.0

  parent reply	other threads:[~2019-11-05 16:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 16:46 [Buildroot] [PATCH next v8 0/6] Top-level parallel build support Thomas Petazzoni
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 1/6] core: implement per-package SDK and target Thomas Petazzoni
2019-11-29 14:20   ` Peter Korsgaard
2023-11-10 14:12   ` [Buildroot] [BUG?] per-package not fully working with dependencies and rebuild John Ernberg
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 2/6] Makefile: allow top-level parallel build with BR2_PER_PACKAGE_DIRECTORIES=y Thomas Petazzoni
2019-11-29 14:20   ` Peter Korsgaard
2019-11-05 16:46 ` Thomas Petazzoni [this message]
2019-11-20 20:22   ` [Buildroot] [PATCH next v8 3/6] package/pkg-generic: make libtool .la files compatible with per-package directories Matthew Weber
2019-11-29 14:24   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 4/6] package/pkg-kconfig: handle KCONFIG_DEPENDENCIES " Thomas Petazzoni
2019-11-29 14:39   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 5/6] docs/manual: add details about top-level parallel build support Thomas Petazzoni
2019-11-29 14:43   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 6/6] docs/manual: document the effect of per-package directory on variables Thomas Petazzoni
2019-11-29 14:43   ` Peter Korsgaard
2019-11-06 19:37 ` [Buildroot] [PATCH next v8 0/6] Top-level parallel build support Bernd Kuhls

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105164646.23820-4-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.