Unverified Commit 10a4dec7 authored by Alyssa Ross's avatar Alyssa Ross Committed by GitHub
Browse files

llvmPackages: clean up rebuild avoidance (#447071)

parents 25f2aaa9 957d7fea
Loading
Loading
Loading
Loading
+11 −27
Original line number Diff line number Diff line
@@ -95,16 +95,17 @@ stdenv.mkDerivation (
      (lib.cmakeFeature "CLANG_INSTALL_PACKAGE_DIR" "${placeholder "dev"}/lib/cmake/clang")
      (lib.cmakeBool "CLANGD_BUILD_XPC" false)
      (lib.cmakeBool "LLVM_ENABLE_RTTI" true)
      (lib.cmakeBool "LLVM_INCLUDE_TESTS" false)
      (lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.tblgen}/bin/llvm-tblgen")
      (lib.cmakeFeature "CLANG_TABLEGEN" "${buildLlvmTools.tblgen}/bin/clang-tblgen")
      (lib.cmakeFeature "CLANG_TIDY_CONFUSABLE_CHARS_GEN" "${buildLlvmTools.tblgen}/bin/clang-tidy-confusable-chars-gen")
    ]
    ++ lib.optional (lib.versionAtLeast release_version "20") (
      lib.cmakeFeature "LLVM_DIR" "${libllvm.dev}/lib/cmake/llvm"
    )
    ++ lib.optionals (lib.versionAtLeast release_version "21") [
      (lib.cmakeFeature "CLANG_RESOURCE_DIR" "${placeholder "lib"}/lib/clang/${lib.versions.major release_version}")
    ]
    # TODO: Clean up on `staging`.
    ++ [
      (lib.cmakeBool "LLVM_INCLUDE_TESTS" false)
    ]
    ++ lib.optionals enableManpages [
      (lib.cmakeBool "CLANG_INCLUDE_DOCS" true)
      (lib.cmakeBool "LLVM_ENABLE_SPHINX" true)
@@ -112,20 +113,10 @@ stdenv.mkDerivation (
      (lib.cmakeBool "SPHINX_OUTPUT_HTML" false)
      (lib.cmakeBool "SPHINX_WARNINGS_AS_ERRORS" false)
    ]
    # TODO: Clean up on `staging`.
    ++ [
      # Added in LLVM15:
      # `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb
      # `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
      (lib.cmakeFeature "CLANG_TIDY_CONFUSABLE_CHARS_GEN" "${buildLlvmTools.tblgen}/bin/clang-tidy-confusable-chars-gen")
    ]
    ++ lib.optionals (lib.versionOlder release_version "20") [
      # clang-pseudo removed in LLVM20: https://github.com/llvm/llvm-project/commit/ed8f78827895050442f544edef2933a60d4a7935
      (lib.cmakeFeature "CLANG_PSEUDO_GEN" "${buildLlvmTools.tblgen}/bin/clang-pseudo-gen")
    ]
    ++ lib.optional (lib.versionAtLeast release_version "20") (
      lib.cmakeFeature "LLVM_DIR" "${libllvm.dev}/lib/cmake/llvm"
    )
    ++ devExtraCmakeFlags;

    postPatch = ''
@@ -173,20 +164,13 @@ stdenv.mkDerivation (
      patchShebangs $python/bin

      mkdir -p $dev/bin
      cp bin/clang-tblgen $dev/bin
    ''
    # TODO(@LunNova): Clean up this rebuild avoidance in staging
    + lib.optionalString enableClangToolsExtra (
      if lib.versionOlder release_version "20" then
        ''
          cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
        ''
      else
        ''
          cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen} $dev/bin
    + lib.optionalString enableClangToolsExtra ''
      cp bin/clang-tidy-confusable-chars-gen $dev/bin
    ''
    )
    + lib.optionalString (!enableClangToolsExtra) ''
      cp bin/clang-tblgen $dev/bin
    + lib.optionalString (enableClangToolsExtra && lib.versionOlder release_version "20") ''
      cp bin/clang-pseudo-gen $dev/bin
    '';

    env =
+8 −12
Original line number Diff line number Diff line
@@ -374,17 +374,13 @@ let

      # This is an "oddly ordered" bootstrap just for Darwin. Probably
      # don't want it otherwise.
      clangNoCompilerRtWithLibc =
        wrapCCWith rec {
      clangNoCompilerRtWithLibc = wrapCCWith rec {
        cc = tools.clang-unwrapped;
        libcxx = null;
        bintools = bintools';
        extraPackages = [ ];
        extraBuildCommands = mkExtraBuildCommands0 cc;
        }
        # FIXME: This should be inside the `wrapCCWith` call.
        // lib.optionalAttrs stdenv.targetPlatform.isWasm {
          nixSupport.cc-cflags = [ "-fno-exceptions" ];
        nixSupport.cc-cflags = lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
      };

      # Aliases
+0 −3
Original line number Diff line number Diff line
@@ -143,9 +143,6 @@ stdenv.mkDerivation (finalAttrs: {
    patchShebangs utils/cat_files.py
  '';

  # TODO: Remove on `staging`.
  patches = [ ];

  nativeBuildInputs = [
    cmake
    ninja
+0 −7
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@ stdenv.mkDerivation (finalAttrs: {

  inherit version;

  # TODO: Remove on `staging`.
  patches = [ ];

  src =
    if monorepoSrc != null then
      runCommand "libunwind-src-${version}" { inherit (monorepoSrc) passthru; } ''
@@ -60,10 +57,6 @@ stdenv.mkDerivation (finalAttrs: {
  ]
  ++ devExtraCmakeFlags;

  # TODO: Remove on `staging`.
  prePatch = "";
  postPatch = "";

  postInstall =
    lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isWindows)
      ''
+0 −3
Original line number Diff line number Diff line
@@ -63,9 +63,6 @@ stdenv.mkDerivation (finalAttrs: {
  ]
  ++ devExtraCmakeFlags;

  # TODO: Remove on `staging`.
  postPatch = "";

  # Musl's default stack size is too small for lld to be able to link Firefox.
  LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";

Loading