Skip to content

RFC: Add minimal support for autotools subproject #4316

@xclaesse

Description

@xclaesse

Some projects like GStreamer has many external dependencies that does not have native meson build systems.

Subprojects are really useful to build a project on platforms that doesn't have any of its deps, like cross-building GStreamer for Android. Adding them all in wrapdb is an infinite wast of time. It would be a huge time saving of meson could just run configure/make itself for subprojects.

In the master project (e.g. GStreamer):

libfoo = dependency('libfoo', fallback : ['libfoo', 'libfoo_dep'])

In subproject's meson.build:

project('libfoo', 'c')

autotools = import('autotools')

# This cause meson to run `./configure` in `<build dir>/subprojects/libfoo_build`,
# and add ninja rules to run:
# `make -C <build dir>/subprojects/libfoo_build"` and
# `make DESTDIR=<build dir>/subprojects/libfoo_installed install`
autotools.configure()

# This will create a dependency object that has `-I<build dir>/subprojects/libfoo_installed/<prefix>/<includedir>`, `-L<build dir>/subprojects/libfoo_installed/<prefix>/<libdir>`, and `-lfoo`
libfoo_dep = autotools.declare_dependency()

Would be nice to also be able to use .pc file generated by make in autotools.declare_dependency(), but that would mean running make at meson's configure time... Maybe that would be acceptable since this autotools module is really just a "best effort" to help developers, not something nice and clean.

Also, I wouldn't be too worried about properly rebuild autotools subprojects if they change, IMHO the use-case here is really to provide fallback for deps that won't change. Again, this is just a "best effort" case, developers can always to rebuild from scratch if something goes wrong (often the case with autotools itself anyway).

And finally, since it's easier to use vanilla upstream tarball/git, the small subproject's meson.build could be generated from the .wrap file, by adding build_type=autotools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions