aboutsummaryrefslogtreecommitdiff
path: root/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'package.nix')
-rw-r--r--package.nix45
1 files changed, 39 insertions, 6 deletions
diff --git a/package.nix b/package.nix
index 9a2e08038..c9cc17c29 100644
--- a/package.nix
+++ b/package.nix
@@ -62,7 +62,7 @@
# FIXME(Qyriad): build Lix using Meson instead of autoconf and make.
# This flag will be removed when the migration to Meson is complete.
- buildWithMeson ? false,
+ buildWithMeson ? true,
# Not a real argument, just the only way to approximate let-binding some
# stuff for argument defaults.
@@ -100,6 +100,34 @@ let
testConfigureFlags = [ "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include" ];
+ # Reimplementation of Nixpkgs' Meson cross file, with some additions to make
+ # it actually work.
+ mesonCrossFile =
+ let
+ cpuFamily =
+ platform:
+ with platform;
+ if isAarch32 then
+ "arm"
+ else if isx86_32 then
+ "x86"
+ else
+ platform.uname.processor;
+ in
+ builtins.toFile "lix-cross-file.conf" ''
+ [properties]
+ # Meson is convinced that if !buildPlatform.canExecute hostPlatform then we cannot
+ # build anything at all, which is not at all correct. If we can't execute the host
+ # platform, we'll just disable tests and doc gen.
+ needs_exe_wrapper = false
+
+ [binaries]
+ # Meson refuses to consider any CMake binary during cross compilation if it's
+ # not explicitly specified here, in the cross file.
+ # https://github.com/mesonbuild/meson/blob/0ed78cf6fa6d87c0738f67ae43525e661b50a8a2/mesonbuild/cmake/executor.py#L72
+ cmake = 'cmake'
+ '';
+
# The internal API docs need these for the build, but if we're not building
# Nix itself, then these don't need to be propagated.
maybePropagatedInputs = [
@@ -184,10 +212,15 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optional stdenv.hostPlatform.isStatic "-Denable-embedded-sandbox-shell=true"
++ lib.optional (finalAttrs.dontBuild) "-Denable-build=false"
- # mesonConfigurePhase automatically passes -Dauto_features=enabled,
- # so we must explicitly enable or disable features that we are not passing
- # dependencies for.
- ++ lib.singleton (lib.mesonEnable "internal-api-docs" internalApiDocs);
+ ++ [
+ # mesonConfigurePhase automatically passes -Dauto_features=enabled,
+ # so we must explicitly enable or disable features that we are not passing
+ # dependencies for.
+ (lib.mesonEnable "internal-api-docs" internalApiDocs)
+ (lib.mesonBool "enable-tests" finalAttrs.doCheck)
+ (lib.mesonBool "enable-docs" canRunInstalled)
+ ]
+ ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--cross-file=${mesonCrossFile}";
# We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata.
dontUseCmakeConfigure = true;
@@ -315,7 +348,7 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
- doCheck = true;
+ doCheck = canRunInstalled;
mesonCheckFlags = lib.optionals (buildWithMeson || forDevShell) [ "--suite=check" ];