From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [RFCv1 10/11] toolchain-external: convert to the package infrastructure
Date: Fri, 27 Sep 2013 16:21:26 +0200 [thread overview]
Message-ID: <52459466.60707@lucaceresoli.net> (raw)
In-Reply-To: <CAAXf6LUnjxUhx44Cg-NnwuzQq+L33KM9P-HjacDcEKwgT8-0ng@mail.gmail.com>
Thomas De Schampheleire wrote:
> Hi Thomas,
>
> On Thu, Sep 5, 2013 at 11:27 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> This commit converts the 'toolchain-external' logic to the package
>> infrastructure.
>>
>> The TOOLCHAIN_EXTERNAL_DIR variable (which points to where the
>> toolchain is located) is renamed to TOOLCHAIN_EXTERNAL_INSTALL_DIR,
>> because the former conflicts with the package infrastructure (which
>> defines the <pkg>_DIR variable for each package as pointing to its
>> build directory).
>>
>> The new _SOURCE_ADDONS mechanism is used for Blackfin toolchains.
>>
>> The extract, configuration and installation steps are converted inside
>> the <pkg>_EXTRACT_CMDS, <pkg>_CONFIGURE_CMDS and
>> <pkg>_INSTALL_STAGING_CMDS.
>>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> ---
> [..]
>
>> +TOOLCHAIN_EXTERNAL_INSTALL_STAGING = YES
>> +
>> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2),y)
>> # Special handling for Blackfin toolchain, because of the split in two
>> # tarballs, and the organization of tarball contents. The tarballs
>> # contain ./opt/uClinux/{bfin-uclinux,bfin-linux-uclibc} directories,
>> # which themselves contain the toolchain. This is why we strip more
>> # components than usual.
>> -ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2),y)
>> -$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1):
>> - $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1:/=)/$(TOOLCHAIN_EXTERNAL_SOURCE_1))
>> -
>> -$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2):
>> - $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2:/=)/$(TOOLCHAIN_EXTERNAL_SOURCE_2))
>> -
>> -$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
>> - mkdir -p $(@D)
>> - $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_1))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) | \
>> - $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
>> - $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_2))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) | \
>> - $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
>> - $(Q)touch $@
>> -else
>> -# Download and extraction of a toolchain
>> -$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE):
>> - $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE)$(TOOLCHAIN_EXTERNAL_SOURCE),$(TOOLCHAIN_EXTERNAL_SOURCE))
>> -
>> -$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
>> - mkdir -p $(@D)
>> - $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE))) $^ | \
>> - $(TAR) $(TAR_STRIP_COMPONENTS)=1 --exclude='usr/lib/locale/*' -C $(@D) $(TAR_OPTIONS) -
>> +define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
>> + mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
>> + $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
>> + $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
>> + $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_ADDONS))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_ADDONS) | \
>> + $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
>> +endef
>> +else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
>> +# Normal handling of toolchain tarball extraction.
>> +define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
>> + mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
>> + $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
>> + $(TAR) $(TAR_STRIP_COMPONENTS)=1 --exclude='usr/lib/locale/*' -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
>> $(TOOLCHAIN_EXTERNAL_FIXUP_CMDS)
>> - $(Q)touch $@
>> +endef
>> endif
> Given that the extract commands are now very similar between blackfin
> and non-blackfin, wouldn't it make more sense to define it once and
> tweak it based on a variable?
> Something like (quick and untested):
>
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2),y)
> TOOLCHAIN_EXTERNAL_TAR_OPTIONS = $(TAR_STRIP_COMPONENTS)=3 --hard-dereference
> else
> TOOLCHAIN_EXTERNAL_TAR_OPTIONS = $(TAR_STRIP_COMPONENTS)=1
> --exclude='usr/lib/locale/*'
> endif
>
> define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
> mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
> $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE)))
> $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
> $(TAR) $(TOOLCHAIN_EXTERNAL_TAR_OPTIONS) -C
> $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
> if [ -n "$(TOOLCHAIN_EXTERNAL_SOURCE_ADDONS)" ]; then \
> $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_ADDONS)))
> $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_ADDONS) | \
> $(TAR) $(TOOLCHAIN_EXTERNAL_TAR_OPTIONS) -C
> $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) - \
> fi
> endef
>
>
> One can even wonder why the 'exclude=' couldn't be used for blackfin,
> and why the --hard-dereference couldn't be used for non-blackfin. This
> would make the only difference the strip-components.
I agree this and other cleanups would make this file cleaner.
However Thomas is proposing a rather substantial change to a quite core
piece of Buildroot. So I would keep things as they are at a first step.
This allows to make the change to the package system withthe minimum
diffs, thus making it easier to spot any problems that might ariseif
the patches are committed to master.
When the whole thing will be tested for at least a few days by the
autobuilders, I think it would be ok to start cleanup and refactoring.
Just my two cents.
--
Luca
next prev parent reply other threads:[~2013-09-27 14:21 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-05 21:27 [Buildroot] [RFCv1 00/11] Convert toolchain backends to packages to fix source/external-deps/legal-info Thomas Petazzoni
2013-09-05 21:27 ` [Buildroot] [RFCv1 01/11] Makefile: make $(BUILD_DIR)/.root rule idempotent Thomas Petazzoni
2013-09-08 12:06 ` Thomas De Schampheleire
2013-09-08 13:13 ` Danomi Manchego
2013-09-08 13:30 ` Thomas Petazzoni
2013-09-08 16:59 ` Danomi Manchego
2013-09-08 17:31 ` Thomas Petazzoni
2013-09-09 8:54 ` Luca Ceresoli
2013-09-09 21:38 ` Peter Korsgaard
2013-09-10 7:23 ` Thomas Petazzoni
2013-09-05 21:27 ` [Buildroot] [RFCv1 02/11] toolchain-crosstool-ng: remove support Thomas Petazzoni
2013-09-06 9:35 ` Yann E. MORIN
2013-09-06 15:53 ` Yann E. MORIN
2013-09-06 15:56 ` Thomas Petazzoni
2013-09-08 12:52 ` Thomas De Schampheleire
2013-09-13 16:10 ` Luca Ceresoli
2013-09-05 21:27 ` [Buildroot] [RFCv1 03/11] toolchain-external: make ext-tool.mk includable in all cases Thomas Petazzoni
2013-09-08 15:31 ` Thomas De Schampheleire
2013-09-05 21:27 ` [Buildroot] [RFCv1 04/11] toolchain: move helpers.mk into toolchain-external/ Thomas Petazzoni
2013-09-08 17:50 ` Thomas De Schampheleire
2013-09-13 16:07 ` Luca Ceresoli
2013-09-05 21:27 ` [Buildroot] [RFCv1 05/11] toolchain: introduce a virtual package Thomas Petazzoni
2013-09-13 16:24 ` Luca Ceresoli
2013-09-15 14:27 ` Thomas De Schampheleire
2013-09-05 21:27 ` [Buildroot] [RFCv1 06/11] toolchain-buildroot: convert to the package infrastructure Thomas Petazzoni
2013-09-15 14:30 ` Thomas De Schampheleire
2013-09-05 21:27 ` [Buildroot] [RFCv1 07/11] toolchain: intermediate .mk files no longer needed Thomas Petazzoni
2013-09-15 14:33 ` Thomas De Schampheleire
2013-09-05 21:27 ` [Buildroot] [RFCv1 08/11] package: package-based implementation of source, external-deps and legal-info Thomas Petazzoni
2013-09-15 19:29 ` Thomas De Schampheleire
2013-09-15 20:09 ` Thomas Petazzoni
2013-09-16 1:21 ` Thomas De Schampheleire
2013-09-05 21:27 ` [Buildroot] [RFCv1 09/11] package: add a <pkg>_SOURCE_ADDONS variable Thomas Petazzoni
2013-09-16 13:39 ` Thomas De Schampheleire
2013-09-16 18:31 ` Thomas Petazzoni
2013-09-16 19:20 ` Arnout Vandecappelle
2013-09-17 7:21 ` Thomas De Schampheleire
2013-09-27 14:27 ` Luca Ceresoli
2013-09-05 21:27 ` [Buildroot] [RFCv1 10/11] toolchain-external: convert to the package infrastructure Thomas Petazzoni
2013-09-16 13:29 ` Thomas De Schampheleire
2013-09-27 14:21 ` Luca Ceresoli [this message]
2013-09-27 14:24 ` Luca Ceresoli
2013-09-05 21:27 ` [Buildroot] [RFCv1 11/11] dependencies: remove useless targets Thomas Petazzoni
2013-09-06 8:28 ` [Buildroot] [RFCv1 00/11] Convert toolchain backends to packages to fix source/external-deps/legal-info Fabio Porcedda
2013-09-06 8:38 ` Thomas Petazzoni
2013-09-06 8:50 ` Fabio Porcedda
2013-09-06 12:37 ` Ryan Barnett
2013-09-06 8:57 ` Jérôme Pouiller
2013-09-06 9:05 ` Thomas Petazzoni
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=52459466.60707@lucaceresoli.net \
--to=luca@lucaceresoli.net \
--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