2007-08-10 21:07:51 +02:00
|
|
|
################################################################################
|
2009-11-08 18:37:49 +01:00
|
|
|
# Autotools package infrastructure
|
2007-08-10 21:07:51 +02:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
# This file implements an infrastructure that eases development of
|
|
|
|
# package .mk files for autotools packages. It should be used for all
|
2012-04-17 16:45:20 +02:00
|
|
|
# packages that use the autotools as their build system.
|
2007-08-10 21:07:51 +02:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
# See the Buildroot documentation for details on the usage of this
|
|
|
|
# infrastructure
|
2007-08-10 21:07:51 +02:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
# In terms of implementation, this autotools infrastructure requires
|
|
|
|
# the .mk file to only specify metadata informations about the
|
|
|
|
# package: name, version, download URL, etc.
|
2007-09-30 14:46:02 +02:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
# We still allow the package .mk file to override what the different
|
|
|
|
# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
|
|
|
|
# already defined, it is used as the list of commands to perform to
|
|
|
|
# build the package, instead of the default autotools behaviour. The
|
|
|
|
# package can also define some post operation hooks.
|
2007-09-30 14:46:02 +02:00
|
|
|
#
|
2007-08-10 21:07:51 +02:00
|
|
|
################################################################################
|
|
|
|
|
2011-08-31 23:35:06 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Utility function to upgrade config.sub and config.guess files
|
|
|
|
#
|
|
|
|
# argument 1 : directory into which config.guess and config.sub need
|
|
|
|
# to be updated. Note that config.sub and config.guess are searched
|
|
|
|
# recursively in this directory.
|
|
|
|
#
|
|
|
|
define CONFIG_UPDATE
|
|
|
|
for file in config.guess config.sub; do \
|
|
|
|
for i in $$(find $(1) -name $$file); do \
|
|
|
|
cp support/gnuconfig/$$file $$i; \
|
|
|
|
done; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
2014-03-21 05:34:03 +01:00
|
|
|
# This function generates the ac_cv_file_<foo> value for a given
|
|
|
|
# filename. This is needed to convince configure script doing
|
|
|
|
# AC_CHECK_FILE() tests that the file actually exists, since such
|
|
|
|
# tests cannot be done in a cross-compilation context. This function
|
|
|
|
# takes as argument the path of the file. An example usage is:
|
|
|
|
#
|
|
|
|
# FOOBAR_CONF_ENV = \
|
|
|
|
# $(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
|
|
|
|
AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
|
|
|
|
|
2009-01-16 11:27:48 +01:00
|
|
|
################################################################################
|
2012-07-03 00:07:08 +02:00
|
|
|
# inner-autotools-package -- defines how the configuration, compilation and
|
2009-11-08 18:37:49 +01:00
|
|
|
# installation of an autotools package should be done, implements a
|
|
|
|
# few hooks to tune the build process for autotools specifities and
|
|
|
|
# calls the generic package infrastructure to generate the necessary
|
|
|
|
# make targets
|
2009-01-16 11:27:48 +01:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
# 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
|
2014-02-05 10:44:03 +01:00
|
|
|
# argument 4 is the type (target or host)
|
2007-08-10 21:07:51 +02:00
|
|
|
################################################################################
|
|
|
|
|
2012-07-03 00:07:08 +02:00
|
|
|
define inner-autotools-package
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2010-04-28 23:40:45 +02:00
|
|
|
ifndef $(2)_LIBTOOL_PATCH
|
|
|
|
ifdef $(3)_LIBTOOL_PATCH
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$(2)_LIBTOOL_PATCH = $$($(3)_LIBTOOL_PATCH)
|
2010-04-28 23:40:45 +02:00
|
|
|
else
|
|
|
|
$(2)_LIBTOOL_PATCH ?= YES
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-05-17 10:00:01 +02:00
|
|
|
ifndef $(2)_MAKE
|
|
|
|
ifdef $(3)_MAKE
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$(2)_MAKE = $$($(3)_MAKE)
|
2011-05-17 10:00:01 +02:00
|
|
|
else
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$(2)_MAKE ?= $$(MAKE)
|
2011-05-17 10:00:01 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-10-02 23:37:58 +02:00
|
|
|
ifndef $(2)_AUTORECONF
|
|
|
|
ifdef $(3)_AUTORECONF
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$(2)_AUTORECONF = $$($(3)_AUTORECONF)
|
2013-10-02 23:37:58 +02:00
|
|
|
else
|
|
|
|
$(2)_AUTORECONF ?= NO
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-07-17 00:00:35 +02:00
|
|
|
ifndef $(2)_GETTEXTIZE
|
|
|
|
ifdef $(3)_GETTEXTIZE
|
|
|
|
$(2)_GETTEXTIZE = $$($(3)_GETTEXTIZE)
|
|
|
|
else
|
|
|
|
$(2)_GETTEXTIZE ?= NO
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-07-18 23:02:31 +02:00
|
|
|
ifeq ($(4),host)
|
|
|
|
$(2)_GETTEXTIZE_OPT ?= $$($(3)_GETTEXTIZE_OPT)
|
2014-07-17 00:00:35 +02:00
|
|
|
endif
|
|
|
|
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
ifeq ($(4),host)
|
|
|
|
$(2)_AUTORECONF_OPT ?= $$($(3)_AUTORECONF_OPT)
|
|
|
|
endif
|
|
|
|
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_CONF_ENV ?=
|
|
|
|
$(2)_CONF_OPT ?=
|
2007-09-30 14:46:02 +02:00
|
|
|
$(2)_MAKE_ENV ?=
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_MAKE_OPT ?=
|
2013-06-30 21:28:53 +02:00
|
|
|
$(2)_INSTALL_OPT ?= install
|
2007-08-10 21:07:51 +02:00
|
|
|
$(2)_INSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) install
|
2010-03-30 17:20:55 +02:00
|
|
|
$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install
|
2007-08-10 21:07:51 +02:00
|
|
|
|
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Configure step. Only define it if not already defined by the package
|
|
|
|
# .mk file. And take care of the differences between host and target
|
|
|
|
# packages.
|
|
|
|
#
|
|
|
|
ifndef $(2)_CONFIGURE_CMDS
|
2014-02-05 10:44:03 +01:00
|
|
|
ifeq ($(4),target)
|
2009-11-08 18:37:49 +01:00
|
|
|
|
|
|
|
# Configure package for target
|
|
|
|
define $(2)_CONFIGURE_CMDS
|
|
|
|
(cd $$($$(PKG)_SRCDIR) && rm -rf config.cache && \
|
|
|
|
$$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
$$(TARGET_CONFIGURE_ARGS) \
|
|
|
|
$$($$(PKG)_CONF_ENV) \
|
|
|
|
./configure \
|
|
|
|
--target=$$(GNU_TARGET_NAME) \
|
|
|
|
--host=$$(GNU_TARGET_NAME) \
|
|
|
|
--build=$$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--exec-prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
2011-08-10 00:12:34 +02:00
|
|
|
--program-prefix="" \
|
2014-02-05 14:51:00 +01:00
|
|
|
--disable-gtk-doc \
|
|
|
|
--disable-doc \
|
|
|
|
--disable-docs \
|
|
|
|
--disable-documentation \
|
|
|
|
--with-xmlto=no \
|
2014-02-09 01:00:22 +01:00
|
|
|
--with-fop=no \
|
2009-11-08 18:37:49 +01:00
|
|
|
$$(DISABLE_NLS) \
|
|
|
|
$$(DISABLE_LARGEFILE) \
|
|
|
|
$$(DISABLE_IPV6) \
|
package/autotools: add --{enable,disable}-{shared,static} automatically
For target packages, depending on BR2_PREFER_STATIC_LIB, add the
correct combination of --{enable,disable}-{shared,static} flags to
./configure calls.
* When BR2_PREFER_STATIC_LIB is enabled, we pass --enable-static
--disable-shared.
* When BR2_PREFER_STATIC_LIB is disabled, we pass --enable-static
--enable-shared. We enable static libraries since they can still be
useful to statically link applications against some libraries
(sometimes it is useful for size reasons). Static libraries are
anyway only installed in the STAGING_DIR, so it doesn't increase in
any way the size of the TARGET_DIR.
For host packages, always pass --enable-shared and --disable-static.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-30 23:57:02 +02:00
|
|
|
$$(SHARED_STATIC_LIBS_OPTS) \
|
2009-11-08 18:37:49 +01:00
|
|
|
$$(QUIET) $$($$(PKG)_CONF_OPT) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
else
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
# Configure package for host
|
2012-12-12 05:07:22 +01:00
|
|
|
# disable all kind of documentation generation in the process,
|
|
|
|
# because it often relies on host tools which may or may not be
|
|
|
|
# installed.
|
2009-11-08 18:37:49 +01:00
|
|
|
define $(2)_CONFIGURE_CMDS
|
|
|
|
(cd $$($$(PKG)_SRCDIR) && rm -rf config.cache; \
|
|
|
|
$$(HOST_CONFIGURE_OPTS) \
|
|
|
|
CFLAGS="$$(HOST_CFLAGS)" \
|
|
|
|
LDFLAGS="$$(HOST_LDFLAGS)" \
|
2010-04-30 02:24:09 +02:00
|
|
|
$$($$(PKG)_CONF_ENV) \
|
2009-11-08 18:37:49 +01:00
|
|
|
./configure \
|
|
|
|
--prefix="$$(HOST_DIR)/usr" \
|
|
|
|
--sysconfdir="$$(HOST_DIR)/etc" \
|
package/autotools: add --{enable,disable}-{shared,static} automatically
For target packages, depending on BR2_PREFER_STATIC_LIB, add the
correct combination of --{enable,disable}-{shared,static} flags to
./configure calls.
* When BR2_PREFER_STATIC_LIB is enabled, we pass --enable-static
--disable-shared.
* When BR2_PREFER_STATIC_LIB is disabled, we pass --enable-static
--enable-shared. We enable static libraries since they can still be
useful to statically link applications against some libraries
(sometimes it is useful for size reasons). Static libraries are
anyway only installed in the STAGING_DIR, so it doesn't increase in
any way the size of the TARGET_DIR.
For host packages, always pass --enable-shared and --disable-static.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-30 23:57:02 +02:00
|
|
|
--enable-shared --disable-static \
|
2012-12-12 05:07:22 +01:00
|
|
|
--disable-gtk-doc \
|
|
|
|
--disable-doc \
|
|
|
|
--disable-docs \
|
|
|
|
--disable-documentation \
|
|
|
|
--with-xmlto=no \
|
|
|
|
--with-fop=no \
|
2013-07-17 09:37:36 +02:00
|
|
|
$$(QUIET) $$($$(PKG)_CONF_OPT) \
|
2009-11-08 18:37:49 +01:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Hook to update config.sub and config.guess if needed
|
|
|
|
#
|
|
|
|
define UPDATE_CONFIG_HOOK
|
2013-03-11 16:58:31 +01:00
|
|
|
@$$(call MESSAGE,"Updating config.sub and config.guess")
|
2011-08-31 23:35:06 +02:00
|
|
|
$$(call CONFIG_UPDATE,$$(@D))
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
2007-09-30 14:46:02 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
$(2)_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Hook to patch libtool to make it work properly for cross-compilation
|
|
|
|
#
|
|
|
|
define LIBTOOL_PATCH_HOOK
|
2010-11-04 03:50:22 +01:00
|
|
|
@$$(call MESSAGE,"Patching libtool")
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES" \
|
2010-10-09 12:52:49 +02:00
|
|
|
-a "$$($$(PKG)_AUTORECONF)" != "YES"; then \
|
|
|
|
for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
|
|
|
|
ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \
|
|
|
|
sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
|
|
|
|
if test $$$${ltmain_version} = '1.5'; then \
|
2011-08-31 23:35:04 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
|
2010-10-09 12:52:49 +02:00
|
|
|
elif test $$$${ltmain_version} = "2.2"; then\
|
2011-08-31 23:35:04 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
|
2011-03-28 21:45:06 +02:00
|
|
|
elif test $$$${ltmain_version} = "2.4"; then\
|
2011-08-31 23:35:04 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
|
2010-10-09 12:52:49 +02:00
|
|
|
fi \
|
2009-11-08 18:37:49 +01:00
|
|
|
done \
|
|
|
|
fi
|
|
|
|
endef
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-12-30 13:42:01 +01:00
|
|
|
# default values are not evaluated yet, so don't rely on this defaulting to YES
|
2010-04-28 23:40:47 +02:00
|
|
|
ifneq ($$($(2)_LIBTOOL_PATCH),NO)
|
2009-11-08 18:37:49 +01:00
|
|
|
$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2014-07-17 00:00:35 +02:00
|
|
|
#
|
|
|
|
# Hook to gettextize the package if needed
|
|
|
|
#
|
|
|
|
define GETTEXTIZE_HOOK
|
|
|
|
@$$(call MESSAGE,"Gettextizing")
|
2014-07-18 23:02:31 +02:00
|
|
|
$(Q)cd $$($$(PKG)_SRCDIR) && $$(GETTEXTIZE) $$($$(PKG)_GETTEXTIZE_OPT)
|
2014-07-17 00:00:35 +02:00
|
|
|
endef
|
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Hook to autoreconf the package if needed
|
|
|
|
#
|
|
|
|
define AUTORECONF_HOOK
|
2010-11-04 03:50:22 +01:00
|
|
|
@$$(call MESSAGE,"Autoreconfiguring")
|
2014-07-18 11:12:19 +02:00
|
|
|
$$(Q)cd $$($$(PKG)_SRCDIR) && $$($$(PKG)_AUTORECONF_ENV) $$(AUTORECONF) $$($$(PKG)_AUTORECONF_OPT)
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$$(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES"; then \
|
2009-11-08 18:37:49 +01:00
|
|
|
for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
|
2013-03-20 21:09:42 +01:00
|
|
|
ltmain_version=`sed -n '/^[ ]*VERSION=/{s/^[ ]*VERSION=//;p;q;}' $$$$i | \
|
|
|
|
sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
|
2010-10-09 12:52:49 +02:00
|
|
|
if test $$$${ltmain_version} = "1.5"; then \
|
2011-09-17 14:16:42 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
|
2010-10-09 12:52:49 +02:00
|
|
|
elif test $$$${ltmain_version} = "2.2"; then\
|
2011-09-17 14:16:42 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
|
2011-05-03 10:01:28 +02:00
|
|
|
elif test $$$${ltmain_version} = "2.4"; then\
|
2011-09-17 14:16:42 +02:00
|
|
|
support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
|
2010-10-09 12:52:49 +02:00
|
|
|
fi \
|
2009-11-08 18:37:49 +01:00
|
|
|
done \
|
|
|
|
fi
|
|
|
|
endef
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2012-07-03 00:07:08 +02:00
|
|
|
# This must be repeated from inner-generic-package, otherwise we get an empty
|
2012-01-16 14:58:35 +01:00
|
|
|
# _DEPENDENCIES if _AUTORECONF is YES. Also filter the result of _AUTORECONF
|
2014-07-17 00:00:35 +02:00
|
|
|
# and _GETTEXTIZE away from the non-host rule
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
ifeq ($(4),host)
|
|
|
|
$(2)_DEPENDENCIES ?= $$(filter-out host-automake host-autoconf host-libtool \
|
2014-07-17 00:00:35 +02:00
|
|
|
host-gettext host-toolchain $(1),\
|
infra: consistently use double dollar signs inside inner-xxx-targets
The inner-xxx-targets in the buildroot package infrastructures are
evaluated using $(eval) which causes variable references to be a bit
different than in regular make code. As we want most references to be
expanded only at the time of the $(eval) we should not use standard
references $(VAR) but rather use double dollar signs $$(VAR). This includes
function references like $(call), $(subst), etc. The only exception is the
reference to pkgdir/pkgname and numbered variables, which are parameters to
the inner block: $(1), $(2), etc.
This patch introduces consistent usage of double-dollar signs throughout the
different inner-xxx-targets blocks.
In some cases, this would potentially cause circular references, in
particular when the value of HOST_FOO_VAR would be obtained from the
corresponding FOO_VAR if HOST_FOO_VAR is not defined. In these cases, a test
is added to check for a host package (the only case where such constructions
are relevant; these are not circular).
Benefits of these changes are:
- behavior of variables is now again as expected. For example, setting
$(2)_VERSION = virtual in pkg-virtual.mk will effectively work, while
originally it would cause very odd results.
- The output of 'make printvars' is now much more useful. This target shows
the value of all variables, and the expression that led to that value.
However, if the expression was coming from an inner-xxx-targets block, and
was using single dollar signs, it would show in printvars as
VAR = value (value)
while if double dollar signs are used, it would effectively look like
VAR = value (actual expression)
as is intended.
This improvement is for example effective for FOO_DL_VERSION, FOO_RAWNAME,
FOO_SITE_METHOD and FOO_MAKE.
The correctness of this patch has been verified using 'make printvars',
'make manual' and 'make legal-info' before and after applying this patch,
and comparing the output.
Insight-provided-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-11 21:12:24 +02:00
|
|
|
$$(patsubst host-host-%,host-%,$$(addprefix host-,$$($(3)_DEPENDENCIES))))
|
|
|
|
endif
|
2012-01-16 14:58:35 +01:00
|
|
|
|
autotools: fix autoreconf check
The autoreconf check was incorrect, missing a $ sign to properly
reference a package-specific variable. There was no visible effect
until now since :
* The existing syntax allowed to access the value defined in the
package specific .mk file, so when AUTORECONF was set to YES by a
package, it was working.
* The default value in Makefile.autotools.in was NO. In fact, when a
package .mkf file wasn't defining the AUTORECONF variable, the
Makefile.autotools.in test was testing the empty string against
'YES', which was false, leading to the AUTORECONF not being done,
which was the desired effect.
However, in a later patch, we intend to change this default value.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2010-04-28 23:40:42 +02:00
|
|
|
ifeq ($$($(2)_AUTORECONF),YES)
|
2014-07-17 00:00:35 +02:00
|
|
|
# This has to come before autoreconf
|
|
|
|
ifeq ($$($(2)_GETTEXTIZE),YES)
|
|
|
|
$(2)_PRE_CONFIGURE_HOOKS += GETTEXTIZE_HOOK
|
|
|
|
$(2)_DEPENDENCIES += host-gettext
|
|
|
|
endif
|
2010-11-04 03:50:24 +01:00
|
|
|
$(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
|
2007-08-22 17:52:01 +02:00
|
|
|
$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
|
2009-11-08 18:37:49 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build step. Only define it if not already defined by the package .mk
|
|
|
|
# file.
|
|
|
|
#
|
|
|
|
ifndef $(2)_BUILD_CMDS
|
2014-02-05 10:44:03 +01:00
|
|
|
ifeq ($(4),target)
|
2009-11-08 18:37:49 +01:00
|
|
|
define $(2)_BUILD_CMDS
|
2011-12-24 13:07:03 +01:00
|
|
|
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR)
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
2007-08-10 21:07:51 +02:00
|
|
|
else
|
2009-11-08 18:37:49 +01:00
|
|
|
define $(2)_BUILD_CMDS
|
2011-12-24 13:07:03 +01:00
|
|
|
$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR)
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
endif
|
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Host installation step. Only define it if not already defined by the
|
|
|
|
# package .mk file.
|
|
|
|
#
|
|
|
|
ifndef $(2)_INSTALL_CMDS
|
|
|
|
define $(2)_INSTALL_CMDS
|
2013-06-30 21:28:53 +02:00
|
|
|
$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_OPT) -C $$($$(PKG)_SRCDIR)
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Staging installation step. Only define it if not already defined by
|
|
|
|
# the package .mk file.
|
|
|
|
#
|
2014-06-21 17:01:47 +02:00
|
|
|
# Most autotools packages install libtool .la files alongside any
|
|
|
|
# installed libraries. These .la files sometimes refer to paths
|
|
|
|
# relative to the sysroot, which libtool will interpret as absolute
|
2014-07-03 21:58:43 +02:00
|
|
|
# paths to host libraries instead of the target libraries. Since this
|
|
|
|
# is not what we want, these paths are fixed by prefixing them with
|
|
|
|
# $(STAGING_DIR). As we configure with --prefix=/usr, this fix
|
|
|
|
# needs to be applied to any path that starts with /usr.
|
2014-06-21 17:01:47 +02:00
|
|
|
#
|
2014-07-03 21:58:43 +02:00
|
|
|
# To protect against the case that the output or staging directories
|
|
|
|
# themselves are under /usr, we first substitute away any occurrences
|
|
|
|
# of these directories as @BASE_DIR@ and @STAGING_DIR@. Note that
|
|
|
|
# STAGING_DIR can be outside BASE_DIR when the user sets BR2_HOST_DIR
|
|
|
|
# to a custom value.
|
2014-06-21 17:01:47 +02:00
|
|
|
#
|
2009-11-08 18:37:49 +01:00
|
|
|
ifndef $(2)_INSTALL_STAGING_CMDS
|
|
|
|
define $(2)_INSTALL_STAGING_CMDS
|
2011-12-24 13:07:03 +01:00
|
|
|
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
|
2014-07-06 17:10:51 +02:00
|
|
|
find $$(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
|
2014-06-21 17:01:47 +02:00
|
|
|
$$(SED) "s:$$(BASE_DIR):@BASE_DIR@:g" \
|
2014-07-03 21:58:43 +02:00
|
|
|
-e "s:$$(STAGING_DIR):@STAGING_DIR@:g" \
|
2014-06-21 17:01:47 +02:00
|
|
|
-e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
|
|
|
|
-e "s:@STAGING_DIR@:$$(STAGING_DIR):g" \
|
2014-07-03 21:58:43 +02:00
|
|
|
-e "s:@BASE_DIR@:$$(BASE_DIR):g"
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
#
|
|
|
|
# Target installation step. Only define it if not already defined by
|
|
|
|
# the package .mk file.
|
|
|
|
#
|
|
|
|
ifndef $(2)_INSTALL_TARGET_CMDS
|
|
|
|
define $(2)_INSTALL_TARGET_CMDS
|
2011-12-24 13:07:03 +01:00
|
|
|
$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_TARGET_OPT) -C $$($$(PKG)_SRCDIR)
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
|
|
|
endif
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
# Call the generic package infrastructure to generate the necessary
|
|
|
|
# make targets
|
2014-02-05 10:44:03 +01:00
|
|
|
$(call inner-generic-package,$(1),$(2),$(3),$(4))
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
endef
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2009-11-08 18:37:49 +01:00
|
|
|
################################################################################
|
2012-07-03 00:07:08 +02:00
|
|
|
# autotools-package -- the target generator macro for autotools packages
|
2009-11-08 18:37:49 +01:00
|
|
|
################################################################################
|
2007-08-10 21:07:51 +02:00
|
|
|
|
2014-02-05 10:44:03 +01:00
|
|
|
autotools-package = $(call inner-autotools-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
|
|
|
|
host-autotools-package = $(call inner-autotools-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
|