diff mbox

[v8,07/14] toolchain: add post-install hooks making the toolchain relocatable

Message ID 1460929111-15615-8-git-send-email-s.martin49@gmail.com
State Superseded
Headers show

Commit Message

Samuel Martin April 17, 2016, 9:38 p.m. UTC
This change adds the required dependency and post-target-install hooks
to render the toolchain relocatable.

Notes:
- Although the toolchain package is a virtual package, it does support
  hooks.
- This has to be post-target-install hooks because the toolchain package
  is handled as a "target" package.

Ultimately, this patch allows to generate relocatable toolchains, just
by doing:

  $ make menuconfig
  $ make toolchain

Then, this toolchain can be used/shared/deployed anywhere*.

*: on any Linux system with an ABI-compatible set of system libraries
   (usually including: glibc, libgcc, zlib, flex and libsigsegv).

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>

---
changes v7->v8:
- none

changes v6->v7:
- new patch
---
 toolchain/toolchain/toolchain.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Petazzoni April 18, 2016, 7:33 p.m. UTC | #1
Hello,

On Sun, 17 Apr 2016 23:38:24 +0200, Samuel Martin wrote:
> This change adds the required dependency and post-target-install hooks
> to render the toolchain relocatable.
> 
> Notes:
> - Although the toolchain package is a virtual package, it does support
>   hooks.
> - This has to be post-target-install hooks because the toolchain package
>   is handled as a "target" package.
> 
> Ultimately, this patch allows to generate relocatable toolchains, just
> by doing:
> 
>   $ make menuconfig
>   $ make toolchain
> 
> Then, this toolchain can be used/shared/deployed anywhere*.
> 
> *: on any Linux system with an ABI-compatible set of system libraries
>    (usually including: glibc, libgcc, zlib, flex and libsigsegv).
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Peter Korsgaard <peter@korsgaard.com>

Why is this needed? You already do such steps in the
TARGET_FINALIZE_HOOKS ?

Yes, it means after just a "make toolchain", you don't have a
relocatable toolchain. But Buildroot never guaranteed that a partial
build will yield fully  usable results.

So I would prefer to not have this patch, at least in the initial
version of the series.

Again, this stuff is complicated. Please keep things as minimal as
possible in a first step.

Thanks!

Thomas
diff mbox

Patch

diff --git a/toolchain/toolchain/toolchain.mk b/toolchain/toolchain/toolchain.mk
index c22713b..618aa64 100644
--- a/toolchain/toolchain/toolchain.mk
+++ b/toolchain/toolchain/toolchain.mk
@@ -12,6 +12,11 @@  endif
 
 TOOLCHAIN_ADD_TOOLCHAIN_DEPENDENCY = NO
 
+# dependency and hooks needed to make the toolchain relocatable
+TOOLCHAIN_DEPENDENCIES += host-patchelf
+TOOLCHAIN_POST_INSTALL_TARGET_HOOKS += HOST_SANITIZE_RPATH_HOOK \
+	STAGING_SANITIZE_RPATH_HOOK
+
 $(eval $(virtual-package))
 
 toolchain: $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake