From b072c069b741d5939baf0350d53392197da3b2d7 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Fri, 8 Mar 2024 21:09:11 -0700 Subject: package: migrate internal-api-docs Change-Id: I344d73a412c2c6e4bb2eb14bd4859056324f1ba7 --- package.nix | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'package.nix') diff --git a/package.nix b/package.nix index a6933b0ab..73e887d8d 100644 --- a/package.nix +++ b/package.nix @@ -13,6 +13,7 @@ brotli, bzip2, curl, + doxygen, editline, fileset, flex, @@ -42,6 +43,7 @@ officialRelease ? true, # Set to true to build the release notes for the next release. buildUnreleasedNotes ? false, + internalApiDocs ? false, # Not a real argument, just the only way to approximate let-binding some # stuff for argument defaults. @@ -62,6 +64,13 @@ "RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include" ]; + # 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 = [ + boehmgc + nlohmann_json + ]; + # .gitignore has already been processed, so any changes in it are irrelevant # at this point. It is not represented verbatim for test purposes because # that would interfere with repo semantics. @@ -98,7 +107,7 @@ in stdenv.mkDerivation (finalAttrs: { topLevelBuildFiles functionalTestFiles ./unit-test-data - ] ++ lib.optionals (!finalAttrs.dontBuild) [ + ] ++ lib.optionals (!finalAttrs.dontBuild || internalApiDocs) [ ./boehmgc-coroutine-sp-fallback.diff ./doc ./misc @@ -132,7 +141,9 @@ in stdenv.mkDerivation (finalAttrs: { mercurial jq ] ++ lib.optional stdenv.hostPlatform.isLinux util-linuxMinimal - ++ lib.optional (!officialRelease && buildUnreleasedNotes) changelog-d; + ++ lib.optional (!officialRelease && buildUnreleasedNotes) changelog-d + ++ lib.optional internalApiDocs doxygen + ; buildInputs = [ curl @@ -153,6 +164,7 @@ in stdenv.mkDerivation (finalAttrs: { ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) aws-sdk-cpp-nix # FIXME(Qyriad): This is how the flake.nix version does it, but this is cursed. ++ lib.optionals (finalAttrs.doCheck) finalAttrs.passthru._checkInputs + ++ lib.optionals (finalAttrs.dontBuild) maybePropagatedInputs ; passthru._checkInputs = [ @@ -163,10 +175,7 @@ in stdenv.mkDerivation (finalAttrs: { # FIXME(Qyriad): remove at the end of refactoring. checkInputs = finalAttrs.passthru._checkInputs; - propagatedBuildInputs = [ - boehmgc - nlohmann_json - ]; + propagatedBuildInputs = lib.optionals (!finalAttrs.dontBuild) maybePropagatedInputs; disallowedReferences = [ boost @@ -198,10 +207,13 @@ in stdenv.mkDerivation (finalAttrs: { ] ++ [ "--sysconfdir=/etc" ] ++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell" ++ [ (lib.enableFeature finalAttrs.doCheck "tests") ] - ++ lib.optionals finalAttrs.doCheck testConfigureFlags + ++ lib.optionals (finalAttrs.doCheck || internalApiDocs) testConfigureFlags ++ lib.optional (!canRunInstalled) "--disable-doc-gen" + ++ [ (lib.enableFeature internalApiDocs "internal-api-docs") ] ; + installTargets = lib.optional internalApiDocs "internal-api-html"; + enableParallelBuilding = true; makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1"; @@ -210,19 +222,20 @@ in stdenv.mkDerivation (finalAttrs: { installFlags = "sysconfdir=$(out)/etc"; - postInstall = '' - mkdir -p $doc/nix-support - echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products - ${lib.optionalString stdenv.hostPlatform.isStatic '' - mkdir -p $out/nix-support - echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products - ''} - ${lib.optionalString stdenv.isDarwin '' - install_name_tool \ - -change ${boost}/lib/libboost_context.dylib \ - $out/lib/libboost_context.dylib \ - $out/lib/libnixutil.dylib - ''} + postInstall = lib.optionalString (!finalAttrs.dontBuild) '' + mkdir -p $doc/nix-support + echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products + '' + lib.optionalString stdenv.hostPlatform.isStatic '' + mkdir -p $out/nix-support + echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products + '' + lib.optionalString stdenv.isDarwin '' + install_name_tool \ + -change ${boost}/lib/libboost_context.dylib \ + $out/lib/libboost_context.dylib \ + $out/lib/libnixutil.dylib + '' + lib.optionalString internalApiDocs '' + mkdir -p $out/nix-support + echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> "$out/nix-support/hydra-build-products" ''; doInstallCheck = finalAttrs.doCheck; -- cgit v1.2.3