Minor updates to Makefile.package.in
Hi
I have send these patches some weeks ago but they was not accepted at that time. I have now cleaned up, and splitted some of the patches and therefor I will now try again.
I there are any comments I wiull be happy to correct them
--
Allan W. Nielsen
PATCH 1/3 Makefile.package.in: Makes it possible to override the default extract commands
When using GENTARGETS (or macroes depending on it), there is no way of specifying a custom extraction procedure. When using the patch one can simply define $(PACKAGE_NAME)_EXTRACT_CMDS which will override the default. If non is defined it will fall back to the default extract procedure.
An example could look like this:
--- PACKAGE BEGIN ---
FGLRX_VERSION=11-3 FGLRX_SOURCE:=ati-driver-installer-$(FGLRX_VERSION)-x86.x86_64.run FGLRX_SITE:=http://www2.ati.com/drivers/linux/
define FGLRX_EXTRACT_CMDS
sh $(DL_DIR)/$(FGLRX_SOURCE) --extract $(@D)
endef
$(eval $(call GENTARGETS,package,fglrx))
--- PACKAGE END ---
--- package/Makefile.package.in | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
package/Makefile.package.in +16 -2
@@ -239,9 +239,17 @@ ifeq ($(DL_MODE),DOWNLOAD) $(Q)touch $@ endif -# Unpack the archive +# Unpack the archive using custom commands +$(BUILD_DIR)/%/.stamp_custom_extracted: + @$(call MESSAGE,"Extracting - custom") + $(Q)mkdir -p $(@D) + $($(PKG)_EXTRACT_CMDS) + $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) + $(Q)touch $@ + +# Unpack the archive using default commands $(BUILD_DIR)/%/.stamp_extracted: - @$(call MESSAGE,"Extracting") + @$(call MESSAGE,"Extracting - default") $(Q)mkdir -p $(@D) $(Q)$(if $($(PKG)_SOURCE),$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \ $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -)
@@ -419,7 +427,13 @@ $(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed $(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built $(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured $(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched + +ifdef $(2)_EXTRACT_CMDS +$(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_custom_extracted +else $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted +endif + $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded $(2)_TARGET_UNINSTALL = $$($(2)_DIR)/.stamp_uninstalled $(2)_TARGET_CLEAN = $$($(2)_DIR)/.stamp_cleaned
Signature · 1 line
1.7.3.4
PATCH 1/3 Makefile.package.in: Makes it possible to override the default extract commands
2011/5/10 Allan W. Nielsen <[email protected]>:
Quoted 9 lines
(quoted diff) +9
-0+# Unpack the archive using custom commands +$(BUILD_DIR)/%/.stamp_custom_extracted: + ? ? ? @$(call MESSAGE,"Extracting - custom") + ? ? ? $(Q)mkdir -p $(@D) + ? ? ? $($(PKG)_EXTRACT_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Unpack the archive using default commands
Quoted 6 lines
?$(BUILD_DIR)/%/.stamp_extracted:
- ? ? ? @$(call MESSAGE,"Extracting")
+ ? ? ? @$(call MESSAGE,"Extracting - default")
? ? ? ?$(Q)mkdir -p $(@D)
? ? ? ?$(Q)$(if $($(PKG)_SOURCE),$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
? ? ? ?$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -)
What's the point of having a specific stamp target for custom extration? Why not just merge them both under .stamp_extracted?
PATCH 1/3 Makefile.package.in: Makes it possible to override the default extract commands
In reply to Allan W. NielsenHello Allan,
Quoted 5 lines · On Tue, 10 May 2011 08:17:04 +0200 "Allan W. Nielsen" <[email protected]> wrote:
When using GENTARGETS (or macroes depending on it), there is no way of specifying a custom extraction procedure. When using the patch one can simply define $(PACKAGE_NAME)_EXTRACT_CMDS which will override the default. If non is defined it will fall back to the default extract procedure.
I like the feature added by this patch (it is needed for strange packages), but I'm not sure about the implementation.
Quoted 6 lines
package/Makefile.package.in +5
-1-# Unpack the archive +# Unpack the archive using custom commands +$(BUILD_DIR)/%/.stamp_custom_extracted: + @$(call MESSAGE,"Extracting - custom") + $(Q)mkdir -p $(@D) + $($(PKG)_EXTRACT_CMDS)
package/Makefile.package.in ifeq ($(DL_MODE),DOWNLOAD) · line 255
Quoted 10 lines
package/Makefile.package.in +5
-1+ $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) + $(Q)touch $@ + +# Unpack the archive using default commands $(BUILD_DIR)/%/.stamp_extracted: - @$(call MESSAGE,"Extracting") + @$(call MESSAGE,"Extracting - default") $(Q)mkdir -p $(@D) $(Q)$(if $($(PKG)_SOURCE),$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \ $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -)
Instead of having two different stamp files, isn't possible to define the extract step as follows :
package/Makefile.package.in ifeq ($(DL_MODE),DOWNLOAD) · line 248
Quoted 6 lines
+$(BUILD_DIR)/%/.stamp_extracted:
package/Makefile.package.in +5
-0+ @$(call MESSAGE,"Extracting") + $(Q)mkdir -p $(@D) + $($(PKG)_EXTRACT_CMDS) + $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) + $(Q)touch $@
And then have the $(PKG)_EXTRACT_CMDS variable be define to the default value, unless it has already been defined ?
Note that I haven't looked closely whether it was possible or not. But if it is, then I would prefer such an implementation.
Thanks for doing this work!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 Makefile.package.in: Makes it possible to override the default extract commands
Quoted 4 lines · On Tue, 10 May 2011 10:59:26 +0200 Allan Nielsen <[email protected]> wrote:
I have just tried it, and it seems to work fine.
I agree with you that this is a much better solution, and I will post a patch based on the right away
Great, thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 2/3 Makefile.package.in: Added LZMA as compression type
In reply to Allan W. Nielsen--- Config.in | 7 +++++++ Makefile | 1 + package/Makefile.package.in | 1 + 3 files changed, 9 insertions(+), 0 deletions(-)
Config.in +7 -0
@@ -52,6 +52,13 @@ config BR2_BZCAT Default is "bzcat" Other possible values include "bunzip2 -c" or "bzip2 -d -c". +config BR2_XZCAT + string "xzcat command" + default "xzcat" + help + Command to be used to extract a xz'ed file to stdout. + Default is "xzcat" + config BR2_TAR_OPTIONS string "Tar options" default ""
Makefile +1 -0
@@ -271,6 +271,7 @@ KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \ ZCAT:=$(call qstrip,$(BR2_ZCAT)) BZCAT:=$(call qstrip,$(BR2_BZCAT)) +XZCAT:=$(call qstrip,$(BR2_XZCAT)) TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
package/Makefile.package.in +1 -0
@@ -61,6 +61,7 @@ INFLATE.gz = $(ZCAT) INFLATE.tbz = $(BZCAT) INFLATE.tbz2 = $(BZCAT) INFLATE.tgz = $(ZCAT) +INFLATE.xz = $(XZCAT) INFLATE.tar = cat # MESSAGE Macro -- display a message in bold type
Signature · 1 line
1.7.3.4
PATCH 2/3 Makefile.package.in: Added LZMA as compression type
Quoted 1 line · On Tue, 10 May 2011 08:17:05 +0200 "Allan W. Nielsen" <[email protected]> wrote:
Signed-off-by Allan W. Nielsen <[email protected]>
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 2/3 Makefile.package.in: Added LZMA as compression type
In reply to Allan W. NielsenQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Allan" == Allan W Nielsen <[email protected]> writes:
Allan> Signed-off-by: Allan W. Nielsen <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 3/3 Makefile.package.in: Fixing git download method
In reply to Allan W. Nielsen--- package/Makefile.package.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
package/Makefile.package.in +1 -1
@@ -109,7 +109,7 @@ define DOWNLOAD_GIT $(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ pushd $($(PKG)_BASE_NAME) > /dev/null && \ $(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \ - gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \ + gzip -c > ../$($(PKG)_SOURCE) && \ popd > /dev/null && \ rm -rf $($(PKG)_DL_DIR) && \ popd > /dev/null)
Signature · 1 line
1.7.3.4
PATCH 3/3 Makefile.package.in: Fixing git download method
Hello,
Quoted 10 lines · On Tue, 10 May 2011 08:17:06 +0200 "Allan W. Nielsen" <[email protected]> wrote:
Signed-off-by Allan W. Nielsen <[email protected]>--- package/Makefile.package.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)package/Makefile.package.in +0
-0
package/Makefile.package.in define DOWNLOAD_GIT · line 112
Quoted 5 lines
package/Makefile.package.in +1
-1@@ -109,7 +109,7 @@ define DOWNLOAD_GIT $(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ pushd $($(PKG)_BASE_NAME) > /dev/null && \ $(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \ - gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \ + gzip -c > ../$($(PKG)_SOURCE) && \
Could you provide a few details on how it "fixes" the Git download method ? Actually, the existing implementation seems to do the right
thing: it stores the tarball into the $(DL_DIR) directory, which is what we want. What problem did you encounter, and how does the ../ thing fixes it ?
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/3 Makefile.package.in: Fixing git download method
Quoted 7 lines · On Tue, 10 May 2011 09:22:22 +0200 Allan Nielsen <[email protected]> wrote:
When I run buildroot $(DL_DIR) is a relative path which says ./src and the current directory (at this point) is $(DL_DIR)/my-git-package/, and it will try to place the tar file in $(DL_DIR)/my-git-package/src/my-git-package.tar.gz which is the wrong place.
The suggested change should work both when $(DL_DIR) is relative and absolute.
Ah, yes, got it.
Quoted 2 lines
Alternative I could of cause just change my $(DL_DIR) variable to an absolute path.
Or, better, make sure that DL_DIR is an absolute path even if it was defined as a relative path in the configuration. Something like (untested):
DL_DIR=$(call qstrip,$(BR2_DL_DIR))
ifeq ($(DL_DIR),)
DL_DIR:=$(TOPDIR)/dl
endif
+ DL_DIR=$(shell readlink -f $(DL_DIR))
in package/Makefile.package.in
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com