Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC v3 30/30] pkg-generic: add support for per-package staging directory
Date: Fri, 06 Mar 2015 01:28:42 +0100	[thread overview]
Message-ID: <54F8F4BA.7020800@mind.be> (raw)
In-Reply-To: <1425374255-6827-31-git-send-email-fabio.porcedda@gmail.com>

On 03/03/15 10:17, Fabio Porcedda wrote:
> Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
> ---
>  Makefile               |  2 +-
>  package/Makefile.in    |  1 +
>  package/pkg-generic.mk | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  3 files changed, 54 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 3723abc..6619bad 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -832,7 +832,7 @@ printvars:
>  
>  clean:
>  	rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
> -		$(BUILD_DIR) $(BASE_DIR)/staging \
> +		$(BUILD_DIR) $(BASE_DIR)/staging $(STAGINGPKG_DIR) \
>  		$(LEGAL_INFO_DIR)
>  
>  distclean: clean
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 6cfe3ed..2a21c9d 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -109,6 +109,7 @@ endif
>  STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
>  STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
>  STAGINGNOPKG_DIR := $(STAGING_DIR)
> +STAGINGPKG_DIR = $(BASE_DIR)/stagingpkg

 Since $(STAGING_DIR) no longer contains everything, the staging symlink has
really become pointless. For me, it's only use was that you could set the
debugger's sysroot to it to get access to unstripped .so files. And then, we can
reuse $(BASE_DIR)/staging for $(STAGINGPKG_DIR).

>  
>  TARGET_OPTIMIZATION := $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
>  
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index 43289d0..c35f801 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -208,7 +208,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
>  		$(call MESSAGE,"Fixing package configuration files") ;\
>  			$(SED)  "s,$(BASE_DIR), at BASE_DIR@,g" \
>  				-e "s,$(STAGING_DIR), at STAGING_DIR@,g" \
> -				-e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
> +				-e 's,^\(exec_\)\?prefix=.*,\1prefix=`echo $$0 | sed '"'"'s_/[^/]*/[^/]*$$__'"'"'`,g' \

 Wow, ridiculously complicated quoting...
 More importantly, however: shouldn't this be for all the replacements, i.e. a
couple of lines below...

>  				-e "s,-I/usr/,-I at STAGING_DIR@/usr/,g" \
>  				-e "s,-L/usr/,-L at STAGING_DIR@/usr/,g" \
>  				-e "s, at STAGING_DIR@,$(STAGING_DIR),g" \

 ... here?

> @@ -247,7 +247,7 @@ $(BUILD_DIR)/%/.stamp_target_installed:
>  
>  # Remove package sources
>  $(BUILD_DIR)/%/.stamp_dircleaned:
> -	rm -Rf $(@D)
> +	rm -Rf $(@D) $(STAGINGPKG_DIR)/$(call LOWERCASE,$(PKG))
>  
>  ################################################################################
>  # virt-provides-single -- check that provider-pkg is the declared provider for
> @@ -431,6 +431,38 @@ endif
>  # Eliminate duplicates in dependencies
>  $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
>  
> +ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)

 I guess the intention here is to still install the toolchain stuff in the
original staging directory. But is that really needed? Since all packages depend
on toolchain, they'd just copy in the toolchain staging dir into their private
staging dir. Right?

> + $(2)_STAGING_DIR = $$(STAGINGPKG_DIR)/$(1)
> + $(2)_TARGET_CPPFLAGS = $$(strip $$(TARGET_CPPFLAGS) -I$$($(2)_STAGING_DIR)/usr/include)

 Actually, it would be sufficient to add -I$(STAGING_DIR)/usr/include to
TARGET_CPPFLAGS. Since STAGING_DIR is set to the per-package staging dir in the
build rules below, it will get carried over into the TARGET_CPPFLAGS variable,
which only gets expanded when the rules are run. Same for all the other
variables you set here.

> + $(2)_TARGET_LDFLAGS = $$(TARGET_LDFLAGS) -L$$($(2)_STAGING_DIR)/usr/lib -Wl,-rpath,$$($(2)_STAGING_DIR)/usr/lib
> + $(2)_TARGET_CONFIGURE_OPTS = \
> +	$$(TARGET_CONFIGURE_OPTS) \
> +	PKG_CONFIG_SYSROOT_DIR="$$($(2)_STAGING_DIR)" \
> +	PKG_CONFIG_PATH="$$($(2)_STAGING_DIR)/usr/lib/pkgconfig"
> + $(2)_TARGET_MAKE_ENV = \
> +	$$(TARGET_MAKE_ENV) \
> +	PKG_CONFIG_SYSROOT_DIR="$$($(2)_STAGING_DIR)" \
> +	PKG_CONFIG_PATH="$$($(2)_STAGING_DIR)/usr/lib/pkgconfig"
> +else
> + $(2)_STAGING_DIR = $$(STAGING_DIR)
> + $(2)_TARGET_CONFIGURE_OPTS = $$(TARGET_CONFIGURE_OPTS)
> + $(2)_TARGET_MAKE_ENV = $$(TARGET_MAKE_ENV)
> +endif
> +
> +ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
> + $(2)_STAGING_DIRS = $$(wildcard $$(foreach dep,\
> +	$$(filter-out host-% toolchain,$$($(2)_FINAL_DEPENDENCIES)),\
> +	$$($$(call UPPERCASE,$$(dep))_STAGING_DIR)))
> +
> + define $(2)_PREPARE_STAGING_DIR
> +	mkdir -p $$(STAGING_DIR)/usr/include $$(STAGING_DIR)/usr/lib
> +	$$(if $$($(2)_STAGING_DIRS),
> +		cp -rdpf $$(addsuffix /*,$$($(2)_STAGING_DIRS)) \
> +			$$($(2)_STAGING_DIR))

 Why not just
		cp -rdpf -t $$($(2)_STAGING_DIR) $$($(2)_STAGING_DIRS)
?


 Regards,
 Arnout


> + endef
> + $(2)_PRE_CONFIGURE_HOOKS := $(2)_PREPARE_STAGING_DIR $$($(2)_PRE_CONFIGURE_HOOKS)
> +endif
> +
>  $(2)_INSTALL_STAGING		?= NO
>  $(2)_INSTALL_IMAGES		?= NO
>  $(2)_INSTALL_TARGET		?= YES
> @@ -604,11 +636,29 @@ $(1)-reconfigure:	$(1)-clean-for-reconfigure $(1)
>  # define the PKG variable for all targets, containing the
>  # uppercase package variable prefix
>  $$($(2)_TARGET_INSTALL_TARGET):		PKG=$(2)
> +$$($(2)_TARGET_INSTALL_TARGET):		STAGING_DIR:=$$($(2)_STAGING_DIR)
> +$$($(2)_TARGET_INSTALL_TARGET):		TARGET_CPPFLAGS:=$$($(2)_TARGET_CPPFLAGS)
> +$$($(2)_TARGET_INSTALL_TARGET):		TARGET_LDFLAGS:=$$($(2)_TARGET_LDFLAGS)
> +$$($(2)_TARGET_INSTALL_TARGET):		TARGET_CONFIGURE_OPTS:=$$($(2)_TARGET_CONFIGURE_OPTS)
>  $$($(2)_TARGET_INSTALL_STAGING):	PKG=$(2)
> +$$($(2)_TARGET_INSTALL_STAGING):	STAGING_DIR:=$$($(2)_STAGING_DIR)
> +$$($(2)_TARGET_INSTALL_STAGING):	TARGET_CPPFLAGS:=$$($(2)_TARGET_CPPFLAGS)
> +$$($(2)_TARGET_INSTALL_STAGING):	TARGET_LDFLAGS:=$$($(2)_TARGET_LDFLAGS)
> +$$($(2)_TARGET_INSTALL_STAGING):	TARGET_CONFIGURE_OPTS:=$$($(2)_TARGET_CONFIGURE_OPTS)
>  $$($(2)_TARGET_INSTALL_IMAGES):		PKG=$(2)
>  $$($(2)_TARGET_INSTALL_HOST):           PKG=$(2)
> +$$($(2)_TARGET_INSTALL_HOST):		STAGING_DIR:=$$($(2)_STAGING_DIR)
>  $$($(2)_TARGET_BUILD):			PKG=$(2)
> +$$($(2)_TARGET_BUILD):			STAGING_DIR:=$$($(2)_STAGING_DIR)
> +$$($(2)_TARGET_BUILD):			TARGET_CPPFLAGS:=$$($(2)_TARGET_CPPFLAGS)
> +$$($(2)_TARGET_BUILD):			TARGET_LDFLAGS:=$$($(2)_TARGET_LDFLAGS)
> +$$($(2)_TARGET_BUILD):			TARGET_CONFIGURE_OPTS:=$$($(2)_TARGET_CONFIGURE_OPTS)
> +$$($(2)_TARGET_BUILD):			TARGET_MAKE_ENV:=$$($(2)_TARGET_MAKE_ENV)
>  $$($(2)_TARGET_CONFIGURE):		PKG=$(2)
> +$$($(2)_TARGET_CONFIGURE):		STAGING_DIR:=$$($(2)_STAGING_DIR)
> +$$($(2)_TARGET_CONFIGURE):		TARGET_CPPFLAGS:=$$($(2)_TARGET_CPPFLAGS)
> +$$($(2)_TARGET_CONFIGURE):		TARGET_LDFLAGS:=$$($(2)_TARGET_LDFLAGS)
> +$$($(2)_TARGET_CONFIGURE):		TARGET_CONFIGURE_OPTS:=$$($(2)_TARGET_CONFIGURE_OPTS)
>  $$($(2)_TARGET_RSYNC):                  SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
>  $$($(2)_TARGET_RSYNC):                  PKG=$(2)
>  $$($(2)_TARGET_RSYNC_SOURCE):		SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

  reply	other threads:[~2015-03-06  0:28 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  9:17 [Buildroot] [RFC v3 00/30] Add per-package staging feature Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 01/30] rtmpdump: use TARGET_LDFLAGS instead of TARGET_CFLAGS for XLDFLAGS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 02/30] xinetd: use TARGET_LDFLAGS in order to support per-package staging Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 03/30] iproute2: use the TARGET_LDFLAGS variable Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 04/30] opentyrian: use TARGET_LDFLAGS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 05/30] pppd: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 06/30] openswan: set LDFLAGS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 07/30] exim: use TARGET_LDFLAGS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 08/30] fbv: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 09/30] cups: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 10/30] faifa: " Fabio Porcedda
2015-03-03 16:57   ` Baruch Siach
2015-03-08 15:14     ` Fabio Porcedda
2015-03-08 15:18       ` Baruch Siach
2015-03-08 15:30         ` Fabio Porcedda
2015-03-08 16:28           ` Baruch Siach
2015-03-03  9:17 ` [Buildroot] [RFC v3 11/30] iw: use TARGET_CONFIGURE_OPTS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 12/30] dhcpdump: use TARGET_CONFIGURE_OPTS in order to support PPS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 13/30] dtc: add add support for per-package staging directory Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 14/30] openssh: add support to the " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 15/30] mjpg-streamer: add support for " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 16/30] tcpreplay: delay the execution of pcap-config Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 17/30] erlang: add support for the per-package staging directory Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 18/30] perl: don't loose the -shared flag when TARGET_LDFLAGS isn't empty Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 19/30] erlang-p1-iconv: bump to a version that use TARGET_CFLAGS Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 20/30] erlang-p1-zlib: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 21/30] lmbench: to be checked Fabio Porcedda
2015-03-03 16:56   ` Baruch Siach
2015-03-08 14:53     ` Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 22/30] Makefile: add the STAGINGNOPKG_DIR variable Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 23/30] gpsd: add support for per-package staging directory Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 24/30] triggerhappy: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 25/30] ipsec-tools: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 26/30] pkg-cmake: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 27/30] pkg-luarocks: " Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 28/30] pkgconf: Move PKG_CONFIG_HOST_BINARY to Makefile.in Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 29/30] pkg-generic: ADD_TOOLCHAIN_DEPENDENCY is true only for target packages Fabio Porcedda
2015-03-03  9:17 ` [Buildroot] [RFC v3 30/30] pkg-generic: add support for per-package staging directory Fabio Porcedda
2015-03-06  0:28   ` Arnout Vandecappelle [this message]
2015-05-13  6:22     ` Fabio Porcedda
2015-03-03 13:29 ` [Buildroot] [RFC v3 00/30] Add per-package staging feature Thomas Petazzoni
2015-03-03 14:03   ` Fabio Porcedda
2015-03-03 14:21     ` Thomas Petazzoni
2015-03-11 17:29       ` Fabio Porcedda
2015-03-05  3:54   ` Jérôme Oufella
2015-03-05  8:14     ` Fabio Porcedda
2015-03-05 22:48   ` Arnout Vandecappelle
2015-03-14 16:15     ` Fabio Porcedda
2015-06-17 23:32       ` Arnout Vandecappelle
2015-06-28 15:51         ` Fabio Porcedda
2015-06-12 20:14 ` Thomas Petazzoni
2015-06-15  9:06   ` Fabio Porcedda
2015-06-15  9:17     ` Thomas Petazzoni
2015-06-17 23:09       ` Arnout Vandecappelle
2015-06-28 15:36         ` Fabio Porcedda
2015-06-28 18:13           ` Thomas Petazzoni
2015-06-28 15:33       ` Fabio Porcedda
2015-06-28 18:12         ` Thomas Petazzoni
2015-06-28 19:34           ` Fabio Porcedda

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=54F8F4BA.7020800@mind.be \
    --to=arnout@mind.be \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox