Adds support for Go modules by detecting a go.mod file and, if
available, using it. In addition, to continue supporting vendoring (and
avoid the need for git on all module builds), if a package includes
a vendor directory, the module mode will switch to vendor mode if not
already set. This will use vendored source code for dependencies
instead of downloading that code again using the descriptions under
go.mod.
go_mod_mode=vendor also skips the go.sum check because nothing is
downloaded that isn't already verified, so this fixes packages with
vendored code that have checksum mismatches due to Go 1.11.4 module
checksum changes.
[ci skip]
Closes: #6036 [via git-merge-pr]
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