Skip to content

Draft: Make it possible to cross-compile packages that use vapigen

Simon McVittie requested to merge wip/cross-vapigen into debian/latest
  • d/rules: Parameterize the vala major/minor version number

    This just means we repeat ourselves a bit less.

  • Move vapigen, vapigen-0.56 to valac-bin

    To be able to cross-compile packages like gcr4 that generate Vala APIs, we'll need vapigen to be treated like valac, with an architecture-specific wrapper that sets an appropriate search path for the desired architecture.

  • d/rules: Generate a ${tuple}-vapigen which searches appropriate directories

    When generating a Vala API during cross-compilation, for example if we're compiling for riscv64 on x86_64, we need to use a vapigen that is an x86_64 binary (otherwise we can't run it), but tell it to look for dependencies' GIR XML in directories that would be appropriate for riscv64 as a higher precedence than the directories that would normally be searched for x86_64.

    For example, this means we find GLib-2.0.gir in /usr/lib/${DEB_HOST_MULTIARCH}/gir-1.0.

    Closes: #1061107

  • Generate a ${DEB_HOST_GNU_TYPE}-vapigen.ini to use a vapigen wrapper

    This allows packages with a Meson build system to opt-in to using the host architecture vapigen during cross-builds.

  • d/rules: Edit vapigen-VER.pc to use architecture-prefixed vapigen

  • d/rules: Edit .pc files to refer to the architecture-prefixed vapigen

  • d/rules: Consistently generate all cross-wrappers from a template

    I think it's easier to read like this.

  • Create cross valac/vapigen symlinks declaratively

    It seems more readable to do these with debhelper 13's support for variable substitutions, rather than a shell loop. This means we don't actually need to override dh_install at all.

  • Use absolute paths to run valac, vapigen in cross wrappers

    If the cross wrapper for valac/vapigen has been found in /usr/bin, it seems less surprising if it runs the corresponding system copy of valac/vapigen, bypassing any possible locally-installed valac that might conceivably be the same major version number.

  • Generalize Meson cross-file to cover both valac and vapigen

    If we're cross-compiling a Meson-built package that contains Vala source code, for example dconf-editor, we want to use the host architecture's valac wrapper. Otherwise, it will invoke the build architecture's pkg-config, which is incorrect.

  • Update changelog


/cc @jbicha @ricotz-guest

gcr4!2 is an example of how to make use of this in a dependent package.

Ideally something in the debhelper/Meson ecosystem would set up cross g-i and Vala paths automatically so that changes like gcr4!2 would not be necessary, but it isn't clear to me from https://bugs.debian.org/1060838 how the Meson maintainers want this to look, and until that's settled, an opt-in mechanism is better than nothing.

Does this look OK to upload, at least to experimental?

Edited by Simon McVittie

Merge request reports

Loading