Request for comment for branch for-2012.05/misc-cleanups
Hello,
Here is a set of proposal that cleanup/re-organize a few parts of our main Makefiles. This is just the beginning of a cleanup of Makefile, package/Makefile.in and some other core parts of the infrastructure. Before going further, I'd like to see if the direction I'm taking is something that is considered to be useful and interesting.
This set of patches is at the Request For Comment state, they are not yet intended to be committed, I need to do some further testing. The purpose is really to get some early feedback about them.
Thanks,
Thomas
The following changes since commit b50f7a832de2801aeee33146ff5a81945f4078c2:
barebox: fix 2012.03 typo (2012-03-07 16:26:50 +0100)
are available in the git repository at:
git://git.free-electrons.com/users/thomas-petazzoni/buildroot.git for-2012.05/misc-cleanups
Thomas Petazzoni (13):
Remove the DATE variable
Remove cc-option: not used anywhere
Remove filename extension crap for OS compatibility
kconfig: do not use HOST_LOADLIBES anymore
Rename Makefile.autotools.in to pkg-autotargets.mk
Rename Makefile.cmake.in to pkg-cmaketargets.mk
Split Makefile.package.in in pkg-download.mk, pkg-utils.mk and pkg-gentargets.mk pkg-*.mk: add some comments, update some existing comments
Remove unused .fakeroot.* mechanism
Move the manual build infrastructure to docs/manual/manual.mk
cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
package: remove unused STRIP_DISCARD_ALL variable
package: move autotools specific stuff to pkg-autotargets.mk
Makefile | 108 +---
boot/uboot/uboot.mk | 1 -
docs/manual/manual.mk | 48 ++
fs/common.mk | 2 -
fs/iso9660/iso9660.mk | 2 -
package/Makefile.in | 83 +--
package/Makefile.package.in | 746 --------------------
.../{Makefile.autotools.in => pkg-autotargets.mk} | 74 ++-
package/{Makefile.cmake.in => pkg-cmaketargets.mk} | 22 +
package/pkg-download.mk | 221 ++++++
package/pkg-gentargets.mk | 456 ++++++++++++
package/pkg-utils.mk | 85 +++
support/kconfig/Makefile.br | 4 +-
support/kconfig/patches/10-br-build-system.patch | 12 +-
14 files changed, 917 insertions(+), 947 deletions(-)
create mode 100644 docs/manual/manual.mk
delete mode 100644 package/Makefile.package.in
rename package/{Makefile.autotools.in => pkg-autotargets.mk} (85%)
rename package/{Makefile.cmake.in => pkg-cmaketargets.mk} (86%)
create mode 100644 package/pkg-download.mk
create mode 100644 package/pkg-gentargets.mk
create mode 100644 package/pkg-utils.mkThanks,
Signature · 1 line
Thomas Petazzoni
PATCH 1/13 Remove the DATE variable
This variable was only used by uboot.mk to add a #define DATE into the U-Boot .h configuration file. But such a definition does not seem to be used by the mainline U-Boot, so there's no reason to keep it.
--- Makefile | 1 - boot/uboot/uboot.mk | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
Makefile +0 -1
@@ -39,7 +39,6 @@ endif TOPDIR:=$(shell pwd) CONFIG_CONFIG_IN=Config.in CONFIG=support/kconfig -DATE:=$(shell date +%Y%m%d) # Compute the full local version string so packages can use it as-is # Need to export it, so it can be got from environment in children (eg. mconf)
boot/uboot/uboot.mk +0 -1
@@ -69,7 +69,6 @@ define UBOOT_CONFIGURE_CMDS @echo "/* Add a wrapper around the values Buildroot sets. */" >> $(@D)/include/config.h @echo "#ifndef __BR2_ADDED_CONFIG_H" >> $(@D)/include/config.h @echo "#define __BR2_ADDED_CONFIG_H" >> $(@D)/include/config.h - $(call insert_define,DATE,$(DATE)) $(call insert_define,CONFIG_LOAD_SCRIPTS,1) $(call insert_define,CONFIG_IPADDR,$(BR2_TARGET_UBOOT_IPADDR)) $(call insert_define,CONFIG_GATEWAYIP,$(BR2_TARGET_UBOOT_GATEWAY))
Signature · 1 line
1.7.4.1
PATCH 2/13 Remove cc-option: not used anywhere
In reply to Thomas Petazzoni--- Makefile | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
Makefile +0 -7
@@ -177,13 +177,6 @@ BUILD_DIR:=$(BASE_DIR)/build ifeq ($(BR2_HAVE_DOT_CONFIG),y) -# cc-option -# Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586) -# sets -march=winchip-c6 if supported else falls back to -march=i586 -# without checking the latter. -cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) - ############################################################# # # Hide troublesome environment variables from sub processes
Signature · 1 line
1.7.4.1
PATCH 3/13 Remove filename extension crap for OS compatibility
In reply to Thomas PetazzoniThe only variable that is used is HOST_LOADLIBES, defined for the cygwin case in the kconfig build. Since we don't support cygwin, simply get rid of this.
--- Makefile | 28 ---------------------------- 1 files changed, 0 insertions(+), 28 deletions(-)
Makefile +0 -28
@@ -194,34 +194,6 @@ unexport CONFIG_SITE GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess) -############################################################# -# -# Setup the proper filename extensions for the host -# -############################################################## -ifneq ($(findstring linux,$(GNU_HOST_NAME)),) -HOST_EXEEXT:= -HOST_LIBEXT:=.a -HOST_SHREXT:=.so -endif -ifneq ($(findstring apple,$(GNU_HOST_NAME)),) -HOST_EXEEXT:= -HOST_LIBEXT:=.a -HOST_SHREXT:=.dylib -endif -ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),) -HOST_EXEEXT:=.exe -HOST_LIBEXT:=.lib -HOST_SHREXT:=.dll -HOST_LOADLIBES=-lcurses -lintl -export HOST_LOADLIBES -endif -ifneq ($(findstring mingw,$(GNU_HOST_NAME)),) -HOST_EXEEXT:=.exe -HOST_LIBEXT:=.lib -HOST_SHREXT:=.dll -endif - ############################################################## # # The list of stuff to build for the target toolchain
Signature · 1 line
1.7.4.1
PATCH 4/13 kconfig: do not use HOST_LOADLIBES anymore
In reply to Thomas Petazzoni--- support/kconfig/Makefile.br | 4 ++-- support/kconfig/patches/10-br-build-system.patch | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
support/kconfig/Makefile.br +2 -2
@@ -22,10 +22,10 @@ host-cxxobjs := $(addprefix $(obj)/,$(sort $(foreach m,$(__hostprogs),$($(m)-cxx HOST_EXTRACFLAGS += -I$(obj) $(host-csingle): %: %.c - $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $(obj)/$@ + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) - $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ $(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib) $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@
support/kconfig/patches/10-br-build-system.patch +6 -6
@@ -3,10 +3,10 @@ foo.h | 12 ++++++++++++ 2 files changed, 65 insertions(+) -Index: config/Makefile.br +Index: kconfig/Makefile.br =================================================================== --- /dev/null -+++ config/Makefile.br ++++ kconfig/Makefile.br @@ -0,0 +1,53 @@ +src := . +top_srcdir=../../
@@ -32,10 +32,10 @@ Index: config/Makefile.br +HOST_EXTRACFLAGS += -I$(obj) + +$(host-csingle): %: %.c -+ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $(obj)/$@ ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@ + +$(host-cmulti): %: $(host-cobjs) $(host-cshlib) -+ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ + +$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib) + $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@
@@ -61,10 +61,10 @@ Index: config/Makefile.br + +FORCE: +.PHONY: FORCE clean distclean -Index: config/foo.h +Index: kconfig/foo.h =================================================================== --- /dev/null -+++ config/foo.h ++++ kconfig/foo.h @@ -0,0 +1,12 @@ +#ifndef __KCONFIG_FOO_H +#define __KCONFIG_FOO_H
Signature · 1 line
1.7.4.1
PATCH 5/13 Rename Makefile.autotools.in to pkg-autotargets.mk
In reply to Thomas Petazzoni---
package/Makefile.in | 2 +-
.../{Makefile.autotools.in => pkg-autotargets.mk} | 0
2 files changed, 1 insertions(+), 1 deletions(-)
rename package/{Makefile.autotools.in => pkg-autotargets.mk} (100%)package/Makefile.in +1 -1
@@ -298,6 +298,6 @@ else SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared endif -include package/Makefile.autotools.in +include package/pkg-autotargets.mk include package/Makefile.cmake.in include package/Makefile.package.in
package/pkg-autotargets.mk renamed from package/Makefile.autotools.in +0 -0
Signature · 1 line
1.7.4.1
PATCH 6/13 Rename Makefile.cmake.in to pkg-cmaketargets.mk
In reply to Thomas Petazzoni---
package/Makefile.in | 2 +-
package/{Makefile.cmake.in => pkg-cmaketargets.mk} | 0
2 files changed, 1 insertions(+), 1 deletions(-)
rename package/{Makefile.cmake.in => pkg-cmaketargets.mk} (100%)package/Makefile.in +1 -1
@@ -299,5 +299,5 @@ SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared endif include package/pkg-autotargets.mk -include package/Makefile.cmake.in +include package/pkg-cmaketargets.mk include package/Makefile.package.in
package/pkg-cmaketargets.mk renamed from package/Makefile.cmake.in +0 -0
Signature · 1 line
1.7.4.1
PATCH 7/13 Split Makefile.package.in in pkg-download.mk, pkg-utils.mk and pkg-gentargets.mk
In reply to Thomas Petazzoni--- package/Makefile.in | 4 +- package/Makefile.package.in | 746 ------------------------------------------- package/pkg-download.mk | 212 ++++++++++++ package/pkg-gentargets.mk | 458 ++++++++++++++++++++++++++ package/pkg-utils.mk | 72 +++++ 5 files changed, 745 insertions(+), 747 deletions(-) delete mode 100644 package/Makefile.package.in create mode 100644 package/pkg-download.mk create mode 100644 package/pkg-gentargets.mk create mode 100644 package/pkg-utils.mk
package/Makefile.in +3 -1
@@ -298,6 +298,8 @@ else SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared endif +include package/pkg-utils.mk +include package/pkg-download.mk include package/pkg-autotargets.mk include package/pkg-cmaketargets.mk -include package/Makefile.package.in +include package/pkg-gentargets.mk
package/Makefile.package.in deleted +0 -746
746 lines not on this page · raw message
package/pkg-download.mk new file +212 -0
212 lines not on this page · raw message
package/pkg-gentargets.mk new file +458 -0
458 lines not on this page · raw message
package/pkg-utils.mk new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 8/13 pkg-*.mk: add some comments, update some existing comments
In reply to Thomas Petazzoni--- package/pkg-autotargets.mk | 4 +--- package/pkg-download.mk | 9 +++++++++ package/pkg-gentargets.mk | 10 ++++------ package/pkg-utils.mk | 13 +++++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-)
package/pkg-autotargets.mk +1 -3
@@ -3,9 +3,7 @@ # # This file implements an infrastructure that eases development of # package .mk files for autotools packages. It should be used for all -# packages that use the autotools as their build system. Non-autotools -# packages should use the generic infrastructure in -# package/Makefile.package.in. +# packages that use the autotools as their build system. # # See the Buildroot documentation for details on the usage of this # infrastructure
package/pkg-download.mk +9 -0
@@ -1,3 +1,12 @@ +############################################################################ +# +# This file contains the download helpers for the various package +# infrastructures. It is used to handle downloads from HTTP servers, +# FTP servers, Git repositories, Subversion repositories, Mercurial +# repositories, Bazaar repositories, and SCP servers. +# +############################################################################ + # Download method commands WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET) SVN:=$(call qstrip,$(BR2_SVN))
package/pkg-gentargets.mk +4 -6
@@ -2,9 +2,10 @@ # Generic package infrastructure # # This file implements an infrastructure that eases development of -# package .mk files. It should be used for all non-autotools based -# packages. Autotools-based packages should use the specialized -# autotools infrastructure in package/Makefile.autotools.in. +# package .mk files. It should be used for packages that do not rely +# on a well-known build system for which Buildroot has a dedicated +# infrastructure (so far, Buildroot has special support for +# autotools-based and CMake-based packages). # # See the Buildroot documentation for details on the usage of this # infrastructure
@@ -17,9 +18,6 @@ # # 2. Description of the commands to be executed to configure, build # and install the package -# -# The autotools infrastructure specializes this generic infrastructure -# by already implementing the configure, build and install steps. ################################################################################ ################################################################################
package/pkg-utils.mk +13 -0
@@ -1,3 +1,10 @@ +############################################################################ +# +# This file contains various utility functions used by the package +# infrastructure, or by the packages themselves. +# +############################################################################ + # UPPERCASE Macro -- transform its argument to uppercase and replace dots and # hyphens to underscores
@@ -16,6 +23,12 @@ UPPERCASE = $(strip $(eval __tmp := $1) \ $(__tmp)))) \ $(__tmp)) +# +# Manipulation of .config files based on the Kconfig +# infrastructure. Used by the Busybox package, the Linux kernel +# package, and more. +# + define KCONFIG_ENABLE_OPT $(SED) "/\\<$(1)\\>/d" $(2) echo "$(1)=y" >> $(2)
Signature · 1 line
1.7.4.1
PATCH 9/13 Remove unused .fakeroot.* mechanism
In reply to Thomas PetazzoniThere used to be a mechanism using which packages could leave a .fakeroot.<something> file which could contain commands to be executed within the fakeroot environment. Since this mechanism is no longer used by any package, remove it from the common infrastructure.
The latest user was nfs-utils, which used this mechanism to do the "make install" as root, since doing otherwise was not supported. But since 16e7b8255c82815126a2c502c3787d442d254a86, nfs-utils has been upgraded and converted to the package infrastructure, and this hack is no longer necessary. Another past user was the ltp-testsuite package, for the same reason, and since a72a670489547a3ca645ff7c3a0d9c3fb66eab51, the fakeroot hack is no longer needed.
--- Makefile | 6 ------ fs/common.mk | 2 -- fs/iso9660/iso9660.mk | 2 -- 3 files changed, 0 insertions(+), 10 deletions(-)
Makefile +0 -6
@@ -301,8 +301,6 @@ endif include fs/common.mk -TARGETS+=erase-fakeroots - TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS)) TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
@@ -391,7 +389,6 @@ $(BUILD_DIR)/.root: if [ -d "$(TARGET_SKELETON)" ]; then \ cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ fi; \ - touch $(STAGING_DIR)/.fakeroot.00000; \ fi -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
@@ -399,9 +396,6 @@ $(BUILD_DIR)/.root: $(TARGET_DIR): $(BUILD_DIR)/.root -erase-fakeroots: - rm -f $(BUILD_DIR)/.fakeroot* - target-finalize: ifeq ($(BR2_HAVE_DEVFILES),y) ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
fs/common.mk +0 -2
@@ -45,8 +45,6 @@ $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES) @$(call MESSAGE,"Generating root filesystem image rootfs.$(1)") $(foreach hook,$(ROOTFS_$(2)_PRE_GEN_HOOKS),$(call $(hook))$(sep)) rm -f $(FAKEROOT_SCRIPT) - touch $(BUILD_DIR)/.fakeroot.00000 - cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT) echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) ifneq ($(ROOTFS_DEVICE_TABLES),) cat $(ROOTFS_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)
fs/iso9660/iso9660.mk +0 -2
@@ -25,8 +25,6 @@ $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux rootfs-ext2 grub cp $(BINARIES_DIR)/rootfs.ext2 $(ISO9660_TARGET_DIR)/initrd # Use fakeroot to pretend all target binaries are owned by root rm -f $(FAKEROOT_SCRIPT) - touch $(BUILD_DIR)/.fakeroot.00000 - cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT) echo "chown -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT) # Use fakeroot so mkisofs believes the previous fakery echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
Signature · 1 line
1.7.4.1
PATCH 10/13 Move the manual build infrastructure to docs/manual/manual.mk
In reply to Thomas Petazzoni--- Makefile | 49 +------------------------------------------------ docs/manual/manual.mk | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 docs/manual/manual.mk
Makefile +1 -48
@@ -679,54 +679,7 @@ release: bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2 rm -rf $(OUT) $(OUT).tar -################################################################################ -# GENDOC -- generates the make targets needed to build a specific type of -# asciidoc documentation. -# -# argument 1 is the name of the document and must be a subdirectory of docs/; -# the top-level asciidoc file must have the same name -# argument 2 is the type of document to generate (-f argument of a2x) -# argument 3 is the document type as used in the make target -# argument 4 is the output file extension for the document type -# argument 5 is the human text for the document type -# argument 6 (optional) are extra arguments for a2x -# -# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. -################################################################################ -define GENDOC_INNER -$(1): $(1)-$(3) -.PHONY: $(1)-$(3) -$(1)-$(3): $$(O)/docs/$(1)/$(1).$(4) - -$$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt $$($(call UPPERCASE,$(1))_SOURCES) - @echo "Generating $(5) $(1)..." - $(Q)mkdir -p $$(@D) - $(Q)a2x $(6) -f $(2) -d book -L -r $(TOPDIR)/docs/images \ - -D $$(@D) $$< -endef - -################################################################################ -# GENDOC -- generates the make targets needed to build asciidoc documentation. -# -# argument 1 is the name of the document and must be a subdirectory of docs/; -# the top-level asciidoc file must have the same name -# -# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. -################################################################################ -define GENDOC -$(call GENDOC_INNER,$(1),xhtml,html,html,HTML) -$(call GENDOC_INNER,$(1),chunked,split-html,chunked,Split HTML) -$(call GENDOC_INNER,$(1),pdf,pdf,pdf,PDF,--dblatex-opts "-P latex.output.revhistory=0") -$(call GENDOC_INNER,$(1),text,txt,text,Text) -$(call GENDOC_INNER,$(1),epub,epub,epub,EPUB) -clean: clean-$(1) -clean-$(1): - $(Q)$(RM) -rf $(O)/docs/$(1) -.PHONY: $(1) clean-$(1) -endef - -MANUAL_SOURCES = $(wildcard docs/manual/*.txt) $(wildcard docs/images/*) -$(eval $(call GENDOC,manual)) +include docs/manual/manual.mk .PHONY: $(noconfig_targets)
docs/manual/manual.mk new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 11/13 cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
In reply to Thomas Petazzoni--- Makefile | 17 ----------------- package/pkg-cmaketargets.mk | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-)
Makefile +0 -17
@@ -339,23 +339,6 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL) -$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake: - mkdir -p $(@D) - @echo -en "\ - set(CMAKE_SYSTEM_NAME Linux)\n\ - set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\ - set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\ - set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\ - set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\ - set(CMAKE_INSTALL_SO_NO_EXE 0)\n\ - set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\ - set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\ - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\ - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\ - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\ - set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\ - " > $@ - .PHONY: all world dirs clean distclean source outputmakefile \ $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
package/pkg-cmaketargets.mk +22 -0
@@ -197,3 +197,25 @@ else $(call CMAKETARGETS_INNER,$(call pkgname),$(call UPPERCASE,$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),target) endif endef + +################################################################################ +# Generation of the CMake toolchain file +################################################################################ + +$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake: + @mkdir -p $(@D) + @echo -en "\ + set(CMAKE_SYSTEM_NAME Linux)\n\ + set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\ + set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\ + set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\ + set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\ + set(CMAKE_INSTALL_SO_NO_EXE 0)\n\ + set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\ + set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\ + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\ + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\ + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\ + set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\ + " > $@ +
Signature · 1 line
1.7.4.1
PATCH 12/13 package: remove unused STRIP_DISCARD_ALL variable
In reply to Thomas Petazzoni--- package/Makefile.in | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
package/Makefile.in +0 -2
@@ -126,7 +126,6 @@ TARGET_CXX := $(CCACHE) $(TARGET_CXX) endif ifeq ($(BR2_STRIP_strip),y) -STRIP_DISCARD_ALL:=--discard-all STRIP_STRIP_UNNEEDED:=--strip-unneeded STRIP_STRIP_ALL:=--strip-all TARGET_STRIP=$(TARGET_CROSS)strip
@@ -134,7 +133,6 @@ STRIPCMD=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note KSTRIPCMD=$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) endif ifeq ($(BR2_STRIP_sstrip),y) -STRIP_DISCARD_ALL:= STRIP_STRIP_UNNEEDED:= STRIP_STRIP_ALL:= TARGET_STRIP=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
Signature · 1 line
1.7.4.1
PATCH 13/13 package: move autotools specific stuff to pkg-autotargets.mk
In reply to Thomas Petazzoni--- package/Makefile.in | 73 -------------------------------------------- package/pkg-autotargets.mk | 70 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 73 deletions(-)
package/Makefile.in +0 -73
@@ -223,79 +223,6 @@ HOST_MAKE_ENV=PATH=$(HOST_PATH) \ PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \ PERLLIB="$(HOST_DIR)/usr/lib/perl" - -####################################################################### -# settings we need to pass to configure - -# does unaligned access trap? -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=yes -ifeq ($(BR2_i386),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_x86_64),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_m68k),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_powerpc)$(BR2_ENDIAN),yBIG) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif - -ifeq ($(BR2_ENDIAN),"BIG") -BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=yes -else -BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=no -endif - -TARGET_CONFIGURE_ARGS= \ - $(BR2_AC_CV_TRAP_CHECK) \ - ac_cv_func_mmap_fixed_mapped=yes \ - ac_cv_func_memcmp_working=yes \ - ac_cv_have_decl_malloc=yes \ - gl_cv_func_malloc_0_nonnull=yes \ - ac_cv_func_malloc_0_nonnull=yes \ - ac_cv_func_calloc_0_nonnull=yes \ - ac_cv_func_realloc_0_nonnull=yes \ - lt_cv_sys_lib_search_path_spec="" \ - $(BR2_AC_CV_C_BIGENDIAN) - -####################################################################### - -ifeq ($(BR2_ENABLE_LOCALE),y) -DISABLE_NLS:= -else -DISABLE_NLS:=--disable-nls -endif - -ifneq ($(BR2_LARGEFILE),y) -DISABLE_LARGEFILE= --disable-largefile -endif - -ifneq ($(BR2_HAVE_DOCUMENTATION),y) -DISABLE_DOCUMENTATION=--disable-gtk-doc -endif - -ifneq ($(BR2_INET_IPV6),y) -DISABLE_IPV6= --disable-ipv6 -endif - -ifneq ($(BR2_INSTALL_LIBSTDCPP),y) -TARGET_CONFIGURE_OPTS+=CXX=false -endif - -ifeq ($(BR2_ENABLE_DEBUG),y) -ENABLE_DEBUG:=--enable-debug -else -ENABLE_DEBUG:= -endif - -ifeq ($(BR2_PREFER_STATIC_LIB),y) -SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared -else -SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared -endif - include package/pkg-utils.mk include package/pkg-download.mk include package/pkg-autotargets.mk
package/pkg-autotargets.mk +70 -0
76 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 1/13 Remove the DATE variable
In reply to Thomas PetazzoniQuoted 5 lines · Thomas Petazzoni
This variable was only used by uboot.mk to add a #define DATE into the U-Boot .h configuration file. But such a definition does not seem to be used by the mainline U-Boot, so there's no reason to keep it.
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 36 lines
---
?Makefile ? ? ? ? ? ?| ? ?1 -
?boot/uboot/uboot.mk | ? ?1 -
?2 files changed, 0 insertions(+), 2 deletions(-)Makefile +0
-0@@ -39,7 +39,6 @@ endif ?TOPDIR:=$(shell pwd)?CONFIG_CONFIG_IN=Config.in
?CONFIG=support/kconfig
-DATE:=$(shell date +%Y%m%d)?# Compute the full local version string so packages can use it as-is ?# Need to export it, so it can be got from environment in children (eg. mconf)
boot/uboot/uboot.mk +0
-0@@ -69,7 +69,6 @@ define UBOOT_CONFIGURE_CMDS? ? ? ?@echo "/* Add a wrapper around the values Buildroot sets. */" >> $(@D)/include/config.h ? ? ? ?@echo "#ifndef
__BR2_ADDED_CONFIG_H" >> $(@D)/include/config.h
? ? ? ?@echo "#define__BR2_ADDED_CONFIG_H" >> $(@D)/include/config.h
- ? ? ? $(call insert_define,DATE,$(DATE))
? ? ? ?$(call insert_define,CONFIG_LOAD_SCRIPTS,1)
? ? ? ?$(call insert_define,CONFIG_IPADDR,$(BR2_TARGET_UBOOT_IPADDR))
? ? ? ?$(call insert_define,CONFIG_GATEWAYIP,$(BR2_TARGET_UBOOT_GATEWAY))
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 2/13 Remove cc-option: not used anywhere
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 29 lines
---
?Makefile | ? ?7 -------
?1 files changed, 0 insertions(+), 7 deletions(-)Makefile +0
-7@@ -177,13 +177,6 @@ BUILD_DIR:=$(BASE_DIR)/build ?ifeq ($(BR2_HAVE_DOT_CONFIG),y) -# cc-option -# Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586) -# sets -march=winchip-c6 if supported else falls back to -march=i586 -# without checking the latter. -cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - ? ? ? > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -?############################################################# ?#
?# Hide troublesome environment variables from sub processes --
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 3/13 Remove filename extension crap for OS compatibility
In reply to Thomas PetazzoniHi,
Quoted 5 lines · Thomas Petazzoni
The only variable that is used is
HOST_LOADLIBES, defined for the cygwin case in the kconfig build. Since we don't support cygwin, simply get rid of this.Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 50 lines
---
?Makefile | ? 28 ---------------------------- ?1 files changed, 0 insertions(+), 28 deletions(-)Makefile +0
-28@@ -194,34 +194,6 @@ unexport CONFIG_SITE ?GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess) -############################################################# -# -# Setup the proper filename extensions for the host -# -############################################################## -ifneq ($(findstring linux,$(GNU_HOST_NAME)),) -HOST_EXEEXT:= -HOST_LIBEXT:=.a -HOST_SHREXT:=.so -endif -ifneq ($(findstring apple,$(GNU_HOST_NAME)),) -HOST_EXEEXT:= -HOST_LIBEXT:=.a -HOST_SHREXT:=.dylib -endif -ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),) -HOST_EXEEXT:=.exe -HOST_LIBEXT:=.lib -HOST_SHREXT:=.dll -HOST_LOADLIBES=-lcurses -lintl -export HOST_LOADLIBES -endif -ifneq ($(findstring mingw,$(GNU_HOST_NAME)),) -HOST_EXEEXT:=.exe -HOST_LIBEXT:=.lib -HOST_SHREXT:=.dll -endif -?############################################################## ?#
?# The list of stuff to build for the target toolchain --
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 4/13 kconfig: do not use HOST_LOADLIBES anymore
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 72 lines
---
?support/kconfig/Makefile.br ? ? ? ? ? ? ? ? ? ? ?| ? ?4 ++-- ?support/kconfig/patches/10-br-build-system.patch | ? 12 ++++++------ ?2 files changed, 8 insertions(+), 8 deletions(-)support/kconfig/Makefile.br +0
-0@@ -22,10 +22,10 @@ host-cxxobjs := $(addprefix $(obj)/,$(sort $(foreach m,$(__hostprogs),$($(m)-cxx ?HOST_EXTRACFLAGS += -I$(obj)?$(host-csingle): %: %.c
- ? ? ? $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $(obj)/$@
+ ? ? ? $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@?$(host-cmulti): %: $(host-cobjs) $(host-cshlib)
- ? ? ? $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@
+ ? ? ? $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@?$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib)
? ? ? ?$(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@support/kconfig/patches/10-br-build-system.patch +0
-0@@ -3,10 +3,10 @@?foo.h ? ? ? | ? 12 ++++++++++++
?2 files changed, 65 insertions(+)support/kconfig/patches/10-br-build-system.patch +1
-1-Index: config/Makefile.br +Index: kconfig/Makefile.br?=================================================================== ?---
/dev/null
-+++ config/Makefile.br
++++ kconfig/Makefile.br
?@@ -0,0 +1,53 @@
?+src := .
?+top_srcdir=../../support/kconfig/patches/10-br-build-system.patch +0
-0@@ -32,10 +32,10 @@ Index: config/Makefile.br ?+HOST_EXTRACFLAGS += -I$(obj)?+
?+$(host-csingle): %: %.c
-+ ? ? ?$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< $(HOST_LOADLIBES) -o $(obj)/$@
++ ? ? ?$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@
?+
?+$(host-cmulti): %: $(host-cobjs) $(host-cshlib)
-+ ? ? ?$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ ? ? ?$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ?+
?+$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib)
?+ ? ? ?$(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@support/kconfig/patches/10-br-build-system.patch +0
-0@@ -61,10 +61,10 @@ Index: config/Makefile.br?+
?+FORCE:
?+.PHONY: FORCE clean distcleansupport/kconfig/patches/10-br-build-system.patch +1
-1-Index: config/foo.h +Index: kconfig/foo.h?=================================================================== ?---
/dev/null
-+++config/foo.h
++++kconfig/foo.h
?@@ -0,0 +1,12 @@
?+#ifndef__KCONFIG_FOO_H
?+#define__KCONFIG_FOO_H
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 5/13 Rename Makefile.autotools.in to pkg-autotargets.mk
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
package/pkg-autotargets.mk
Quoted 22 lines
---
?package/Makefile.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?.../{Makefile.autotools.in => pkg-autotargets.mk} ?| ? ?0 ?2 files changed, 1 insertions(+), 1 deletions(-)
?rename package/{Makefile.autotools.in => pkg-autotargets.mk} (100%)package/Makefile.in +0
-0@@ -298,6 +298,6 @@ else?SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared ?endif
package/Makefile.in +1
-1-include package/Makefile.autotools.in +include package/pkg-autotargets.mk?include package/Makefile.cmake.in
?include package/Makefile.package.inpackage/pkg-autotargets.mk renamed from package/Makefile.autotools.in +0
-0
In addition you should fix the comment
Quoted 7 lines
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 6/13 Rename Makefile.cmake.in to pkg-cmaketargets.mk
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 28 lines
---
?package/Makefile.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?package/{Makefile.cmake.in => pkg-cmaketargets.mk} | ? ?0 ?2 files changed, 1 insertions(+), 1 deletions(-) ?rename package/{Makefile.cmake.in => pkg-cmaketargets.mk} (100%)package/Makefile.in +0
-0@@ -299,5 +299,5 @@ SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared?endif
?include
package/pkg-autotargets.mkpackage/Makefile.in +1
-1-include package/Makefile.cmake.in +include package/pkg-cmaketargets.mk?include package/Makefile.package.in
package/pkg-cmaketargets.mk renamed from package/Makefile.cmake.in +0
-1--1.7.4.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 7/13 Split Makefile.package.in in pkg-download.mk, pkg-utils.mk and pkg-gentargets.mk
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 1,545 lines
---
?package/Makefile.in ? ? ? ? | ? ?4 +- ?package/Makefile.package.in | ?746 ------------------------------------------- ?package/pkg-download.mk ? ? | ?212 ++++++++++++ ?package/pkg-gentargets.mk ? | ?458 ++++++++++++++++++++++++++ ?package/pkg-utils.mk ? ? ? ?| ? 72 +++++?5 files changed, 745 insertions(+), 747 deletions(-) ?delete mode 100644 package/Makefile.package.in ?create mode 100644
package/pkg-download.mk?create mode 100644package/pkg-gentargets.mk?create mode 100644package/pkg-utils.mkpackage/Makefile.in +0
-0@@ -298,6 +298,8 @@ else?SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared ?endif
package/Makefile.in +2
-0+include package/pkg-utils.mk +include package/pkg-download.mk?include
package/pkg-autotargets.mk
?includepackage/pkg-cmaketargets.mkpackage/Makefile.in +1
-1-include package/Makefile.package.in +include package/pkg-gentargets.mkpackage/Makefile.package.in deleted +0
-746@@ -1,746 +0,0 @@ -################################################################################ -# Generic package infrastructure -# -# This file implements an infrastructure that eases development of -# package .mk files. It should be used for all non-autotools based -# packages. Autotools-based packages should use the specialized -# autotools infrastructure in package/Makefile.autotools.in. -# -# See the Buildroot documentation for details on the usage of this -# infrastructure -# -# In terms of implementation, this generic infrastructure requires the -# .mk file to specify: -# -# ? 1. Metadata informations about the package: name, version, -# ? ? ?download URL, etc. -# -# ? 2. Description of the commands to be executed to configure, build -# ? ? ?and install the package -# -# The autotools infrastructure specializes this generic infrastructure -# by already implementing the configure, build and install steps. -################################################################################ - -# UPPERCASE Macro -- transform its argument to uppercase and replace dots and -# hyphens to underscores - -# Heavily inspired by the up macro from gmsl (http://gmsl.sf.net) -# This is approx 5 times faster than forking a shell and tr, and -# as this macro is used a lot it matters -# This works by creating translation character pairs (E.G. a:A b:B) -# and then looping though all of them running $(subst from,to,text) -[FROM] := a b c d e f g h i j k l m n o p q r s t u v w x y z . - -[TO] ? := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ _ - -UPPERCASE = $(strip $(eval __tmp := $1) \ - ? ? $(foreach c, $(join $(addsuffix :,$([FROM])),$([TO])), \ - ? ? ? $(eval __tmp := \ - ? ? ? ? ? ? ? $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),\ - ? ? ? ? ? ? ? ? ? ? ? $(__tmp)))) \ - ? ? $(__tmp)) - -define KCONFIG_ENABLE_OPT - ? ? ? $(SED) "/\\<$(1)\\>/d" $(2) - ? ? ? echo "$(1)=y" >> $(2) -endef - -define KCONFIG_SET_OPT - ? ? ? $(SED) "/\\<$(1)\\>/d" $(3) - ? ? ? echo "$(1)=$(2)" >> $(3) -endef - -define KCONFIG_DISABLE_OPT - ? ? ? $(SED) "/\\<$(1)\\>/d" $(2) - ? ? ? echo "# $(1) is not set" >> $(2) -endef - -# Helper functions to determine the name of a package and its -# directory from its makefile directory, using the $(MAKEFILE_LIST) -# variable provided by make. This is used by the *TARGETS macros to -# automagically find where the package is located. Note that the -# pkgdir macro is carefully written to handle the case of the Linux -# package, for which the package directory is an empty string. -define pkgdir -$(dir $(lastword $(MAKEFILE_LIST))) -endef - -define pkgname -$(lastword $(subst /, ,$(call pkgdir))) -endef - -define pkgparentdir -$(patsubst %$(call pkgname)/,%,$(call pkgdir)) -endef - -# Define extractors for different archive suffixes -INFLATE.bz2 ?= $(BZCAT) -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 -MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" -TERM_BOLD := $(shell tput smso) -TERM_RESET := $(shell tput rmso) - -# Download method commands -WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET) -SVN:=$(call qstrip,$(BR2_SVN)) -BZR:=$(call qstrip,$(BR2_BZR)) -GIT:=$(call qstrip,$(BR2_GIT)) -HG:=$(call qstrip,$(BR2_HG)) $(QUIET) -SCP:=$(call qstrip,$(BR2_SCP)) $(QUIET) -SSH:=$(call qstrip,$(BR2_SSH)) $(QUIET) -LOCALFILES:=$(call qstrip,$(BR2_LOCALFILES)) - -# Default spider mode is 'DOWNLOAD'. Other possible values are 'SOURCE_CHECK' -# used by the _source-check target and 'SHOW_EXTERNAL_DEPS', used by the -# external-deps target. -DL_MODE=DOWNLOAD - -DL_DIR=$(call qstrip,$(BR2_DL_DIR)) -ifeq ($(DL_DIR),) -DL_DIR:=$(TOPDIR)/dl -endif - -# -# URI scheme helper functions -# Example URIs: -# * http://www.example.com/dir/file -# * scp://www.example.com:dir/file (with domainseparator :) -# -# geturischeme: http -geturischeme=$(firstword $(subst ://, ,$(call qstrip,$(1)))) -# stripurischeme: www.example.com/dir/file -stripurischeme=$(lastword $(subst ://, ,$(call qstrip,$(1)))) -# domain: www.example.com -domain=$(firstword $(subst $(call domainseparator,$(2)), ,$(call stripurischeme,$(1)))) -# notdomain: dir/file -notdomain=$(patsubst $(call domain,$(1),$(2))$(call domainseparator,$(2))%,%,$(call stripurischeme,$(1))) -# -# default domainseparator is /, specify alternative value as first argument -domainseparator=$(if $(1),$(1),/) - -################################################################################ -# The DOWNLOAD_{GIT,SVN,BZR,HG,LOCALFILES} helpers are in charge of getting a -# working copy of the source repository for their corresponding SCM, -# checking out the requested version / commit / tag, and create an -# archive out of it. DOWNLOAD_SCP uses scp to obtain a remote file with -# ssh authentication. DOWNLOAD_WGET is the normal wget-based download -# mechanism. -# -# The SOURCE_CHECK_{GIT,SVN,BZR,HG,WGET,LOCALFILES,SCP} helpers are in charge of -# simply checking that the source is available for download. This can be used -# to make sure one will be able to get all the sources needed for -# one's build configuration. -# -# The SHOW_EXTERNAL_DEPS_{GIT,SVN,BZR,HG,WGET,LOCALFILES,SCP} helpers simply -# output to the console the names of the files that will be downloaded, or path -# and revision of the source repositories, producing a list of all the -# "external dependencies" of a given build configuration. -################################################################################ - -define DOWNLOAD_GIT - ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - ? ? ? (pushd $(DL_DIR) > /dev/null && \ - ? ? ? $(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) && \ - ? ? ? popd > /dev/null && \ - ? ? ? rm -rf $($(PKG)_DL_DIR) && \ - ? ? ? popd > /dev/null) -endef - -# TODO: improve to check that the given PKG_DL_VERSION exists on the remote -# repository -define SOURCE_CHECK_GIT - ?$(GIT) ls-remote --heads $($(PKG)_SITE) > /dev/null -endef - -define SHOW_EXTERNAL_DEPS_GIT - ? ? ? echo $($(PKG)_SOURCE) -endef - - -define DOWNLOAD_BZR - ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - ? ? ? $(BZR) export $(DL_DIR)/$($(PKG)_SOURCE) $($(PKG)_SITE) -r $($(PKG)_DL_VERSION) -endef - -define SOURCE_CHECK_BZR - ? ? ? $(BZR) ls --quiet $($(PKG)_SITE) > /dev/null -endef - -define SHOW_EXTERNAL_DEPS_BZR - ? ? ? echo $($(PKG)_SOURCE) -endef - - -define DOWNLOAD_SVN - ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - ? ? ? (pushd $(DL_DIR) > /dev/null && \ - ? ? ? $(SVN) export -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_DL_DIR) && \ - ? ? ? $(TAR) czf $($(PKG)_SOURCE) $($(PKG)_BASE_NAME)/ && \ - ? ? ? rm -rf $($(PKG)_DL_DIR) && \ - ? ? ? popd > /dev/null) -endef - -define SOURCE_CHECK_SVN - ?$(SVN) ls $($(PKG)_SITE) > /dev/null -endef - -define SHOW_EXTERNAL_DEPS_SVN - ?echo $($(PKG)_SOURCE) -endef - -# SCP URIs should be of the form scp://[user@]host:filepath -# Note that filepath is relative to the user's home directory, so you may want -# to prepend the path with a slash: scp://[user@]host:/absolutepath -define DOWNLOAD_SCP - ? ? ? test -e $(DL_DIR)/$(2) || \ - ? ? ? $(SCP) $(call stripurischeme,$(call qstrip,$(1)))/$(2) $(DL_DIR) -endef - -define SOURCE_CHECK_SCP - ? ? ? $(SSH) $(call domain,$(1),:) ls $(call notdomain,$(1)/$(2),:) > /dev/null -endef - -define SHOW_EXTERNAL_DEPS_SCP - ? ? ? echo $(2) -endef - - -define DOWNLOAD_HG - ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - ? ? ? (pushd $(DL_DIR) > /dev/null && \ - ? ? ? $(HG) clone --noupdate --rev $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ - ? ? ? $(HG) archive --repository $($(PKG)_BASE_NAME) --type tgz --prefix $($(PKG)_BASE_NAME)/ \ - ? ? ? ? ? ? ? ? ? ? --rev $($(PKG)_DL_VERSION) $(DL_DIR)/$($(PKG)_SOURCE) && \ - ? ? ? rm -rf $($(PKG)_DL_DIR) && \ - ? ? ? popd > /dev/null) -endef - -# TODO: improve to check that the given PKG_DL_VERSION exists on the remote -# repository -define SOURCE_CHECK_HG - ?$(HG) incoming --force -l1 $($(PKG)_SITE) > /dev/null -endef - -define SHOW_EXTERNAL_DEPS_HG - ?echo $($(PKG)_SOURCE) -endef - -# Download a file using wget. Only download the file if it doesn't -# already exist in the download directory. If the download fails, -# remove the file (because wget -O creates a 0-byte file even if the -# download fails). -define DOWNLOAD_WGET - ? ? ? test -e $(DL_DIR)/$(2) || \ - ? ? ? $(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) || \ - ? ? ? (rm -f $(DL_DIR)/$(2) ; exit 1) -endef - -define SOURCE_CHECK_WGET - ?$(WGET) --spider $(call qstrip,$(1))/$(2) -endef - -define SHOW_EXTERNAL_DEPS_WGET - ?echo $(2) -endef - -define DOWNLOAD_LOCALFILES - ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ - ? ? ? ? ? ? ? $(LOCALFILES) $(call qstrip,$(subst file://,,$($(PKG)_SITE)))/$($(PKG)_SOURCE) $(DL_DIR) -endef - -define SOURCE_CHECK_LOCALFILES - ?test -e $(call qstrip,$(subst file://,,$($(PKG)_SITE)))/$($(PKG)_SOURCE) -endef - -define SHOW_EXTERNAL_DEPS_LOCALFILES - ?echo $($(PKG)_SITE)/$($(PKG)_SOURCE) -endef - -################################################################################ -# DOWNLOAD -- Download helper. Will try to download source from: -# 1) BR2_PRIMARY_SITE if enabled -# 2) Download site -# 3) BR2_BACKUP_SITE if enabled -# -# Argument 1 is the source location -# Argument 2 is the source filename -# -# E.G. use like this: -# $(call DOWNLOAD,$(FOO_SITE),$(FOO_SOURCE)) -################################################################################ - -define DOWNLOAD - ? ? ? $(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \ - ? ? ? ? ? ? ? case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \ - ? ? ? ? ? ? ? ? ? ? ? scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? *) $(call $(DL_MODE)_WGET,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \ - ? ? ? ? ? ? ? esac ; \ - ? ? ? fi ; \ - ? ? ? if test -n "$(1)" ; then \ - ? ? ? ? ? ? ? case "$($(PKG)_SITE_METHOD)" in \ - ? ? ? ? ? ? ? ? ? ? ? git) $($(DL_MODE)_GIT) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? svn) $($(DL_MODE)_SVN) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? bzr) $($(DL_MODE)_BZR) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? file) $($(DL_MODE)_LOCALFILES) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? scp) $($(DL_MODE)_SCP) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? hg) $($(DL_MODE)_HG) && exit ;; \ - ? ? ? ? ? ? ? ? ? ? ? *) $(call $(DL_MODE)_WGET,$(1),$(2)) && exit ;; \ - ? ? ? ? ? ? ? esac ; \ - ? ? ? fi ; \ - ? ? ? if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \ - ? ? ? ? ? ? ? $(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE),$(2)) && exit ; \ - ? ? ? fi ; \ - ? ? ? exit 1 -endef - -# Needed for the foreach loops to loop over the list of hooks, so that -# each hook call is properly separated by a newline. -define sep - - -endef - -################################################################################ -# Implicit targets -- produce a stamp file for each step of a package build -################################################################################ - -# Retrieve the archive -$(BUILD_DIR)/%/.stamp_downloaded: -ifeq ($(DL_MODE),DOWNLOAD) -# Only show the download message if it isn't already downloaded - ? ? ? $(Q)(test -e $(DL_DIR)/$($(PKG)_SOURCE) && \ - ? ? ? ? ? ? ? (test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \ - ? ? ? ? ? ? ? $(call MESSAGE,"Downloading") -endif - ? ? ? $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE))) - ? ? ? $(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH))) - ? ? ? $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep)) -ifeq ($(DL_MODE),DOWNLOAD) - ? ? ? $(Q)mkdir -p $(@D) - ? ? ? $(Q)touch $@ -endif - -# Unpack the archive -$(BUILD_DIR)/%/.stamp_extracted: - ? ? ? @$(call MESSAGE,"Extracting") - ? ? ? $(Q)mkdir -p $(@D) - ? ? ? $($(PKG)_EXTRACT_CMDS) -# some packages have messed up permissions inside - ? ? ? $(Q)chmod -R +rw $(@D) - ? ? ? $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is -# used. -$(BUILD_DIR)/%/.stamp_rsynced: - ? ? ? @$(call MESSAGE,"Syncing from source dir $(SRCDIR)") - ? ? ? @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1) - ? ? ? rsync -au $(SRCDIR)/ $(@D) - ? ? ? $(Q)touch $@ - -# Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced -# packages -$(BUILD_DIR)/%/.stamp_rsync_sourced: -ifeq ($(DL_MODE),SOURCE_CHECK) - ? ? ? test -d $(SRCDIR) -else ifeq ($(DL_MODE),SHOW_EXTERNAL_DEPS) - ? ? ? echo "file://$(SRCDIR)" -else - ? ? ? @true # Nothing to do to source a local package -endif - -# Patch -# -# The RAWNAME variable is the lowercased package name, which allows to -# find the package directory (typically package/<pkgname>) and the -# prefix of the patches -$(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) -$(BUILD_DIR)/%/.stamp_patched: - ? ? ? @$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") - ? ? ? $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(if $($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $($(PKG)_PATCH)) - ? ? ? $(Q)( \ - ? ? ? if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \ - ? ? ? ? if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \ - ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \ - ? ? ? ? else \ - ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(RAWNAME)\*.patch $(RAWNAME)\*.patch.$(ARCH) || exit 1; \ - ? ? ? ? ? if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER); then \ - ? ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \ - ? ? ? ? ? fi; \ - ? ? ? ? fi; \ - ? ? ? fi; \ - ? ? ? ) - ? ? ? $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Configure -$(BUILD_DIR)/%/.stamp_configured: - ? ? ? $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - ? ? ? @$(call MESSAGE,"Configuring") - ? ? ? $($(PKG)_CONFIGURE_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Build -$(BUILD_DIR)/%/.stamp_built:: - ? ? ? @$(call MESSAGE,"Building") - ? ? ? $($(PKG)_BUILD_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Install to host dir -$(BUILD_DIR)/%/.stamp_host_installed: - ? ? ? @$(call MESSAGE,"Installing to host directory") - ? ? ? $($(PKG)_INSTALL_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Install to staging dir -$(BUILD_DIR)/%/.stamp_staging_installed: - ? ? ? @$(call MESSAGE,"Installing to staging directory") - ? ? ? $($(PKG)_INSTALL_STAGING_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Install to images dir -$(BUILD_DIR)/%/.stamp_images_installed: - ? ? ? @$(call MESSAGE,"Installing to images directory") - ? ? ? $($(PKG)_INSTALL_IMAGES_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Install to target dir -$(BUILD_DIR)/%/.stamp_target_installed: - ? ? ? @$(call MESSAGE,"Installing to target") - ? ? ? $($(PKG)_INSTALL_TARGET_CMDS) - ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep)) - ? ? ? $(Q)touch $@ - -# Clean package -$(BUILD_DIR)/%/.stamp_cleaned: - ? ? ? @$(call MESSAGE,"Cleaning up") - ? ? ? $($(PKG)_CLEAN_CMDS) - ? ? ? rm -f $(@D)/.stamp_built - -# Uninstall package from target and staging -# Uninstall commands tend to fail, so remove the stamp files first -$(BUILD_DIR)/%/.stamp_uninstalled: - ? ? ? @$(call MESSAGE,"Uninstalling") - ? ? ? rm -f $($(PKG)_TARGET_INSTALL_STAGING) - ? ? ? rm -f $($(PKG)_TARGET_INSTALL_TARGET) - ? ? ? $($(PKG)_UNINSTALL_STAGING_CMDS) - ? ? ? $($(PKG)_UNINSTALL_TARGET_CMDS) - -# Remove package sources -$(BUILD_DIR)/%/.stamp_dircleaned: - ? ? ? rm -Rf $(@D) - -################################################################################ -# GENTARGETS_INNER -- generates the make targets needed to build a -# generic package -# -# ?argument 1 is the lowercase package name -# ?argument 2 is the uppercase package name, including an HOST_ prefix -# ? ? ? ? ? ? for host packages -# ?argument 3 is the uppercase package name, without the HOST_ prefix -# ? ? ? ? ? ? for host packages -# ?argument 4 is the package directory prefix -# ?argument 5 is the type (target or host) -################################################################################ - -define GENTARGETS_INNER - -# Define default values for various package-related variables, if not -# already defined. For some variables (version, source, site and -# subdir), if they are undefined, we try to see if a variable without -# the HOST_ prefix is defined. If so, we use such a variable, so that -# these informations have only to be specified once, for both the -# target and host packages of a given .mk file. - -$(2)_TYPE ? ? ? ? ? ? ? ? ? ? ? = ?$(5) -$(2)_NAME ? ? ? ? ? ? ? ? ? ? ?= ?$(1) - -# Keep the package version that may contain forward slashes in the _DL_VERSION -# variable, then replace all forward slashes ('/') by underscores ('_') to -# sanitize the package version that is used in paths, directory and file names. -# Forward slashes may appear in the package's version when pointing to a -# version control system branch or tag, for example remotes/origin/1_10_stable. -ifndef $(2)_VERSION - ifdef $(3)_VERSION - ?$(2)_DL_VERSION = $($(3)_VERSION) - ?$(2)_VERSION = $(subst /,_,$($(3)_VERSION)) - else - ?$(2)_VERSION = undefined - ?$(2)_DL_VERSION = undefined - endif -else - ?$(2)_DL_VERSION = $($(2)_VERSION) - ?$(2)_VERSION = $(subst /,_,$($(2)_VERSION)) -endif - -$(2)_BASE_NAME = ?$(1)-$$($(2)_VERSION) -$(2)_DL_DIR ? ?= ?$$(DL_DIR)/$$($(2)_BASE_NAME) -$(2)_DIR ? ? ? = ?$$(BUILD_DIR)/$$($(2)_BASE_NAME) - -ifneq ($$($(2)_OVERRIDE_SRCDIR),) -$(2)_VERSION = custom -endif - -ifndef $(2)_SOURCE - ifdef $(3)_SOURCE - ?$(2)_SOURCE = $($(3)_SOURCE) - else - ?$(2)_SOURCE ? ? ? ? ? ? ? ? ??= $$($(2)_BASE_NAME).tar.gz - endif -endif - -ifndef $(2)_PATCH - ifdef $(3)_PATCH - ?$(2)_PATCH = $($(3)_PATCH) - endif -endif - -ifndef $(2)_SITE - ifdef $(3)_SITE - ?$(2)_SITE = $($(3)_SITE) - else - ?$(2)_SITE ? ? ? ? ? ? ? ? ? ??= \ - ? ? ? http://$$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/$(1) - endif -endif - -ifndef $(2)_SITE_METHOD - ifdef $(3)_SITE_METHOD - ?$(2)_SITE_METHOD = $($(3)_SITE_METHOD) - else - ? ? ? # Try automatic detection using the scheme part of the URI - ? ? ? $(2)_SITE_METHOD = $(firstword $(subst ://, ,$(call qstrip,$($(2)_SITE)))) - endif -endif - -ifeq ($$($(2)_SITE_METHOD),local) -ifeq ($$($(2)_OVERRIDE_SRCDIR),) -$(2)_OVERRIDE_SRCDIR = $($(2)_SITE) -endif -endif - -$(2)_DEPENDENCIES ?= $(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))) - -$(2)_INSTALL_STAGING ? ? ? ? ? ?= NO -$(2)_INSTALL_IMAGES ? ? ? ? ? ??= NO -$(2)_INSTALL_TARGET ? ? ? ? ? ??= YES -$(2)_DIR_PREFIX ? ? ? ? ? ? ? ? ? ? ? ?= $(if $(4),$(4),$(TOP_SRCDIR)/package) - -# define sub-target stamps -$(2)_TARGET_INSTALL_TARGET = ? $$($(2)_DIR)/.stamp_target_installed -$(2)_TARGET_INSTALL_STAGING = ?$$($(2)_DIR)/.stamp_staging_installed -$(2)_TARGET_INSTALL_IMAGES = ? $$($(2)_DIR)/.stamp_images_installed -$(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_RSYNC = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_rsynced -$(2)_TARGET_RSYNC_SOURCE = ? ? ?$$($(2)_DIR)/.stamp_rsync_sourced -$(2)_TARGET_PATCH = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_patched -$(2)_TARGET_EXTRACT = ? ? ? ? ?$$($(2)_DIR)/.stamp_extracted -$(2)_TARGET_SOURCE = ? ? ? ? ? $$($(2)_DIR)/.stamp_downloaded -$(2)_TARGET_UNINSTALL = ? ? ? ? ? ? ? ?$$($(2)_DIR)/.stamp_uninstalled -$(2)_TARGET_CLEAN = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_cleaned -$(2)_TARGET_DIRCLEAN = ? ? ? ? $$($(2)_DIR)/.stamp_dircleaned - -# default extract command -$(2)_EXTRACT_CMDS ?= \ - ? ? ? $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $(DL_DIR)/$$($(2)_SOURCE) | \ - ? ? ? $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -) - -# post-steps hooks -$(2)_POST_DOWNLOAD_HOOKS ? ? ? ??= -$(2)_POST_EXTRACT_HOOKS ? ? ? ? ?= -$(2)_PRE_PATCH_HOOKS ? ? ? ? ? ??= -$(2)_POST_PATCH_HOOKS ? ? ? ? ? ?= -$(2)_PRE_CONFIGURE_HOOKS ? ? ? ??= -$(2)_POST_CONFIGURE_HOOKS ? ? ? ?= -$(2)_POST_BUILD_HOOKS ? ? ? ? ? ?= -$(2)_POST_INSTALL_HOOKS ? ? ? ? ?= -$(2)_POST_INSTALL_STAGING_HOOKS ?= -$(2)_POST_INSTALL_TARGET_HOOKS ??= -$(2)_POST_INSTALL_IMAGES_HOOKS ??= - -# human-friendly targets and target sequencing -$(1): ? ? ? ? ? ? ? ? ?$(1)-install - -ifeq ($$($(2)_TYPE),host) -$(1)-install: ? ? ? ? ?$(1)-install-host -else -$(1)-install: ? ? ? ? ?$(1)-install-staging $(1)-install-target $(1)-install-images -endif - -ifeq ($$($(2)_INSTALL_TARGET),YES) -$(1)-install-target: ? $(1)-build \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_TARGET) -else -$(1)-install-target: -endif - -ifeq ($$($(2)_INSTALL_STAGING),YES) -$(1)-install-staging: ?$(1)-build \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_STAGING) -else -$(1)-install-staging: -endif - -ifeq ($$($(2)_INSTALL_IMAGES),YES) -$(1)-install-images: ? $(1)-build \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_IMAGES) -else -$(1)-install-images: -endif - -$(1)-install-host: ? ? ?$(1)-build $$($(2)_TARGET_INSTALL_HOST) - -$(1)-build: ? ? ? ? ? ?$(1)-configure \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_BUILD) - -ifeq ($$($(2)_OVERRIDE_SRCDIR),) -# In the normal case (no package override), the sequence of steps is -# ?source, by downloading -# ?depends -# ?extract -# ?patch -# ?configure -$(1)-configure: ? ? ? ? ? ? ? ?$(1)-patch $(1)-depends \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CONFIGURE) - -$(1)-patch: ? ? ? ? ? ?$(1)-extract $$($(2)_TARGET_PATCH) - -$(1)-extract: ? ? ? ? ?$(1)-source \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_EXTRACT) - -$(1)-depends: ? ? ? ? ?$$($(2)_DEPENDENCIES) - -$(1)-source: ? ? ? ? ? $$($(2)_TARGET_SOURCE) -else -# In the package override case, the sequence of steps -# ?source, by rsyncing -# ?depends -# ?configure -$(1)-configure: ? ? ? ? ? ? ? ?$(1)-depends \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CONFIGURE) - -$(1)-depends: ? ? ? ? ?$(1)-rsync $$($(2)_DEPENDENCIES) - -$(1)-rsync: ? ? ? ? ? ?$$($(2)_TARGET_RSYNC) - -$(1)-source: ? ? ? ? ? $$($(2)_TARGET_RSYNC_SOURCE) -endif - -$(1)-show-depends: - ? ? ? ? ? ? ? ? ? ? ? @echo $$($(2)_DEPENDENCIES) - -$(1)-uninstall: ? ? ? ? ? ? ? ?$(1)-configure $$($(2)_TARGET_UNINSTALL) - -$(1)-clean: ? ? ? ? ? ?$(1)-uninstall \ - ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CLEAN) - -$(1)-dirclean: ? ? ? ? $$($(2)_TARGET_DIRCLEAN) - -$(1)-clean-for-rebuild: -ifneq ($$($(2)_OVERRIDE_SRCDIR),) - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_RSYNC) -endif - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_BUILD) - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_STAGING) - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_TARGET) - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_IMAGES) - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_HOST) - -$(1)-rebuild: ? ? ? ? ?$(1)-clean-for-rebuild all - -$(1)-clean-for-reconfigure: $(1)-clean-for-rebuild - ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_CONFIGURE) - -$(1)-reconfigure: ? ? ?$(1)-clean-for-reconfigure all - -# define the PKG variable for all targets, containing the -# uppercase package variable prefix -$$($(2)_TARGET_INSTALL_TARGET): ? ? ? ? ? ? ? ?PKG=$(2) -$$($(2)_TARGET_INSTALL_STAGING): ? ? ? PKG=$(2) -$$($(2)_TARGET_INSTALL_IMAGES): ? ? ? ? ? ? ? ?PKG=$(2) -$$($(2)_TARGET_INSTALL_HOST): ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_BUILD): ? ? ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_CONFIGURE): ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_RSYNC): ? ? ? ? ? ? ? ? ?SRCDIR=$$($(2)_OVERRIDE_SRCDIR) -$$($(2)_TARGET_RSYNC): ? ? ? ? ? ? ? ? ?PKG=$(2) -$$($(2)_TARGET_RSYNC_SOURCE): ? ? ? ? ?SRCDIR=$$($(2)_OVERRIDE_SRCDIR) -$$($(2)_TARGET_RSYNC_SOURCE): ? ? ? ? ?PKG=$(2) -$$($(2)_TARGET_PATCH): ? ? ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_PATCH): ? ? ? ? ? ? ? ? RAWNAME=$(patsubst host-%,%,$(1)) -$$($(2)_TARGET_EXTRACT): ? ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_SOURCE): ? ? ? ? ? ? ? ? ? ? ? ?PKG=$(2) -$$($(2)_TARGET_UNINSTALL): ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_CLEAN): ? ? ? ? ? ? ? ? PKG=$(2) -$$($(2)_TARGET_DIRCLEAN): ? ? ? ? ? ? ?PKG=$(2) - -# Compute the name of the Kconfig option that correspond to the -# package being enabled. We handle three cases: the special Linux -# kernel case, the bootloaders case, and the normal packages case. -ifeq ($(1),linux) -$(2)_KCONFIG_VAR = BR2_LINUX_KERNEL -else ifeq ($(4),boot/) -$(2)_KCONFIG_VAR = BR2_TARGET_$(2) -else -$(2)_KCONFIG_VAR = BR2_PACKAGE_$(2) -endif - -# add package to the general list of targets if requested by the buildroot -# configuration -ifeq ($$($$($(2)_KCONFIG_VAR)),y) - -TARGETS += $(1) -PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep) -PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep) - -ifeq ($$($(2)_SITE_METHOD),svn) -DL_TOOLS_DEPENDENCIES += svn -else ifeq ($$($(2)_SITE_METHOD),git) -DL_TOOLS_DEPENDENCIES += git -else ifeq ($$($(2)_SITE_METHOD),bzr) -DL_TOOLS_DEPENDENCIES += bzr -else ifeq ($$($(2)_SITE_METHOD),scp) -DL_TOOLS_DEPENDENCIES += scp ssh -else ifeq ($$($(2)_SITE_METHOD),hg) -DL_TOOLS_DEPENDENCIES += hg -endif # SITE_METHOD - -DL_TOOLS_DEPENDENCIES += $(firstword $(INFLATE$(suffix $($(2)_SOURCE)))) - -endif # $(2)_KCONFIG_VAR -endef # GENTARGETS_INNER - -################################################################################ -# GENTARGETS -- the target generator macro for generic packages -# -# Argument 1 is "target" or "host" ? ? ? ? ? [optional, default: "target"] -################################################################################ - -define GENTARGETS -ifeq ($(1),host) -# In the case of host packages, turn the package name "pkg" into "host-pkg" -$(call GENTARGETS_INNER,$(1)-$(call pkgname),$(call UPPERCASE,$(1)-$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),host) -else -# In the case of target packages, keep the package name "pkg" -$(call GENTARGETS_INNER,$(call pkgname),$(call UPPERCASE,$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),target) -endif -endef - -# :mode=makefile:package/pkg-download.mk new file +212
-0@@ -0,0 +1,212 @@ +# Download method commands +WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET) +SVN:=$(call qstrip,$(BR2_SVN)) +BZR:=$(call qstrip,$(BR2_BZR)) +GIT:=$(call qstrip,$(BR2_GIT)) +HG:=$(call qstrip,$(BR2_HG)) $(QUIET) +SCP:=$(call qstrip,$(BR2_SCP)) $(QUIET) +SSH:=$(call qstrip,$(BR2_SSH)) $(QUIET) +LOCALFILES:=$(call qstrip,$(BR2_LOCALFILES)) + +# Default spider mode is 'DOWNLOAD'. Other possible values are 'SOURCE_CHECK' +# used by the _source-check target and 'SHOW_EXTERNAL_DEPS', used by the +# external-deps target. +DL_MODE=DOWNLOAD + +DL_DIR=$(call qstrip,$(BR2_DL_DIR)) +ifeq ($(DL_DIR),) +DL_DIR:=$(TOPDIR)/dl +endif + +# +# URI scheme helper functions +# Example URIs: +# * http://www.example.com/dir/file +# * scp://www.example.com:dir/file (with domainseparator :) +# +# geturischeme: http +geturischeme=$(firstword $(subst ://, ,$(call qstrip,$(1)))) +# stripurischeme: www.example.com/dir/file +stripurischeme=$(lastword $(subst ://, ,$(call qstrip,$(1)))) +# domain: www.example.com +domain=$(firstword $(subst $(call domainseparator,$(2)), ,$(call stripurischeme,$(1)))) +# notdomain: dir/file +notdomain=$(patsubst $(call domain,$(1),$(2))$(call domainseparator,$(2))%,%,$(call stripurischeme,$(1))) +# +# default domainseparator is /, specify alternative value as first argument +domainseparator=$(if $(1),$(1),/) + +################################################################################ +# The DOWNLOAD_{GIT,SVN,BZR,HG,LOCALFILES} helpers are in charge of getting a +# working copy of the source repository for their corresponding SCM, +# checking out the requested version / commit / tag, and create an +# archive out of it. DOWNLOAD_SCP uses scp to obtain a remote file with +# ssh authentication. DOWNLOAD_WGET is the normal wget-based download +# mechanism. +# +# The SOURCE_CHECK_{GIT,SVN,BZR,HG,WGET,LOCALFILES,SCP} helpers are in charge of +# simply checking that the source is available for download. This can be used +# to make sure one will be able to get all the sources needed for +# one's build configuration. +# +# The SHOW_EXTERNAL_DEPS_{GIT,SVN,BZR,HG,WGET,LOCALFILES,SCP} helpers simply +# output to the console the names of the files that will be downloaded, or path +# and revision of the source repositories, producing a list of all the +# "external dependencies" of a given build configuration. +################################################################################ + +define DOWNLOAD_GIT + ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ + ? ? ? (pushd $(DL_DIR) > /dev/null && \ + ? ? ? $(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) && \ + ? ? ? popd > /dev/null && \ + ? ? ? rm -rf $($(PKG)_DL_DIR) && \ + ? ? ? popd > /dev/null) +endef + +# TODO: improve to check that the given PKG_DL_VERSION exists on the remote +# repository +define SOURCE_CHECK_GIT + ?$(GIT) ls-remote --heads $($(PKG)_SITE) > /dev/null +endef + +define SHOW_EXTERNAL_DEPS_GIT + ? ? ? echo $($(PKG)_SOURCE) +endef + + +define DOWNLOAD_BZR + ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ + ? ? ? $(BZR) export $(DL_DIR)/$($(PKG)_SOURCE) $($(PKG)_SITE) -r $($(PKG)_DL_VERSION) +endef + +define SOURCE_CHECK_BZR + ? ? ? $(BZR) ls --quiet $($(PKG)_SITE) > /dev/null +endef + +define SHOW_EXTERNAL_DEPS_BZR + ? ? ? echo $($(PKG)_SOURCE) +endef + + +define DOWNLOAD_SVN + ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ + ? ? ? (pushd $(DL_DIR) > /dev/null && \ + ? ? ? $(SVN) export -r $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_DL_DIR) && \ + ? ? ? $(TAR) czf $($(PKG)_SOURCE) $($(PKG)_BASE_NAME)/ && \ + ? ? ? rm -rf $($(PKG)_DL_DIR) && \ + ? ? ? popd > /dev/null) +endef + +define SOURCE_CHECK_SVN + ?$(SVN) ls $($(PKG)_SITE) > /dev/null +endef + +define SHOW_EXTERNAL_DEPS_SVN + ?echo $($(PKG)_SOURCE) +endef + +# SCP URIs should be of the form scp://[user@]host:filepath +# Note that filepath is relative to the user's home directory, so you may want +# to prepend the path with a slash: scp://[user@]host:/absolutepath +define DOWNLOAD_SCP + ? ? ? test -e $(DL_DIR)/$(2) || \ + ? ? ? $(SCP) $(call stripurischeme,$(call qstrip,$(1)))/$(2) $(DL_DIR) +endef + +define SOURCE_CHECK_SCP + ? ? ? $(SSH) $(call domain,$(1),:) ls $(call notdomain,$(1)/$(2),:) > /dev/null +endef + +define SHOW_EXTERNAL_DEPS_SCP + ? ? ? echo $(2) +endef + + +define DOWNLOAD_HG + ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ + ? ? ? (pushd $(DL_DIR) > /dev/null && \ + ? ? ? $(HG) clone --noupdate --rev $($(PKG)_DL_VERSION) $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \ + ? ? ? $(HG) archive --repository $($(PKG)_BASE_NAME) --type tgz --prefix $($(PKG)_BASE_NAME)/ \ + ? ? ? ? ? ? ? ? ? ? --rev $($(PKG)_DL_VERSION) $(DL_DIR)/$($(PKG)_SOURCE) && \ + ? ? ? rm -rf $($(PKG)_DL_DIR) && \ + ? ? ? popd > /dev/null) +endef + +# TODO: improve to check that the given PKG_DL_VERSION exists on the remote +# repository +define SOURCE_CHECK_HG + ?$(HG) incoming --force -l1 $($(PKG)_SITE) > /dev/null +endef + +define SHOW_EXTERNAL_DEPS_HG + ?echo $($(PKG)_SOURCE) +endef + + +define DOWNLOAD_WGET + ? ? ? test -e $(DL_DIR)/$(2) || \ + ? ? ? $(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) || \ + ? ? ? (rm -f $(DL_DIR)/$(2) ; exit 1) +endef + +define SOURCE_CHECK_WGET + ?$(WGET) --spider $(call qstrip,$(1))/$(2) +endef + +define SHOW_EXTERNAL_DEPS_WGET + ?echo $(2) +endef + +define DOWNLOAD_LOCALFILES + ? ? ? test -e $(DL_DIR)/$($(PKG)_SOURCE) || \ + ? ? ? ? ? ? ? $(LOCALFILES) $(call qstrip,$(subst file://,,$($(PKG)_SITE)))/$($(PKG)_SOURCE) $(DL_DIR) +endef + +define SOURCE_CHECK_LOCALFILES + ?test -e $(call qstrip,$(subst file://,,$($(PKG)_SITE)))/$($(PKG)_SOURCE) +endef + +define SHOW_EXTERNAL_DEPS_LOCALFILES + ?echo $($(PKG)_SITE)/$($(PKG)_SOURCE) +endef + +################################################################################ +# DOWNLOAD -- Download helper. Will try to download source from: +# 1) BR2_PRIMARY_SITE if enabled +# 2) Download site +# 3) BR2_BACKUP_SITE if enabled +# +# Argument 1 is the source location +# Argument 2 is the source filename +# +# E.G. use like this: +# $(call DOWNLOAD,$(FOO_SITE),$(FOO_SOURCE)) +################################################################################ + +define DOWNLOAD + ? ? ? $(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \ + ? ? ? ? ? ? ? case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \ + ? ? ? ? ? ? ? ? ? ? ? scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? *) $(call $(DL_MODE)_WGET,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \ + ? ? ? ? ? ? ? esac ; \ + ? ? ? fi ; \ + ? ? ? if test -n "$(1)" ; then \ + ? ? ? ? ? ? ? case "$($(PKG)_SITE_METHOD)" in \ + ? ? ? ? ? ? ? ? ? ? ? git) $($(DL_MODE)_GIT) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? svn) $($(DL_MODE)_SVN) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? bzr) $($(DL_MODE)_BZR) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? file) $($(DL_MODE)_LOCALFILES) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? scp) $($(DL_MODE)_SCP) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? hg) $($(DL_MODE)_HG) && exit ;; \ + ? ? ? ? ? ? ? ? ? ? ? *) $(call $(DL_MODE)_WGET,$(1),$(2)) && exit ;; \ + ? ? ? ? ? ? ? esac ; \ + ? ? ? fi ; \ + ? ? ? if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \ + ? ? ? ? ? ? ? $(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE),$(2)) && exit ; \ + ? ? ? fi ; \ + ? ? ? exit 1 +endefpackage/pkg-gentargets.mk new file +458
-0@@ -0,0 +1,458 @@ +################################################################################ +# Generic package infrastructure +# +# This file implements an infrastructure that eases development of +# package .mk files. It should be used for all non-autotools based +# packages. Autotools-based packages should use the specialized +# autotools infrastructure in package/Makefile.autotools.in. +# +# See the Buildroot documentation for details on the usage of this +# infrastructure +# +# In terms of implementation, this generic infrastructure requires the +# .mk file to specify: +# +# ? 1. Metadata informations about the package: name, version, +# ? ? ?download URL, etc. +# +# ? 2. Description of the commands to be executed to configure, build +# ? ? ?and install the package +# +# The autotools infrastructure specializes this generic infrastructure +# by already implementing the configure, build and install steps. +################################################################################ + +################################################################################ +# Implicit targets -- produce a stamp file for each step of a package build +################################################################################ + +# Retrieve the archive +$(BUILD_DIR)/%/.stamp_downloaded: +ifeq ($(DL_MODE),DOWNLOAD) +# Only show the download message if it isn't already downloaded + ? ? ? $(Q)(test -e $(DL_DIR)/$($(PKG)_SOURCE) && \ + ? ? ? ? ? ? ? (test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \ + ? ? ? ? ? ? ? $(call MESSAGE,"Downloading") +endif + ? ? ? $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE))) + ? ? ? $(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH))) + ? ? ? $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep)) +ifeq ($(DL_MODE),DOWNLOAD) + ? ? ? $(Q)mkdir -p $(@D) + ? ? ? $(Q)touch $@ +endif + +# Unpack the archive +$(BUILD_DIR)/%/.stamp_extracted: + ? ? ? @$(call MESSAGE,"Extracting") + ? ? ? $(Q)mkdir -p $(@D) + ? ? ? $($(PKG)_EXTRACT_CMDS) +# some packages have messed up permissions inside + ? ? ? $(Q)chmod -R +rw $(@D) + ? ? ? $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is +# used. +$(BUILD_DIR)/%/.stamp_rsynced: + ? ? ? @$(call MESSAGE,"Syncing from source dir $(SRCDIR)") + ? ? ? @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1) + ? ? ? rsync -au $(SRCDIR)/ $(@D) + ? ? ? $(Q)touch $@ + +# Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced +# packages +$(BUILD_DIR)/%/.stamp_rsync_sourced: +ifeq ($(DL_MODE),SOURCE_CHECK) + ? ? ? test -d $(SRCDIR) +else ifeq ($(DL_MODE),SHOW_EXTERNAL_DEPS) + ? ? ? echo "file://$(SRCDIR)" +else + ? ? ? @true # Nothing to do to source a local package +endif + +# Patch +# +# The RAWNAME variable is the lowercased package name, which allows to +# find the package directory (typically package/<pkgname>) and the +# prefix of the patches +$(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) +$(BUILD_DIR)/%/.stamp_patched: + ? ? ? @$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") + ? ? ? $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(if $($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $($(PKG)_PATCH)) + ? ? ? $(Q)( \ + ? ? ? if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \ + ? ? ? ? if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \ + ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \ + ? ? ? ? else \ + ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(RAWNAME)\*.patch $(RAWNAME)\*.patch.$(ARCH) || exit 1; \ + ? ? ? ? ? if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER); then \ + ? ? ? ? ? ? support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \ + ? ? ? ? ? fi; \ + ? ? ? ? fi; \ + ? ? ? fi; \ + ? ? ? ) + ? ? ? $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Configure +$(BUILD_DIR)/%/.stamp_configured: + ? ? ? $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + ? ? ? @$(call MESSAGE,"Configuring") + ? ? ? $($(PKG)_CONFIGURE_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Build +$(BUILD_DIR)/%/.stamp_built:: + ? ? ? @$(call MESSAGE,"Building") + ? ? ? $($(PKG)_BUILD_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Install to host dir +$(BUILD_DIR)/%/.stamp_host_installed: + ? ? ? @$(call MESSAGE,"Installing to host directory") + ? ? ? $($(PKG)_INSTALL_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Install to staging dir +$(BUILD_DIR)/%/.stamp_staging_installed: + ? ? ? @$(call MESSAGE,"Installing to staging directory") + ? ? ? $($(PKG)_INSTALL_STAGING_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Install to images dir +$(BUILD_DIR)/%/.stamp_images_installed: + ? ? ? @$(call MESSAGE,"Installing to images directory") + ? ? ? $($(PKG)_INSTALL_IMAGES_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Install to target dir +$(BUILD_DIR)/%/.stamp_target_installed: + ? ? ? @$(call MESSAGE,"Installing to target") + ? ? ? $($(PKG)_INSTALL_TARGET_CMDS) + ? ? ? $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep)) + ? ? ? $(Q)touch $@ + +# Clean package +$(BUILD_DIR)/%/.stamp_cleaned: + ? ? ? @$(call MESSAGE,"Cleaning up") + ? ? ? $($(PKG)_CLEAN_CMDS) + ? ? ? rm -f $(@D)/.stamp_built + +# Uninstall package from target and staging +# Uninstall commands tend to fail, so remove the stamp files first +$(BUILD_DIR)/%/.stamp_uninstalled: + ? ? ? @$(call MESSAGE,"Uninstalling") + ? ? ? rm -f $($(PKG)_TARGET_INSTALL_STAGING) + ? ? ? rm -f $($(PKG)_TARGET_INSTALL_TARGET) + ? ? ? $($(PKG)_UNINSTALL_STAGING_CMDS) + ? ? ? $($(PKG)_UNINSTALL_TARGET_CMDS) + +# Remove package sources +$(BUILD_DIR)/%/.stamp_dircleaned: + ? ? ? rm -Rf $(@D) + +################################################################################ +# GENTARGETS_INNER -- generates the make targets needed to build a +# generic package +# +# ?argument 1 is the lowercase package name +# ?argument 2 is the uppercase package name, including an HOST_ prefix +# ? ? ? ? ? ? for host packages +# ?argument 3 is the uppercase package name, without the HOST_ prefix +# ? ? ? ? ? ? for host packages +# ?argument 4 is the package directory prefix +# ?argument 5 is the type (target or host) +################################################################################ + +define GENTARGETS_INNER + +# Define default values for various package-related variables, if not +# already defined. For some variables (version, source, site and +# subdir), if they are undefined, we try to see if a variable without +# the HOST_ prefix is defined. If so, we use such a variable, so that +# these informations have only to be specified once, for both the +# target and host packages of a given .mk file. + +$(2)_TYPE ? ? ? ? ? ? ? ? ? ? ? = ?$(5) +$(2)_NAME ? ? ? ? ? ? ? ? ? ? ?= ?$(1) + +# Keep the package version that may contain forward slashes in the _DL_VERSION +# variable, then replace all forward slashes ('/') by underscores ('_') to +# sanitize the package version that is used in paths, directory and file names. +# Forward slashes may appear in the package's version when pointing to a +# version control system branch or tag, for example remotes/origin/1_10_stable. +ifndef $(2)_VERSION + ifdef $(3)_VERSION + ?$(2)_DL_VERSION = $($(3)_VERSION) + ?$(2)_VERSION = $(subst /,_,$($(3)_VERSION)) + else + ?$(2)_VERSION = undefined + ?$(2)_DL_VERSION = undefined + endif +else + ?$(2)_DL_VERSION = $($(2)_VERSION) + ?$(2)_VERSION = $(subst /,_,$($(2)_VERSION)) +endif + +$(2)_BASE_NAME = ?$(1)-$$($(2)_VERSION) +$(2)_DL_DIR ? ?= ?$$(DL_DIR)/$$($(2)_BASE_NAME) +$(2)_DIR ? ? ? = ?$$(BUILD_DIR)/$$($(2)_BASE_NAME) + +ifneq ($$($(2)_OVERRIDE_SRCDIR),) +$(2)_VERSION = custom +endif + +ifndef $(2)_SOURCE + ifdef $(3)_SOURCE + ?$(2)_SOURCE = $($(3)_SOURCE) + else + ?$(2)_SOURCE ? ? ? ? ? ? ? ? ??= $$($(2)_BASE_NAME).tar.gz + endif +endif + +ifndef $(2)_PATCH + ifdef $(3)_PATCH + ?$(2)_PATCH = $($(3)_PATCH) + endif +endif + +ifndef $(2)_SITE + ifdef $(3)_SITE + ?$(2)_SITE = $($(3)_SITE) + else + ?$(2)_SITE ? ? ? ? ? ? ? ? ? ??= \ + ? ? ? http://$$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/$(1) + endif +endif + +ifndef $(2)_SITE_METHOD + ifdef $(3)_SITE_METHOD + ?$(2)_SITE_METHOD = $($(3)_SITE_METHOD) + else + ? ? ? # Try automatic detection using the scheme part of the URI + ? ? ? $(2)_SITE_METHOD = $(firstword $(subst ://, ,$(call qstrip,$($(2)_SITE)))) + endif +endif + +ifeq ($$($(2)_SITE_METHOD),local) +ifeq ($$($(2)_OVERRIDE_SRCDIR),) +$(2)_OVERRIDE_SRCDIR = $($(2)_SITE) +endif +endif + +$(2)_DEPENDENCIES ?= $(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES))) + +$(2)_INSTALL_STAGING ? ? ? ? ? ?= NO +$(2)_INSTALL_IMAGES ? ? ? ? ? ??= NO +$(2)_INSTALL_TARGET ? ? ? ? ? ??= YES +$(2)_DIR_PREFIX ? ? ? ? ? ? ? ? ? ? ? ?= $(if $(4),$(4),$(TOP_SRCDIR)/package) + +# define sub-target stamps +$(2)_TARGET_INSTALL_TARGET = ? $$($(2)_DIR)/.stamp_target_installed +$(2)_TARGET_INSTALL_STAGING = ?$$($(2)_DIR)/.stamp_staging_installed +$(2)_TARGET_INSTALL_IMAGES = ? $$($(2)_DIR)/.stamp_images_installed +$(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_RSYNC = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_rsynced +$(2)_TARGET_RSYNC_SOURCE = ? ? ?$$($(2)_DIR)/.stamp_rsync_sourced +$(2)_TARGET_PATCH = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_patched +$(2)_TARGET_EXTRACT = ? ? ? ? ?$$($(2)_DIR)/.stamp_extracted +$(2)_TARGET_SOURCE = ? ? ? ? ? $$($(2)_DIR)/.stamp_downloaded +$(2)_TARGET_UNINSTALL = ? ? ? ? ? ? ? ?$$($(2)_DIR)/.stamp_uninstalled +$(2)_TARGET_CLEAN = ? ? ? ? ? ?$$($(2)_DIR)/.stamp_cleaned +$(2)_TARGET_DIRCLEAN = ? ? ? ? $$($(2)_DIR)/.stamp_dircleaned + +# default extract command +$(2)_EXTRACT_CMDS ?= \ + ? ? ? $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $(DL_DIR)/$$($(2)_SOURCE) | \ + ? ? ? $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -) + +# post-steps hooks +$(2)_POST_DOWNLOAD_HOOKS ? ? ? ??= +$(2)_POST_EXTRACT_HOOKS ? ? ? ? ?= +$(2)_PRE_PATCH_HOOKS ? ? ? ? ? ??= +$(2)_POST_PATCH_HOOKS ? ? ? ? ? ?= +$(2)_PRE_CONFIGURE_HOOKS ? ? ? ??= +$(2)_POST_CONFIGURE_HOOKS ? ? ? ?= +$(2)_POST_BUILD_HOOKS ? ? ? ? ? ?= +$(2)_POST_INSTALL_HOOKS ? ? ? ? ?= +$(2)_POST_INSTALL_STAGING_HOOKS ?= +$(2)_POST_INSTALL_TARGET_HOOKS ??= +$(2)_POST_INSTALL_IMAGES_HOOKS ??= + +# human-friendly targets and target sequencing +$(1): ? ? ? ? ? ? ? ? ?$(1)-install + +ifeq ($$($(2)_TYPE),host) +$(1)-install: ? ? ? ? ?$(1)-install-host +else +$(1)-install: ? ? ? ? ?$(1)-install-staging $(1)-install-target $(1)-install-images +endif + +ifeq ($$($(2)_INSTALL_TARGET),YES) +$(1)-install-target: ? $(1)-build \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_TARGET) +else +$(1)-install-target: +endif + +ifeq ($$($(2)_INSTALL_STAGING),YES) +$(1)-install-staging: ?$(1)-build \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_STAGING) +else +$(1)-install-staging: +endif + +ifeq ($$($(2)_INSTALL_IMAGES),YES) +$(1)-install-images: ? $(1)-build \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_INSTALL_IMAGES) +else +$(1)-install-images: +endif + +$(1)-install-host: ? ? ?$(1)-build $$($(2)_TARGET_INSTALL_HOST) + +$(1)-build: ? ? ? ? ? ?$(1)-configure \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_BUILD) + +ifeq ($$($(2)_OVERRIDE_SRCDIR),) +# In the normal case (no package override), the sequence of steps is +# ?source, by downloading +# ?depends +# ?extract +# ?patch +# ?configure +$(1)-configure: ? ? ? ? ? ? ? ?$(1)-patch $(1)-depends \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CONFIGURE) + +$(1)-patch: ? ? ? ? ? ?$(1)-extract $$($(2)_TARGET_PATCH) + +$(1)-extract: ? ? ? ? ?$(1)-source \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_EXTRACT) + +$(1)-depends: ? ? ? ? ?$$($(2)_DEPENDENCIES) + +$(1)-source: ? ? ? ? ? $$($(2)_TARGET_SOURCE) +else +# In the package override case, the sequence of steps +# ?source, by rsyncing +# ?depends +# ?configure +$(1)-configure: ? ? ? ? ? ? ? ?$(1)-depends \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CONFIGURE) + +$(1)-depends: ? ? ? ? ?$(1)-rsync $$($(2)_DEPENDENCIES) + +$(1)-rsync: ? ? ? ? ? ?$$($(2)_TARGET_RSYNC) + +$(1)-source: ? ? ? ? ? $$($(2)_TARGET_RSYNC_SOURCE) +endif + +$(1)-show-depends: + ? ? ? ? ? ? ? ? ? ? ? @echo $$($(2)_DEPENDENCIES) + +$(1)-uninstall: ? ? ? ? ? ? ? ?$(1)-configure $$($(2)_TARGET_UNINSTALL) + +$(1)-clean: ? ? ? ? ? ?$(1)-uninstall \ + ? ? ? ? ? ? ? ? ? ? ? $$($(2)_TARGET_CLEAN) + +$(1)-dirclean: ? ? ? ? $$($(2)_TARGET_DIRCLEAN) + +$(1)-clean-for-rebuild: +ifneq ($$($(2)_OVERRIDE_SRCDIR),) + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_RSYNC) +endif + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_BUILD) + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_STAGING) + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_TARGET) + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_IMAGES) + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_INSTALL_HOST) + +$(1)-rebuild: ? ? ? ? ?$(1)-clean-for-rebuild all + +$(1)-clean-for-reconfigure: $(1)-clean-for-rebuild + ? ? ? ? ? ? ? ? ? ? ? rm -f $$($(2)_TARGET_CONFIGURE) + +$(1)-reconfigure: ? ? ?$(1)-clean-for-reconfigure all + +# define the PKG variable for all targets, containing the +# uppercase package variable prefix +$$($(2)_TARGET_INSTALL_TARGET): ? ? ? ? ? ? ? ?PKG=$(2) +$$($(2)_TARGET_INSTALL_STAGING): ? ? ? PKG=$(2) +$$($(2)_TARGET_INSTALL_IMAGES): ? ? ? ? ? ? ? ?PKG=$(2) +$$($(2)_TARGET_INSTALL_HOST): ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_BUILD): ? ? ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_CONFIGURE): ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_RSYNC): ? ? ? ? ? ? ? ? ?SRCDIR=$$($(2)_OVERRIDE_SRCDIR) +$$($(2)_TARGET_RSYNC): ? ? ? ? ? ? ? ? ?PKG=$(2) +$$($(2)_TARGET_RSYNC_SOURCE): ? ? ? ? ?SRCDIR=$$($(2)_OVERRIDE_SRCDIR) +$$($(2)_TARGET_RSYNC_SOURCE): ? ? ? ? ?PKG=$(2) +$$($(2)_TARGET_PATCH): ? ? ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_PATCH): ? ? ? ? ? ? ? ? RAWNAME=$(patsubst host-%,%,$(1)) +$$($(2)_TARGET_EXTRACT): ? ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_SOURCE): ? ? ? ? ? ? ? ? ? ? ? ?PKG=$(2) +$$($(2)_TARGET_UNINSTALL): ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_CLEAN): ? ? ? ? ? ? ? ? PKG=$(2) +$$($(2)_TARGET_DIRCLEAN): ? ? ? ? ? ? ?PKG=$(2) + +# Compute the name of the Kconfig option that correspond to the +# package being enabled. We handle three cases: the special Linux +# kernel case, the bootloaders case, and the normal packages case. +ifeq ($(1),linux) +$(2)_KCONFIG_VAR = BR2_LINUX_KERNEL +else ifeq ($(4),boot/) +$(2)_KCONFIG_VAR = BR2_TARGET_$(2) +else +$(2)_KCONFIG_VAR = BR2_PACKAGE_$(2) +endif + +# add package to the general list of targets if requested by the buildroot +# configuration +ifeq ($$($$($(2)_KCONFIG_VAR)),y) + +TARGETS += $(1) +PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep) +PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep) + +ifeq ($$($(2)_SITE_METHOD),svn) +DL_TOOLS_DEPENDENCIES += svn +else ifeq ($$($(2)_SITE_METHOD),git) +DL_TOOLS_DEPENDENCIES += git +else ifeq ($$($(2)_SITE_METHOD),bzr) +DL_TOOLS_DEPENDENCIES += bzr +else ifeq ($$($(2)_SITE_METHOD),scp) +DL_TOOLS_DEPENDENCIES += scp ssh +else ifeq ($$($(2)_SITE_METHOD),hg) +DL_TOOLS_DEPENDENCIES += hg +endif # SITE_METHOD + +DL_TOOLS_DEPENDENCIES += $(firstword $(INFLATE$(suffix $($(2)_SOURCE)))) + +endif # $(2)_KCONFIG_VAR +endef # GENTARGETS_INNER + +################################################################################ +# GENTARGETS -- the target generator macro for generic packages +# +# Argument 1 is "target" or "host" ? ? ? ? ? [optional, default: "target"] +################################################################################ + +define GENTARGETS +ifeq ($(1),host) +# In the case of host packages, turn the package name "pkg" into "host-pkg" +$(call GENTARGETS_INNER,$(1)-$(call pkgname),$(call UPPERCASE,$(1)-$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),host) +else +# In the case of target packages, keep the package name "pkg" +$(call GENTARGETS_INNER,$(call pkgname),$(call UPPERCASE,$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),target) +endif +endef + +# :mode=makefile:package/pkg-utils.mk new file +72
-1@@ -0,0 +1,72 @@ +# UPPERCASE Macro -- transform its argument to uppercase and replace dots and +# hyphens to underscores + +# Heavily inspired by the up macro from gmsl (http://gmsl.sf.net) +# This is approx 5 times faster than forking a shell and tr, and +# as this macro is used a lot it matters +# This works by creating translation character pairs (E.G. a:A b:B) +# and then looping though all of them running $(subst from,to,text) +[FROM] := a b c d e f g h i j k l m n o p q r s t u v w x y z . - +[TO] ? := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ _ + +UPPERCASE = $(strip $(eval __tmp := $1) \ + ? ? $(foreach c, $(join $(addsuffix :,$([FROM])),$([TO])), \ + ? ? ? $(eval __tmp := \ + ? ? ? ? ? ? ? $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),\ + ? ? ? ? ? ? ? ? ? ? ? $(__tmp)))) \ + ? ? $(__tmp)) + +define KCONFIG_ENABLE_OPT + ? ? ? $(SED) "/\\<$(1)\\>/d" $(2) + ? ? ? echo "$(1)=y" >> $(2) +endef + +define KCONFIG_SET_OPT + ? ? ? $(SED) "/\\<$(1)\\>/d" $(3) + ? ? ? echo "$(1)=$(2)" >> $(3) +endef + +define KCONFIG_DISABLE_OPT + ? ? ? $(SED) "/\\<$(1)\\>/d" $(2) + ? ? ? echo "# $(1) is not set" >> $(2) +endef + +# Helper functions to determine the name of a package and its +# directory from its makefile directory, using the $(MAKEFILE_LIST) +# variable provided by make. This is used by the *TARGETS macros to +# automagically find where the package is located. Note that the +# pkgdir macro is carefully written to handle the case of the Linux +# package, for which the package directory is an empty string. +define pkgdir +$(dir $(lastword $(MAKEFILE_LIST))) +endef + +define pkgname +$(lastword $(subst /, ,$(call pkgdir))) +endef + +define pkgparentdir +$(patsubst %$(call pkgname)/,%,$(call pkgdir)) +endef + +# Define extractors for different archive suffixes +INFLATE.bz2 ?= $(BZCAT) +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 +MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" +TERM_BOLD := $(shell tput smso) +TERM_RESET := $(shell tput rmso) + + +# Needed for the foreach loops to loop over the list of hooks, so that +# each hook call is properly separated by a newline. +define sep + + +endef --1.7.4.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 8/13 pkg-*.mk: add some comments, update some existing comments
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 102 lines
---
?package/pkg-autotargets.mk | ? ?4 +--- ?package/pkg-download.mk ? ?| ? ?9 +++++++++ ?package/pkg-gentargets.mk ?| ? 10 ++++------ ?package/pkg-utils.mk ? ? ? | ? 13 +++++++++++++?4 files changed, 27 insertions(+), 9 deletions(-)
package/pkg-autotargets.mk +0
-0@@ -3,9 +3,7 @@?#
?# This file implements an infrastructure that eases development of ?# package .mk files for autotools packages. It should be used for allpackage/pkg-autotargets.mk +1
-3-# packages that use the autotools as their build system. Non-autotools -# packages should use the generic infrastructure in -# package/Makefile.package.in. +# packages that use the autotools as their build system.?#
?# See the Buildroot documentation for details on the usage of this ?# infrastructurepackage/pkg-download.mk +9
-0@@ -1,3 +1,12 @@ +############################################################################ +# +# This file contains the download helpers for the various package +# infrastructures. It is used to handle downloads from HTTP servers, +# FTP servers, Git repositories, Subversion repositories, Mercurial +# repositories, Bazaar repositories, and SCP servers. +# +############################################################################ +?# Download method commands
?WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET)
?SVN:=$(call qstrip,$(BR2_SVN))package/pkg-gentargets.mk +0
-0@@ -2,9 +2,10 @@?# Generic package infrastructure
?#
?# This file implements an infrastructure that eases development ofpackage/pkg-gentargets.mk +4
-3-# package .mk files. It should be used for all non-autotools based -# packages. Autotools-based packages should use the specialized -# autotools infrastructure in package/Makefile.autotools.in. +# package .mk files. It should be used for packages that do not rely +# on a well-known build system for which Buildroot has a dedicated +# infrastructure (so far, Buildroot has special support for +# autotools-based and CMake-based packages).?#
?# See the Buildroot documentation for details on the usage of this ?# infrastructurepackage/pkg-gentargets.mk +0
-0@@ -17,9 +18,6 @@?#
?# ? 2. Description of the commands to be executed to configure, build ?# ? ? ?and install the packagepackage/pkg-gentargets.mk +0
-3-# -# The autotools infrastructure specializes this generic infrastructure -# by already implementing the configure, build and install steps.?################################################################################
?################################################################################
package/pkg-utils.mk +7
-0@@ -1,3 +1,10 @@ +############################################################################ +# +# This file contains various utility functions used by the package +# infrastructure, or by the packages themselves. +# +############################################################################ +?# UPPERCASE Macro -- transform its argument to uppercase and replace dots and ?# hyphens to underscores
package/pkg-utils.mk +6
-0@@ -16,6 +23,12 @@ UPPERCASE = $(strip $(eval __tmp := $1) \ ? ? ? ? ? ? ? ? ? ? ? ?$(__tmp)))) \ ? ? ?$(__tmp)) +# +# Manipulation of .config files based on the Kconfig +# infrastructure. Used by the Busybox package, the Linux kernel +# package, and more. +# +?define
KCONFIG_ENABLE_OPT
? ? ? ?$(SED) "/\\<$(1)\\>/d" $(2)
? ? ? ?echo "$(1)=y" >> $(2)
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 9/13 Remove unused .fakeroot.* mechanism
In reply to Thomas PetazzoniQuoted 14 lines · Thomas Petazzoni
There used to be a mechanism using which packages could leave a .fakeroot.<something> file which could contain commands to be executed within the fakeroot environment. Since this mechanism is no longer used by any package, remove it from the common infrastructure.
The latest user was nfs-utils, which used this mechanism to do the "make install" as root, since doing otherwise was not supported. But since
16e7b8255c82815126a2c502c3787d442d254a86, nfs-utils has been upgraded and converted to the package infrastructure, and this hack is no longer necessary. Another past user was the ltp-testsuite package, for the same reason, and sincea72a670489547a3ca645ff7c3a0d9c3fb66eab51, the fakeroot hack is no longer needed.
Quoted 1 line
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 70 lines
---
?Makefile ? ? ? ? ? ? ?| ? ?6 ------ ?fs/common.mk ? ? ? ? ?| ? ?2 -- ?fs/iso9660/iso9660.mk | ? ?2 --?3 files changed, 0 insertions(+), 10 deletions(-)
Makefile +0
-0@@ -301,8 +301,6 @@ endif?include
fs/common.mkMakefile +0
-2-TARGETS+=erase-fakeroots -?TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) ?TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS)) ?TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Makefile +0
-1@@ -391,7 +389,6 @@ $(BUILD_DIR)/.root: ? ? ? ? ? ? ? ?if [ -d "$(TARGET_SKELETON)" ]; then \ ? ? ? ? ? ? ? ? ? ? ? ?cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ ? ? ? ? ? ? ? ?fi; \ - ? ? ? ? ? ? ? touch $(STAGING_DIR)/.fakeroot.00000; \? ? ? ?fi
? ? ? ?-find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf ? ? ? ?-find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rfMakefile +0
-0@@ -399,9 +396,6 @@ $(BUILD_DIR)/.root:?$(TARGET_DIR): $(BUILD_DIR)/.root
Makefile +0
-3-erase-fakeroots: - ? ? ? rm -f $(BUILD_DIR)/.fakeroot* -?target-finalize:
?ifeq ($(BR2_HAVE_DEVFILES),y)
? ? ? ?(support/scripts/copy.sh$(STAGING_DIR) $(TARGET_DIR) )fs/common.mk +0
-2@@ -45,8 +45,6 @@ $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES) ? ? ? ?@$(call MESSAGE,"Generating root filesystem image rootfs.$(1)") ? ? ? ?$(foreach hook,$(ROOTFS_$(2)_PRE_GEN_HOOKS),$(call $(hook))$(sep)) ? ? ? ?rm -f $(FAKEROOT_SCRIPT) - ? ? ? touch $(BUILD_DIR)/.fakeroot.00000 - ? ? ? cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT) ? ? ? ?echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) ?ifneq ($(ROOTFS_DEVICE_TABLES),) ? ? ? ?cat $(ROOTFS_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)fs/iso9660/iso9660.mk +0
-0@@ -25,8 +25,6 @@ $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux rootfs-ext2 grub? ? ? ?cp $(BINARIES_DIR)/rootfs.ext2 $(ISO9660_TARGET_DIR)/initrd
? ? ? ?# Use fakeroot to pretend all target binaries are owned by root
? ? ? ?rm -f $(FAKEROOT_SCRIPT)
- ? ? ? touch $(BUILD_DIR)/.fakeroot.00000
- ? ? ? cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT)
? ? ? ?echo "chown -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
? ? ? ?# Use fakeroot so mkisofs believes the previous fakery
? ? ? ?echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 10/13 Move the manual build infrastructure to docs/manual/manual.mk
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 127 lines
---
?Makefile ? ? ? ? ? ? ?| ? 49 +------------------------------------------------ ?docs/manual/manual.mk | ? 48 ++++++++++++++++++++++++++++++++++++++++++++++++ ?2 files changed, 49 insertions(+), 48 deletions(-)
?create mode 100644docs/manual/manual.mkMakefile +0
-0@@ -679,54 +679,7 @@ release:? ? ? ?bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
? ? ? ?rm -rf $(OUT) $(OUT).tarMakefile +1
-48-################################################################################ -# GENDOC -- generates the make targets needed to build a specific type of -# ? ? ? ? ? asciidoc documentation. -# -# ?argument 1 is the name of the document and must be a subdirectory of docs/; -# ? ? ? ? ? ? the top-level asciidoc file must have the same name -# ?argument 2 is the type of document to generate (-f argument of a2x) -# ?argument 3 is the document type as used in the make target -# ?argument 4 is the output file extension for the document type -# ?argument 5 is the human text for the document type -# ?argument 6 (optional) are extra arguments for a2x -# -# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. -################################################################################ -define GENDOC_INNER -$(1): $(1)-$(3) -.PHONY: $(1)-$(3) -$(1)-$(3): $$(O)/docs/$(1)/$(1).$(4) - -$$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt $$($(call UPPERCASE,$(1))_SOURCES) - ? ? ? @echo "Generating $(5) $(1)..." - ? ? ? $(Q)mkdir -p $$(@D) - ? ? ? $(Q)a2x $(6) -f $(2) -d book -L -r $(TOPDIR)/docs/images \ - ? ? ? ? -D $$(@D) $$< -endef - -################################################################################ -# GENDOC -- generates the make targets needed to build asciidoc documentation. -# -# ?argument 1 is the name of the document and must be a subdirectory of docs/; -# ? ? ? ? ? ? the top-level asciidoc file must have the same name -# -# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. -################################################################################ -define GENDOC -$(call GENDOC_INNER,$(1),xhtml,html,html,HTML) -$(call GENDOC_INNER,$(1),chunked,split-html,chunked,Split HTML) -$(call GENDOC_INNER,$(1),pdf,pdf,pdf,PDF,--dblatex-opts "-P latex.output.revhistory=0") -$(call GENDOC_INNER,$(1),text,txt,text,Text) -$(call GENDOC_INNER,$(1),epub,epub,epub,EPUB) -clean: clean-$(1) -clean-$(1): - ? ? ? $(Q)$(RM) -rf $(O)/docs/$(1) -.PHONY: $(1) clean-$(1) -endef - -MANUAL_SOURCES = $(wildcard docs/manual/*.txt) $(wildcard docs/images/*) -$(eval $(call GENDOC,manual)) +include docs/manual/manual.mk?.PHONY: $(noconfig_targets)
docs/manual/manual.mk new file +48
-1@@ -0,0 +1,48 @@ +################################################################################ +# GENDOC -- generates the make targets needed to build a specific type of +# ? ? ? ? ? asciidoc documentation. +# +# ?argument 1 is the name of the document and must be a subdirectory of docs/; +# ? ? ? ? ? ? the top-level asciidoc file must have the same name +# ?argument 2 is the type of document to generate (-f argument of a2x) +# ?argument 3 is the document type as used in the make target +# ?argument 4 is the output file extension for the document type +# ?argument 5 is the human text for the document type +# ?argument 6 (optional) are extra arguments for a2x +# +# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. +################################################################################ +define GENDOC_INNER +$(1): $(1)-$(3) +.PHONY: $(1)-$(3) +$(1)-$(3): $$(O)/docs/$(1)/$(1).$(4) + +$$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt $$($(call UPPERCASE,$(1))_SOURCES) + ? ? ? @echo "Generating $(5) $(1)..." + ? ? ? $(Q)mkdir -p $$(@D) + ? ? ? $(Q)a2x $(6) -f $(2) -d book -L -r $(TOPDIR)/docs/images \ + ? ? ? ? -D $$(@D) $$< +endef + +################################################################################ +# GENDOC -- generates the make targets needed to build asciidoc documentation. +# +# ?argument 1 is the name of the document and must be a subdirectory of docs/; +# ? ? ? ? ? ? the top-level asciidoc file must have the same name +# +# The variable <DOCUMENT_NAME>_SOURCES defines the dependencies. +################################################################################ +define GENDOC +$(call GENDOC_INNER,$(1),xhtml,html,html,HTML) +$(call GENDOC_INNER,$(1),chunked,split-html,chunked,Split HTML) +$(call GENDOC_INNER,$(1),pdf,pdf,pdf,PDF,--dblatex-opts "-P latex.output.revhistory=0") +$(call GENDOC_INNER,$(1),text,txt,text,Text) +$(call GENDOC_INNER,$(1),epub,epub,epub,EPUB) +clean: clean-$(1) +clean-$(1): + ? ? ? $(Q)$(RM) -rf $(O)/docs/$(1) +.PHONY: $(1) clean-$(1) +endef + +MANUAL_SOURCES = $(wildcard docs/manual/*.txt) $(wildcard docs/images/*) +$(eval $(call GENDOC,manual)) --1.7.4.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 11/13 cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
In reply to Thomas PetazzoniQuoted 54 lines · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>---
?Makefile ? ? ? ? ? ? ? ? ? ?| ? 17 ----------------- ?package/pkg-cmaketargets.mk | ? 22 ++++++++++++++++++++++ ?2 files changed, 22 insertions(+), 17 deletions(-)Makefile +0
-17@@ -339,23 +339,6 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf ?world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL) -$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake: - ? ? ? mkdir -p $(@D) - ? ? ? @echo -en "\ - ? ? ? set(CMAKE_SYSTEM_NAME Linux)\n\ - ? ? ? set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\ - ? ? ? set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\ - ? ? ? set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\ - ? ? ? set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\ - ? ? ? set(CMAKE_INSTALL_SO_NO_EXE 0)\n\ - ? ? ? set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\ - ? ? ? set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\ - ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\ - ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\ - ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\ - ? ? ? set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\ - ? ? ? " > $@ - ?.PHONY: all world dirs clean distclean source outputmakefile \ ? ? ? ?$(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ ? ? ? ?$(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \package/pkg-cmaketargets.mk +0
-0@@ -197,3 +197,25 @@ else ?$(call CMAKETARGETS_INNER,$(call pkgname),$(call UPPERCASE,$(call pkgname)),$(call UPPERCASE,$(call pkgname)),$(call pkgparentdir),target)?endif
?endefpackage/pkg-cmaketargets.mk +12
-0+ +################################################################################ +# Generation of the CMake toolchain file +################################################################################ + +$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake: + ? ? ? @mkdir -p $(@D) + ? ? ? @echo -en "\ + ? ? ? set(CMAKE_SYSTEM_NAME Linux)\n\ + ? ? ? set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\ + ? ? ? set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\ + ? ? ? set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
package/pkg-cmaketargets.mk
Quoted 10 lines
package/pkg-cmaketargets.mk +10
-0+ ? ? ? set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\ + ? ? ? set(CMAKE_INSTALL_SO_NO_EXE 0)\n\ + ? ? ? set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\ + ? ? ? set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\ + ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\ + ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\ + ? ? ? set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\ + ? ? ? set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\ + ? ? ? " > $@ +
Currently, BASE_TARGETS is still:
$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
Now that the recipe for toolchainfile.cmake has moved, I find it a bit strange that the 'magic' path to this file still appears here. What about creating a nicer name and using that in BASE_TARGETS, and let the pkg-cmaketargets.mk file resolve the nice name into the actual path?
Quoted 7 lines
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 12/13 package: remove unused STRIP_DISCARD_ALL variable
In reply to Thomas PetazzoniQuoted 1 line · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>
Quoted 31 lines
---
?package/Makefile.in | ? ?2 --
?1 files changed, 0 insertions(+), 2 deletions(-)package/Makefile.in +0
-0@@ -126,7 +126,6 @@ TARGET_CXX := $(CCACHE) $(TARGET_CXX)?endif
?ifeq ($(BR2_STRIP_strip),y)
-STRIP_DISCARD_ALL:=--discard-all
?STRIP_STRIP_UNNEEDED:=--strip-unneeded
?STRIP_STRIP_ALL:=--strip-all
?TARGET_STRIP=$(TARGET_CROSS)strippackage/Makefile.in +0
-0@@ -134,7 +133,6 @@ STRIPCMD=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note ?KSTRIPCMD=$(STRIPCMD) $(STRIP_STRIP_UNNEEDED)?endif
?ifeq ($(BR2_STRIP_sstrip),y)
-STRIP_DISCARD_ALL:=
?STRIP_STRIP_UNNEEDED:=
?STRIP_STRIP_ALL:= ?TARGET_STRIP=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip --
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 13/13 package: move autotools specific stuff to pkg-autotargets.mk
In reply to Thomas PetazzoniQuoted 168 lines · Thomas Petazzoni
Signed-off-by Thomas Petazzoni <[email protected]>---
?package/Makefile.in ? ? ? ?| ? 73 -------------------------------------------- ?package/pkg-autotargets.mk | ? 70 ++++++++++++++++++++++++++++++++++++++++++ ?2 files changed, 70 insertions(+), 73 deletions(-)package/Makefile.in +0
-0@@ -223,79 +223,6 @@ HOST_MAKE_ENV=PATH=$(HOST_PATH) \ ? ? ? ? ? ? ? ?PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \? ? ? ? ? ? ? ?PERLLIB="$(HOST_DIR)/usr/lib/perl"
package/Makefile.in +0
-73- -####################################################################### -# settings we need to pass to configure - -# does unaligned access trap? -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=yes -ifeq ($(BR2_i386),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_x86_64),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_m68k),y) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif -ifeq ($(BR2_powerpc)$(BR2_ENDIAN),yBIG) -BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no -endif - -ifeq ($(BR2_ENDIAN),"BIG") -BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=yes -else -BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=no -endif - -TARGET_CONFIGURE_ARGS= \ - ? ? ? $(BR2_AC_CV_TRAP_CHECK) \ - ? ? ? ac_cv_func_mmap_fixed_mapped=yes \ - ? ? ? ac_cv_func_memcmp_working=yes \ - ? ? ? ac_cv_have_decl_malloc=yes \ - ? ? ? gl_cv_func_malloc_0_nonnull=yes \ - ? ? ? ac_cv_func_malloc_0_nonnull=yes \ - ? ? ? ac_cv_func_calloc_0_nonnull=yes \ - ? ? ? ac_cv_func_realloc_0_nonnull=yes \ - ? ? ? lt_cv_sys_lib_search_path_spec="" \ - ? ? ? $(BR2_AC_CV_C_BIGENDIAN) - -####################################################################### - -ifeq ($(BR2_ENABLE_LOCALE),y) -DISABLE_NLS:= -else -DISABLE_NLS:=--disable-nls -endif - -ifneq ($(BR2_LARGEFILE),y) -DISABLE_LARGEFILE= --disable-largefile -endif - -ifneq ($(BR2_HAVE_DOCUMENTATION),y) -DISABLE_DOCUMENTATION=--disable-gtk-doc -endif - -ifneq ($(BR2_INET_IPV6),y) -DISABLE_IPV6= --disable-ipv6 -endif - -ifneq ($(BR2_INSTALL_LIBSTDCPP),y) -TARGET_CONFIGURE_OPTS+=CXX=false -endif - -ifeq ($(BR2_ENABLE_DEBUG),y) -ENABLE_DEBUG:=--enable-debug -else -ENABLE_DEBUG:= -endif - -ifeq ($(BR2_PREFER_STATIC_LIB),y) -SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared -else -SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared -endif -?include
package/pkg-utils.mk
?includepackage/pkg-download.mk
?includepackage/pkg-autotargets.mkpackage/pkg-autotargets.mk +0
-0@@ -36,6 +36,76 @@ define CONFIG_UPDATE? ? ? ?done
?endefpackage/pkg-autotargets.mk +70
-0+# +# Calculate values of well-known settings for configure scripts +# + +# does unaligned access trap? +BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=yes +ifeq ($(BR2_i386),y) +BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no +else ifeq ($(BR2_x86_64),y) +BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no +else ifeq ($(BR2_m68k),y) +BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no +else ifeq ($(BR2_powerpc)$(BR2_ENDIAN),yBIG) +BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no +endif + +ifeq ($(BR2_ENDIAN),"BIG") +BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=yes +else +BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=no +endif + +TARGET_CONFIGURE_ARGS= \ + ? ? ? $(BR2_AC_CV_TRAP_CHECK) \ + ? ? ? ac_cv_func_mmap_fixed_mapped=yes \ + ? ? ? ac_cv_func_memcmp_working=yes \ + ? ? ? ac_cv_have_decl_malloc=yes \ + ? ? ? gl_cv_func_malloc_0_nonnull=yes \ + ? ? ? ac_cv_func_malloc_0_nonnull=yes \ + ? ? ? ac_cv_func_calloc_0_nonnull=yes \ + ? ? ? ac_cv_func_realloc_0_nonnull=yes \ + ? ? ? lt_cv_sys_lib_search_path_spec="" \ + ? ? ? $(BR2_AC_CV_C_BIGENDIAN) + +# Calculate values of well-known configure script options + +ifeq ($(BR2_ENABLE_LOCALE),y) +DISABLE_NLS:= +else +DISABLE_NLS:=--disable-nls +endif + +ifneq ($(BR2_LARGEFILE),y) +DISABLE_LARGEFILE= --disable-largefile +endif + +ifneq ($(BR2_HAVE_DOCUMENTATION),y) +DISABLE_DOCUMENTATION=--disable-gtk-doc +endif + +ifneq ($(BR2_INET_IPV6),y) +DISABLE_IPV6= --disable-ipv6 +endif + +ifneq ($(BR2_INSTALL_LIBSTDCPP),y) +TARGET_CONFIGURE_OPTS+=CXX=false +endif + +ifeq ($(BR2_ENABLE_DEBUG),y) +ENABLE_DEBUG:=--enable-debug +else +ENABLE_DEBUG:= +endif + +ifeq ($(BR2_PREFER_STATIC_LIB),y) +SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared +else +SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared +endif +
Quoted 3 lines
?################################################################################ ?#
AUTOTARGETS_INNER-- defines how the configuration, compilation and ?# installation of an autotools package should be done, implements a
Ok for the BR2_AC_BV_... move.
The last defines like DISABLE_NLS, DISABLE_LARGEFILES, ... are sometimes used outside of autotargets, e.g. in ./toolchain/gcc/gcc-uclibc-4.x.mk, toolchain/gdb/gdb.mk, ./package/newt/newt.mk.
I'm not sure if it's a good idea to move them, based on that observation.
Quoted 7 lines
--
1.7.4.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Hi Thomas,
Quoted 9 lines · Thomas Petazzoni
Hello,
Here is a set of proposal that cleanup/re-organize a few parts of our main Makefiles. This is just the beginning of a cleanup of
Makefile, package/Makefile.in and some other core parts of the infrastructure. Before going further, I'd like to see if the direction I'm taking is something that is considered to be useful and interesting.
Quoted 3 lines
This set of patches is at the Request For Comment state, they are not yet intended to be committed, I need to do some further testing. The purpose is really to get some early feedback about them.
Thanks for this cleanup. I think the reorganization of the *targets infrastructure and the move of its related bits from other files will certainly make the whole cleaner. And I also like the removal of the unneeded variables.
I tried validating these patches by grepping/reviewing the code, and I don't really expect surprises related to broken stuff. But of course, it's good that you do some further testing.
Best regards,
Thomas
PATCH 5/13 Rename Makefile.autotools.in to pkg-autotargets.mk
In reply to Thomas De SchampheleireHello,
Thanks for your review!
Le Fri, 9 Mar 2012 07:35:43 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :
Quoted 1 line
In addition you should fix the comment
Hum, which comment are you talking about here?
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 11/13 cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
In reply to Thomas De SchampheleireLe Fri, 9 Mar 2012 07:54:32 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :
Quoted 9 lines
Currently,
BASE_TARGETSis still:
$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmakeNow that the recipe for toolchainfile.cmake has moved, I find it a bit strange that the 'magic' path to this file still appears here. What about creating a nicer name and using that in
BASE_TARGETS, and let the pkg-cmaketargets.mk file resolve the nice name into the actual path?
Something like:
CMAKE_TOOLCHAIN_FILE=$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
in pkg-cmaketargets.mk
and then in the main Makefile:
$(BASE_TARGETS): dirs $(CMAKE_TOOLCHAIN_FILE)
Is this what you're suggesting?
Best 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
PATCH 13/13 package: move autotools specific stuff to pkg-autotargets.mk
In reply to Thomas De SchampheleireHello,
Le Fri, 9 Mar 2012 08:01:54 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :
Quoted 9 lines
Ok for the
BR2_AC_BV_... move.The last defines like
DISABLE_NLS,DISABLE_LARGEFILES, ... are sometimes used outside of autotargets, e.g. in./toolchain/gcc/gcc-uclibc-4.x.mk,toolchain/gdb/gdb.mk,./package/newt/newt.mk.I'm not sure if it's a good idea to move them, based on that observation.
Yes, I agree that this patch can definitely be discussed. I am not totally sure myself that it is a good idea.
In the same way, the TARGET_CONFIGURE_OPTS, HOST_CONFIGURE_OPTS, TARGET_MAKE_ENV and HOST_MAKE_ENV are somewhat specific to autotools, but in fact used in many other locations as well.
In general, my goal is to cut down on the size, complexity and messiness of /Makefile and /package/Makefile.in. Suggestions are welcome.
Best 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
Le Fri, 9 Mar 2012 08:06:23 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :
Quoted 8 lines
Thanks for this cleanup. I think the reorganization of the *targets infrastructure and the move of its related bits from other files will certainly make the whole cleaner. And I also like the removal of the unneeded variables.
I tried validating these patches by grepping/reviewing the code, and I don't really expect surprises related to broken stuff. But of course, it's good that you do some further testing.
And still: I did test them a bit yesterday, and it seems they were some problems (but I didn't investigate too much, my testing was
unintentional: I had forgotten to move to another branch to work on a customer project).
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 5/13 Rename Makefile.autotools.in to pkg-autotargets.mk
In reply to Thomas PetazzoniQuoted 10 lines · Thomas Petazzoni
Hello,
Thanks for your review!
Le Fri, 9 Mar 2012 07:35:43 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :Quoted 1 line
In addition you should fix the comment
Hum, which comment are you talking about here?
Ai, I forgot to delete this line. I was referring to the comment in package/Makefile.package.in that mentions 'package/Makefile.autotools.in'. While writing this mail I realized that you actually did that change in another patch...
Best regards,
Thomas
PATCH 11/13 cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
In reply to Thomas PetazzoniQuoted 17 lines · Thomas Petazzoni
Le Fri, 9 Mar 2012 07:54:32 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :Quoted 9 lines
Currently,
BASE_TARGETSis still:
$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmakeNow that the recipe for toolchainfile.cmake has moved, I find it a bit strange that the 'magic' path to this file still appears here. What about creating a nicer name and using that in
BASE_TARGETS, and let the pkg-cmaketargets.mk file resolve the nice name into the actual path?Something like:
CMAKE_TOOLCHAIN_FILE=$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
Quoted 7 lines
in pkg-cmaketargets.mk
and then in the main
Makefile:$(BASE_TARGETS): dirs $(CMAKE_TOOLCHAIN_FILE)
Is this what you're suggesting?
Although I was thinking of an actual target, like 'cmake-prepare' or something, using a variable like you suggest above is also fine with me. It's maybe more simple and equally covers my comment.
Best regards,
Thomas
PATCH 13/13 package: move autotools specific stuff to pkg-autotargets.mk
In reply to Thomas PetazzoniQuoted 18 lines · Thomas Petazzoni
Hello,
Le Fri, 9 Mar 2012 08:01:54 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :Quoted 9 lines
Ok for the
BR2_AC_BV_... move.The last defines like
DISABLE_NLS,DISABLE_LARGEFILES, ... are sometimes used outside of autotargets, e.g. in./toolchain/gcc/gcc-uclibc-4.x.mk,toolchain/gdb/gdb.mk,./package/newt/newt.mk.I'm not sure if it's a good idea to move them, based on that observation.
Yes, I agree that this patch can definitely be discussed. I am not totally sure myself that it is a good idea.
Quoted 6 lines
In the same way, the
TARGET_CONFIGURE_OPTS,HOST_CONFIGURE_OPTS,TARGET_MAKE_ENVandHOST_MAKE_ENVare somewhat specific to autotools, but in fact used in many other locations as well.In general, my goal is to cut down on the size, complexity and messiness of /Makefile and /package/Makefile.in. Suggestions are welcome.
We could create one file for target options/defines/... and one for host options/defines, or one file for both.
These could contain the following variables from both Makefile as package/Makefile.in:
TARGET_CONFIGURE_OPTS, HOST_CONFIGURE_OPTS, TARGET_MAKE_ENV, HOST_MAKE_ENV DISABLE_x, ENABLE_xHOST_xFLAGS
HOST<tool>TARGET_xFLAGS
TARGET_<tool>
Then, the 'strategy' is that:
- Makefile handles the top-level targets, the help, and config stuff
- Makefile.in will be almost empty. Currently it still contains the strip stuff, the tool locations for install/sed/flex/bison and the definition of MAKE/HOSTMAKE. We may keep this file or rename it.
- pkg-xtargets.mk contains the rules for the specific build infrastructure
- pkg-download.mk, pkg-utility.mk, and the new file with target/host defines cover each a specific part of the build process.
Best regards,
Thomas
Quoted 8 lines · Thomas Petazzoni
Le Fri, 9 Mar 2012 08:06:23 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :Quoted 5 lines
Thanks for this cleanup. I think the reorganization of the *targets infrastructure and the move of its related bits from other files will certainly make the whole cleaner. And I also like the removal of the unneeded variables.
Quoted 8 lines
Quoted 3 lines
I tried validating these patches by grepping/reviewing the code, and I don't really expect surprises related to broken stuff. But of course, it's good that you do some further testing.
And still: I did test them a bit yesterday, and it seems they were some problems (but I didn't investigate too much, my testing was
unintentional: I had forgotten to move to another branch to work on a customer project).
Ok, let me know what you find...
Hi,
I think the pkg-* makefiles could be moved from the packages directory as they are used by the kernel and bootloaders as well. Maybe move them to the support directory.
Quoted 69 lines · Thomas Petazzoni
Hello,
Here is a set of proposal that cleanup/re-organize a few parts of our main Makefiles. This is just the beginning of a cleanup of
Makefile, package/Makefile.in and some other core parts of the infrastructure. Before going further, I'd like to see if the direction I'm taking is something that is considered to be useful and interesting.This set of patches is at the Request For Comment state, they are not yet intended to be committed, I need to do some further testing. The purpose is really to get some early feedback about them.
Thanks,
Thomas
The following changes since commit
b50f7a832de2801aeee33146ff5a81945f4078c2:?barebox: fix 2012.03 typo (2012-03-07 16:26:50 +0100)
are available in the git repository at:
?git://git.free-electrons.com/users/thomas-petazzoni/buildroot.git for-2012.05/misc-cleanupsThomas Petazzoni (13):
? ? ?Remove the DATE variable
? ? ?Remove cc-option: not used anywhere
? ? ?Remove filename extension crap for OS compatibility
? ? ?kconfig: do not useHOST_LOADLIBESanymore
? ? ?Rename Makefile.autotools.in to pkg-autotargets.mk
? ? ?Rename Makefile.cmake.in to pkg-cmaketargets.mk
? ? ?Split Makefile.package.in in pkg-download.mk, pkg-utils.mk and pkg-gentargets.mk ? ? ?pkg-*.mk: add some comments, update some existing comments
? ? ?Remove unused .fakeroot.* mechanism
? ? ?Move the manual build infrastructure todocs/manual/manual.mk
? ? ?cmake: move creation of toolchain file topackage/pkg-cmaketargets.mk? ? ?package: remove unusedSTRIP_DISCARD_ALLvariable
? ? ?package: move autotools specific stuff to pkg-autotargets.mk?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ?108 +--- ?boot/uboot/uboot.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 - ?docs/manual/manual.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 48 ++ ?fs/common.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 - ?fs/iso9660/iso9660.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 - ?package/Makefile.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 83 +-- ?package/Makefile.package.in ? ? ? ? ? ? ? ? ? ? ? ?| ?746 -------------------- ?.../{Makefile.autotools.in => pkg-autotargets.mk} ?| ? 74 ++- ?package/{Makefile.cmake.in => pkg-cmaketargets.mk} | ? 22 + ?package/pkg-download.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ?221 ++++++ ?package/pkg-gentargets.mk ? ? ? ? ? ? ? ? ? ? ? ? ?| ?456 ++++++++++++ ?package/pkg-utils.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 85 +++ ?support/kconfig/Makefile.br ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +- ?support/kconfig/patches/10-br-build-system.patch ? | ? 12 +-?14 files changed, 917 insertions(+), 947 deletions(-) ?create mode 100644
docs/manual/manual.mk
?delete mode 100644 package/Makefile.package.in
?rename package/{Makefile.autotools.in => pkg-autotargets.mk} (85%) ?rename package/{Makefile.cmake.in => pkg-cmaketargets.mk} (86%) ?create mode 100644package/pkg-download.mk
?create mode 100644package/pkg-gentargets.mk
?create mode 100644package/pkg-utils.mkThanks,
--
Thomas Petazzoni
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Hello,
Le Fri, 9 Mar 2012 10:07:29 -0300,
Alexandre Pereira da Silva <[email protected]> a ?crit :
Quoted 3 lines
I think the pkg-* makefiles could be moved from the packages directory as they are used by the kernel and bootloaders as well. Maybe move them to the support directory.
Yeah, I was also wondering about this. I don't know if support/ is the right place, or if we need yet another top-level directory such as include/ or mk/ or whatever. What are others opinion?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 5 lines · Thomas Petazzoni
Hello,
Le Fri, 9 Mar 2012 10:07:29 -0300,
Alexandre Pereira da Silva <[email protected]> a ?crit :
Quoted 7 lines
Quoted 3 lines
I think the pkg-* makefiles could be moved from the packages directory as they are used by the kernel and bootloaders as well. Maybe move them to the support directory.
Yeah, I was also wondering about this. I don't know if support/ is the right place, or if we need yet another top-level directory such as
include/or mk/ or whatever. What are others opinion?
I don't think support/ is the right place, but I'm not against moving these files elsewhere.
Not sure about the best name though...
Best regards,
Thomas
PATCH 11/13 cmake: move creation of toolchain file to package/pkg-cmaketargets.mk
In reply to Thomas PetazzoniHi Thomas (both), all,
2012/3/9 Thomas Petazzoni <[email protected]>:
Quoted 15 lines
Le Fri, 9 Mar 2012 07:54:32 +0100,
Thomas De Schampheleire <[email protected]> a ?crit :Quoted 9 lines
Currently,
BASE_TARGETSis still:
$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmakeNow that the recipe for toolchainfile.cmake has moved, I find it a bit strange that the 'magic' path to this file still appears here. What about creating a nicer name and using that in
BASE_TARGETS, and let the pkg-cmaketargets.mk file resolve the nice name into the actual path?Something like:
Quoted 7 lines
CMAKE_TOOLCHAIN_FILE=$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
in pkg-cmaketargets.mk
and then in the main
Makefile:$(BASE_TARGETS): dirs $(CMAKE_TOOLCHAIN_FILE)
Having CMAKE_TOOLCHAIN_FILE as a dependency of BASE_TARGET means that the CMAKE_TOOLCHAIN_FILE is generated before the building or import+check of the cross-compiler depending on the chosen backend.
This may leads to some inconsistencies between the toolchain described in CMAKE_TOOLCHAIN_FILE and the actual one.
Regards,
Sam
PATCH 10/13 Move the manual build infrastructure to docs/manual/manual.mk
In reply to Thomas PetazzoniQuoted 6 lines · On Wednesday 07 March 2012 20:34:23 Thomas Petazzoni wrote:
Signed-off-by Thomas Petazzoni <[email protected]>--- Makefile | 49 +------------------------------------------------ docs/manual/manual.mk | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 docs/manual/manual.mk
Since this is generic documentation infrastructure, I'd rather put it indocs/docs.mk. Perhaps including a docs/manual/manual.mk containing the last two lines:
+MANUAL_SOURCES = $(wildcard docs/manual/*.txt) $(wildcard docs/images/*) +$(eval $(call GENDOC,manual))
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 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
Quoted 11 lines · On Friday 09 March 2012 15:18:07 Thomas De Schampheleire wrote:
Quoted 9 lines · Thomas Petazzoni
Hello,
Le Fri, 9 Mar 2012 10:07:29 -0300,
Alexandre Pereira da Silva <[email protected]> a ?crit :Quoted 3 lines
I think the pkg-* makefiles could be moved from the packages directory as they are used by the kernel and bootloaders as well. Maybe move them to the support directory.
Quoted 7 lines
Quoted 3 lines
Yeah, I was also wondering about this. I don't know if support/ is the right place, or if we need yet another top-level directory such as
include/or mk/ or whatever. What are others opinion?I don't think support/ is the right place, but I'm not against moving these files elsewhere.
Not sure about the best name though...
Many projects have a top-level 'mk' or 'make' directory for the common
make infrastructure.
For me, however, support/mk sounds good as well.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 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