PKG_CONFIG environment variable should point to the pkg-config executable
to be used to fetch dependencies that use 'native: true' (indicate to build
against host libraries not cross-compiled ones)
To meet those requirements we set an absolute path to the host
pkg-config since the relative path to pkg-config is taken by the
wrapper.
This currently requires a patch that is a milestone of meson-0.48 that
was generated by the issue:
https://github.com/mesonbuild/meson/issues/1736
meson when compiling something with 'native: true' (for building
executables that are meant to be run on the host system) uses CFLAGS
and CXXFLAGS environment variables, we "pollute" them with
TARGET system cflags/cxxflags, such as -march= for the cross-compiled
arch.
so to fix it we export CFLAGS and CXXFLAGS to be CFLAGS_host and
CXXFLAGS_host respectively, they are set by XBPS and correspond to
the XBPS_CFLAGS/XBPS_CXXFLAGS. This same set of changes is also done
with CC and CXX see L#61
this was found when cross-compiling lighttpd which created the
'lemon' executable to generate inputs
thanks to @Cogitri from Exherbo for helping me debug this
[ci skip]
following https://mesonbuild.com/Cross-compilation.html
- host_machine is our XBPS_TARGET_MACHINE
- build_machine is our XBPS_MACHINE, and meson can find out the details
on it's own
- also don't include -musl in the CPU because meson doesn't recognize it
and projects like Mesa (LibGL) don't enable optimizations for it
- cpu_family and cpu are different, they need to be set properly:
- armv* is arm
- mips* is mips
- i686 is x86
- x86_64 is x86_64
- aarch64 is aarch64