On Fri, Mar 31, 2017 at 10:37 AM, Helmut Grohne <hel...@subdivi.de> wrote:
> When running `meson` on a project without supplying a `--cross-file`, > `meson` will pick default system compilers. Those compilers will produce > architecture-dependent output, which `meson` inherits. Thus `meson`'s > interfaces certainly are not architecture-independent (and therefore > suitable for `Multi-Arch: foreign`) in the obvious way. That said, the > same problem holds for `make` and `cmake`. `make` was originally marked > `Multi-Arch: foreign` until Jakub Wilk noticed that its handling of > filesystem paths is architecture-dependent and it is now `Multi-Arch: > allowed` (and considered architecture independent through > build-essential unless one explicitly `Build-Depends: make`). `cmake` is > marked `Multi-Arch: foreign`. So we need to define a "reasonable use" of > meson and evaluate whether such use is indeed architecture-independent. The simplest approach is to follow what CMake does because what we do is roughly similar. However there is one extra kink here. Meson requires access to the "native" and "cross" compilers at the same time. This is because it natively supports the use case where you compile a program that is then used to generate source code that is built. Examples include idl compilers and the like. I'm not familiar enough with the Debian cross compilation environment to know if those are available. > Thus `debhelper` would simply call `cross-meson` with the appropriate > GNU triplets (that it can easily derive using `dpkg-architecture`) and > skip any cross compilation specific complexity for `meson`. Such a > script would be useful beyond Debian as GNU triplets are a very common > thing during cross compilation. Rather than having each and every Linux > distribution produce its own `--cross-file` generator, why not have this > upstream? Of course I am not proposing to abolish the more flexible > `--cross-file` approach: It does server actual use cases beyond > well-maintained Linux distributions. But maybe we can have a wrapper to > handle the common case? Something like this could be done and possibly even provided upstream. However I'd like it to first go to Debian for a while. If it lives upstream it would need to support many distros (at least Debian + Fedora, preferably also Arch and the like). Getting it running on a single distro is a lot simpler. There is, however, an alternative to this. There is only one cross file per architecture, so for Debian a few dozen. Those could be manually generated and provided as part of dh_meson package or somesuch. Then getting a cross compilation going would be just a case of adding this to the configuration line: --cross-file /usr/share/something/triplet-filename.txt This is especially useful if there are platforms that require tweaks to the cross files that the generator would create. This gets a bit more complicated if compiling cross compilers or binutils, which would require having a different cross file where host is different from target. At the time of writing there are no compilers building with Meson that I know of so this is not an acute issue.