问题
E.g., I want to add the options --enable-foo --enable-bar
to a ./configure
command.
Many ./configure
options can be set indirectly through BR2_
configs, but many software have so many options that it would be infeasible to have one BR2_
config for every possible ./configure
option.
Is there a general mechanism that works for all autotools packages?
回答1:
I think there is no current general method as of 2017.02, since package/pkg-autotools.mk
contains:
# Configure package for target
define $(2)_CONFIGURE_CMDS
(cd $$($$(PKG)_SRCDIR) && rm -rf config.cache && \
$$(TARGET_CONFIGURE_OPTS) \
$$(TARGET_CONFIGURE_ARGS) \
$$($$(PKG)_CONF_ENV) \
CONFIG_SITE=/dev/null \
./configure \
--target=$$(GNU_TARGET_NAME) \
--host=$$(GNU_TARGET_NAME) \
--build=$$(GNU_HOST_NAME) \
--prefix=/usr \
--exec-prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--program-prefix="" \
--disable-gtk-doc \
--disable-gtk-doc-html \
--disable-doc \
--disable-docs \
--disable-documentation \
--with-xmlto=no \
--with-fop=no \
--disable-dependency-tracking \
--enable-ipv6 \
$$(DISABLE_NLS) \
$$(SHARED_STATIC_LIBS_OPTS) \
$$(QUIET) $$($$(PKG)_CONF_OPTS) \
)
endef
else
and I can't see any way to plug in arbitrary options since $$($$(PKG)_CONF_OPTS)
is set from the package.mk
of each package, and the other variables appear to have specific purposes as well and shouldn't be messed with.
But I think this could be easily patched if we added a:
$$($$(PKG)_CONF_OPTS_EXTRA)
and then from the CLI you could do:
make MYPACKAGE_CONF_OPTS_EXTRA="--enable-foo --enable-bar"
Finally, for some packages, you could get away with existing make
configs, e.g. for host-qemu
, which has not yet been converted to autotools, I manage to get my extra options simply with:
HOST_QEMU_OPTS="--enable-sdl --with-sdlabi=2.0"
because luckly that package happens to use +=
instead of =
on the Makefile.
Thomas' answer at: https://stackoverflow.com/a/49570825/895245 also suggests that it is not possible without hacking up new config options.
回答2:
You can define a BR2_EXTERNAL
tree and in the external.mk
you can override any package variable you like (well, there are a few exceptions, e.g. <PKG>_VERSION
). You can append to the variables or override them.
来源:https://stackoverflow.com/questions/44341188/how-to-pass-extra-custom-configure-autotools-options-to-a-buildroot-package