Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of package dependencies, support CMake and Meson #40

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

elprans
Copy link
Member

@elprans elprans commented Oct 8, 2024

This is a fairly large-looking refactor aimed to replace manual
dependency configuration in package classes with automatic discovery
using pkg-config or CMake-provided package configs. Most packages ship
those and setting PKG_CONFIG_PATH and CMAKE_PREFIX_PATH is far more
robust than fiddling with *FLAGS directly.

This also adds full support for the CMake and Meson build systems and
makes lots of small changes required to do so in a clean fashion and
also to reduce boilerplate in package classes.

Specifically:

  • overloading get_configure_script is no longer necessary for packages
    using supported build systems, get_configure_args and
    get_configure_env should be overloaded instead, returning a clean
    dictionary of flags instead;

  • related to above, calling configure_dependency directly is not
    required anymore, dependencies are auto-configured based on their
    own build system declaration;

  • get_build_script and get_build_install_script overloads should not
    call make (or whatever build system equivalent) and should instead
    call get_build_command() and get_build_install_command()
    correspondingly which take care of command formatting and injection of
    environment and global arguments.

Additionally, the root package can now control the overall layout of the
package bundle:

  • get_dep_install_subdir may be overloaded to put all dependencies under
    a specified root, which is useful for packaging plugins and extensions
    that have dynamic library dependencies which should ideally be isolated
    with from similar dependencies of the host program;

  • get_root_install_subdir may be overloaded to customize the name of
    the common parent directory in the installation prefix, e.g in
    /opt/<subdir> or /usr/lib/<host-triple>/<subdir>.

Other misc improvements and fixes:

  • add support for building with Ninja;
  • allow packages to have multiple source tarballs;
  • use {mandir} and {docdir} install patterns instead of hardcoded
    {datadir}-based paths;

This is a fairly large-looking refactor aimed to replace manual
dependency configuration in package classes with automatic discovery
using pkg-config or CMake-provided package configs.  Most packages ship
those and setting `PKG_CONFIG_PATH` and `CMAKE_PREFIX_PATH` is far more
robust than fiddling with `*FLAGS` directly.

This also adds full support for the CMake and Meson build systems and
makes lots of small changes required to do so in a clean fashion and
also to reduce boilerplate in package classes.

Specifically:

- overloading `get_configure_script` is no longer necessary for packages
  using supported build systems, `get_configure_args` and
  `get_configure_env` should be overloaded instead, returning a clean
  dictionary of flags instead;

- related to above, calling `configure_dependency` directly is not
  required anymore, dependencies are auto-configured based on their
  own build system declaration;

- `get_build_script` and `get_build_install_script` overloads should not
  call `make` (or whatever build system equivalent) and should instead
  call `get_build_command()` and `get_build_install_command()`
  correspondingly which take care of command formatting and injection of
  environment and global arguments.

Additionally, the root package can now control the overall layout of the
package bundle:

- `get_dep_install_subdir` may be overloaded to put all dependencies under
  a specified root, which is useful for packaging plugins and extensions
  that have dynamic library dependencies which should ideally be isolated
  with from similar dependencies of the host program;

- `get_root_install_subdir` may be overloaded to customize the name of
  the common parent directory in the installation prefix, e.g in
  `/opt/<subdir>` or `/usr/lib/<host-triple>/<subdir>`.

Other misc improvements and fixes:

- add support for building with Ninja;
- allow packages to have multiple source tarballs;
- use `{mandir}` and `{docdir}` install patterns instead of hardcoded
  `{datadir}`-based paths;
elprans added a commit to edgedb/edgedb-pkg that referenced this pull request Oct 9, 2024
@elprans elprans merged commit 542bd23 into master Oct 9, 2024
1 of 2 checks passed
@elprans elprans deleted the refactor branch October 9, 2024 16:35
elprans added a commit to edgedb/edgedb-pkg that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants