How to pass extra custom ./configure autotools options to a Buildroot package?

只谈情不闲聊 提交于 2019-12-06 12:06:28

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!