From b81eec6ed56e5a5ad448359fc3d7755b68e59d0b Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 11 Apr 2024 12:17:19 -0600 Subject: build internal API docs with Meson This commit adds the capability for building the Doxygen internal API docs in the Meson buildsystem, and also makes doing so the default for the internal-api-docs hydra job. Aside from the /nix-support directory, which differed only by the hash part of a store path, the outputs of hydraJobs.internal-api-docs before and after this commit were bit-for-bit identical on my machine. Change-Id: I98f0017891c25b06866c15f7652fe74f706ec8e1 --- package.nix | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'package.nix') diff --git a/package.nix b/package.nix index e1d3cfcd5..aab98c0ae 100644 --- a/package.nix +++ b/package.nix @@ -178,9 +178,15 @@ stdenv.mkDerivation (finalAttrs: { dontBuild = false; # FIXME(Qyriad): see if this is still needed once the migration to Meson is completed. - mesonFlags = lib.optionals (buildWithMeson && stdenv.hostPlatform.isLinux) [ - "-Dsandbox-shell=${lib.getBin busybox-sandbox-shell}/bin/busybox" - ]; + mesonFlags = + lib.optionals (buildWithMeson && stdenv.hostPlatform.isLinux) [ + "-Dsandbox-shell=${lib.getBin busybox-sandbox-shell}/bin/busybox" + ] + ++ 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); # We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata. dontUseCmakeConfigure = true; @@ -209,7 +215,7 @@ stdenv.mkDerivation (finalAttrs: { ] ++ lib.optional stdenv.hostPlatform.isLinux util-linuxMinimal ++ lib.optional (!officialRelease && buildUnreleasedNotes) build-release-notes - ++ lib.optional internalApiDocs doxygen + ++ lib.optional (internalApiDocs || forDevShell) doxygen ++ lib.optionals buildWithMeson [ meson ninja @@ -236,6 +242,7 @@ stdenv.mkDerivation (finalAttrs: { libseccomp busybox-sandbox-shell ] + ++ lib.optional internalApiDocs rapidcheck ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid # There have been issues building these dependencies ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) aws-sdk-cpp-nix @@ -313,6 +320,13 @@ stdenv.mkDerivation (finalAttrs: { installFlags = "sysconfdir=$(out)/etc"; + # Make sure the internal API docs are already built, because mesonInstallPhase + # won't let us build them there. They would normally be built in buildPhase, + # but the internal API docs are conventionally built with doBuild = false. + preInstall = lib.optional (buildWithMeson && internalApiDocs) '' + meson ''${mesonBuildFlags:-} compile "$installTargets" + ''; + postInstall = lib.optionalString (!finalAttrs.dontBuild) '' mkdir -p $doc/nix-support -- cgit v1.2.3