diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-04-13 00:02:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-13 00:02:05 +0000 |
commit | 5a301eda678bb41e7c0a6ed5cd1056be5030f4e0 (patch) | |
tree | 5b00aa24e5c1299c50573c8ddc354044040fe4ee /pkgs/development/compilers/llvm | |
parent | d6a31576e124f4c2d7e8c525d61d0802c6f83550 (diff) | |
parent | cfd6b5fc90b15709b780a5a1619695a88505a176 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/development/compilers/llvm')
35 files changed, 285 insertions, 1364 deletions
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index bd87dc5f34f03..d8b673c70f222 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -1,5 +1,6 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake , preLibcCrossHeaders +, fetchpatch , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross @@ -114,7 +115,11 @@ let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + src = fetch "lld" "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9"; + patches = [ + ./lld/gnu-install-dirs.patch + ]; inherit llvm_meta; inherit (libraries) libunwind; }; @@ -258,13 +263,24 @@ let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + src = fetch "libunwind" "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb"; + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; - inherit (buildLlvmTools) llvm; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + src = fetch "openmp" "14dh0r6h2xh747ffgnsl4z08h0ri04azi9vf79cbz7ma1r27kzk0"; + patches = [ + # Fix cross. + (fetchpatch { + url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch"; + hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A="; + }) + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/12/libunwind/default.nix b/pkgs/development/compilers/llvm/12/libunwind/default.nix deleted file mode 100644 index 95e0962b46891..0000000000000 --- a/pkgs/development/compilers/llvm/12/libunwind/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib, stdenv, llvm_meta, version, fetch, libcxx, llvm, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - src = fetch pname "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb"; - - postUnpack = '' - ln -s ${libcxx.src}/libcxx . - ln -s ${libcxx.src}/llvm . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/12/openmp/default.nix b/pkgs/development/compilers/llvm/12/openmp/default.nix deleted file mode 100644 index 6040f3d1621a9..0000000000000 --- a/pkgs/development/compilers/llvm/12/openmp/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, fetch -, fetchpatch -, cmake -, llvm -, targetLlvm -, perl -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = fetch pname "14dh0r6h2xh747ffgnsl4z08h0ri04azi9vf79cbz7ma1r27kzk0"; - - patches = [ - # Fix cross. - (fetchpatch { - url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch"; - hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A="; - }) - ]; - - patchFlags = [ "-p2" ]; - - nativeBuildInputs = [ cmake perl ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 429dfe5f1f3ee..e93fb1bf29440 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -1,5 +1,6 @@ { lowPrio, newScope, pkgs, lib, stdenv, cmake , preLibcCrossHeaders +, fetchpatch , libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross @@ -139,7 +140,10 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ]; inherit llvm_meta; }; @@ -296,12 +300,22 @@ in let monorepoSrc = src; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + # Fix cross. + (fetchpatch { + url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch"; + hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A="; + }) + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/13/libunwind/default.nix b/pkgs/development/compilers/llvm/13/libunwind/default.nix deleted file mode 100644 index d837bc60de370..0000000000000 --- a/pkgs/development/compilers/llvm/13/libunwind/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, stdenv, llvm_meta, version, src, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - inherit src; - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/13/lld/default.nix b/pkgs/development/compilers/llvm/13/lld/default.nix deleted file mode 100644 index d506f396f65cd..0000000000000 --- a/pkgs/development/compilers/llvm/13/lld/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, src -, cmake -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - inherit src; - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - # On Darwin the llvm-config is perhaps not working fine as the - # LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as the - # include path is not correct. - postPatch = lib.optionalString stdenv.isDarwin '' - substituteInPlace MachO/CMakeLists.txt --replace \ - '(''${LLVM_MAIN_SRC_DIR}/' '(../' - ''; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = [ - "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/13/openmp/default.nix b/pkgs/development/compilers/llvm/13/openmp/default.nix deleted file mode 100644 index 7b461df438f9a..0000000000000 --- a/pkgs/development/compilers/llvm/13/openmp/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, src -, fetchpatch -, cmake -, llvm -, targetLlvm -, perl -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - inherit src; - sourceRoot = "${src.name}/${pname}"; - - patches = [ - # Fix cross. - (fetchpatch { - url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch"; - hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A="; - }) - ]; - - patchFlags = [ "-p2" ]; - - nativeBuildInputs = [ cmake perl ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - cmakeFlags = [ - "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL currently fails - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 6dcdcfa925840..687deb6ead89b 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -136,7 +136,11 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ./lld/fix-root-src-dir.patch + ]; inherit llvm_meta; }; @@ -294,12 +298,19 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/gnu-install-dirs.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix deleted file mode 100644 index c6d9eda5e4749..0000000000000 --- a/pkgs/development/compilers/llvm/14/libunwind/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/14/lld/default.nix b/pkgs/development/compilers/llvm/14/lld/default.nix deleted file mode 100644 index 02ca4c8024873..0000000000000 --- a/pkgs/development/compilers/llvm/14/lld/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - # On Darwin the llvm-config is perhaps not working fine as the - # LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as - # the include path is not correct. - ./fix-root-src-dir.patch - ]; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/14/openmp/default.nix b/pkgs/development/compilers/llvm/14/openmp/default.nix deleted file mode 100644 index d1c6a46b4d693..0000000000000 --- a/pkgs/development/compilers/llvm/14/openmp/default.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, monorepoSrc -, runCommand -, cmake -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ./run-lit-directly.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake perl pkg-config lit ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index dcafd2970d005..52ab1783b876b 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -141,7 +141,10 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ]; inherit llvm_meta; }; @@ -312,12 +315,20 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/fix-find-tool.patch + ./openmp/gnu-install-dirs.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/15/libunwind/default.nix b/pkgs/development/compilers/llvm/15/libunwind/default.nix deleted file mode 100644 index 1b677a7a2c0d7..0000000000000 --- a/pkgs/development/compilers/llvm/15/libunwind/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/15/lld/default.nix b/pkgs/development/compilers/llvm/15/lld/default.nix deleted file mode 100644 index cc18aee76a448..0000000000000 --- a/pkgs/development/compilers/llvm/15/lld/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/15/openmp/default.nix b/pkgs/development/compilers/llvm/15/openmp/default.nix deleted file mode 100644 index d51335436ad23..0000000000000 --- a/pkgs/development/compilers/llvm/15/openmp/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, monorepoSrc -, runCommand -, cmake -, ninja -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, xcbuild -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./fix-find-tool.patch - ./gnu-install-dirs.patch - ./run-lit-directly.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja perl pkg-config lit ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix index 46d17c193fc92..168c288d49a3c 100644 --- a/pkgs/development/compilers/llvm/16/default.nix +++ b/pkgs/development/compilers/llvm/16/default.nix @@ -141,7 +141,11 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ./lld/add-table-base.patch + ]; inherit llvm_meta; }; @@ -327,12 +331,20 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/fix-find-tool.patch + ./openmp/gnu-install-dirs.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/16/libunwind/default.nix b/pkgs/development/compilers/llvm/16/libunwind/default.nix deleted file mode 100644 index 1b677a7a2c0d7..0000000000000 --- a/pkgs/development/compilers/llvm/16/libunwind/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/16/lld/default.nix b/pkgs/development/compilers/llvm/16/lld/default.nix deleted file mode 100644 index 84943e8effce1..0000000000000 --- a/pkgs/development/compilers/llvm/16/lld/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ./add-table-base.patch - ]; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/16/openmp/default.nix b/pkgs/development/compilers/llvm/16/openmp/default.nix deleted file mode 100644 index d51335436ad23..0000000000000 --- a/pkgs/development/compilers/llvm/16/openmp/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, monorepoSrc -, runCommand -, cmake -, ninja -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, xcbuild -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./fix-find-tool.patch - ./gnu-install-dirs.patch - ./run-lit-directly.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja perl pkg-config lit ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/17/default.nix b/pkgs/development/compilers/llvm/17/default.nix index fb3e967cc39b8..70571b30b3a6e 100644 --- a/pkgs/development/compilers/llvm/17/default.nix +++ b/pkgs/development/compilers/llvm/17/default.nix @@ -136,7 +136,11 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ./lld/add-table-base.patch + ]; inherit llvm_meta; }; @@ -312,12 +316,17 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/fix-find-tool.patch + ./openmp/gnu-install-dirs.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/17/libunwind/default.nix b/pkgs/development/compilers/llvm/17/libunwind/default.nix deleted file mode 100644 index a3c8e2594f5a7..0000000000000 --- a/pkgs/development/compilers/llvm/17/libunwind/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/17/lld/default.nix b/pkgs/development/compilers/llvm/17/lld/default.nix deleted file mode 100644 index 84943e8effce1..0000000000000 --- a/pkgs/development/compilers/llvm/17/lld/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ./add-table-base.patch - ]; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/17/openmp/default.nix b/pkgs/development/compilers/llvm/17/openmp/default.nix deleted file mode 100644 index d51335436ad23..0000000000000 --- a/pkgs/development/compilers/llvm/17/openmp/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, monorepoSrc -, runCommand -, cmake -, ninja -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, xcbuild -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./fix-find-tool.patch - ./gnu-install-dirs.patch - ./run-lit-directly.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja perl pkg-config lit ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} diff --git a/pkgs/development/compilers/llvm/18/default.nix b/pkgs/development/compilers/llvm/18/default.nix index 5f7f67438f0f3..d5c2140e33e49 100644 --- a/pkgs/development/compilers/llvm/18/default.nix +++ b/pkgs/development/compilers/llvm/18/default.nix @@ -136,7 +136,10 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ]; inherit llvm_meta; }; @@ -312,12 +315,16 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/fix-find-tool.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/18/libunwind/default.nix b/pkgs/development/compilers/llvm/18/libunwind/default.nix deleted file mode 100644 index e67823ffb85c2..0000000000000 --- a/pkgs/development/compilers/llvm/18/libunwind/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/18/lld/default.nix b/pkgs/development/compilers/llvm/18/lld/default.nix deleted file mode 100644 index 24ff0933dd1d8..0000000000000 --- a/pkgs/development/compilers/llvm/18/lld/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ libllvm libxml2 ]; - - patches = [ - ./gnu-install-dirs.patch - ]; - - cmakeFlags = [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/common/libunwind/default.nix b/pkgs/development/compilers/llvm/common/libunwind/default.nix new file mode 100644 index 0000000000000..515914e6acb64 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/libunwind/default.nix @@ -0,0 +1,87 @@ +{ lib +, stdenv +, release_version +, patches ? [] +, src ? null +, llvm_meta +, version +, monorepoSrc ? null +, runCommand +, cmake +, ninja +, python3 +, libcxx +, enableShared ? !stdenv.hostPlatform.isStatic +}: +let + pname = "libunwind"; + src' = if monorepoSrc != null then + runCommand "${pname}-src-${version}" {} ('' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + mkdir -p "$out/libcxx" + cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" + cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" + mkdir -p "$out/llvm" + cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" + '' + lib.optionalString (lib.versionAtLeast release_version "15") '' + cp -r ${monorepoSrc}/llvm/utils "$out/llvm" + cp -r ${monorepoSrc}/runtimes "$out" + '') else src; + + hasPatches = builtins.length patches > 0; + + postUnpack = lib.optionalString (lib.versions.major release_version == "12") '' + ln -s ${libcxx.src}/libcxx . + ln -s ${libcxx.src}/llvm . + ''; + + prePatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' + cd ../${pname} + chmod -R u+w . + ''; + + postPatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' + cd ../runtimes + ''; + + postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' + # libcxxabi wants to link to libunwind_shared.so (?). + ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so + ''; +in +stdenv.mkDerivation (rec { + inherit pname version patches; + + src = src'; + + sourceRoot = + if lib.versionOlder release_version "13" then null + else if lib.versionAtLeast release_version "15" then "${src.name}/runtimes" + else "${src.name}/${pname}"; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ cmake ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ + ninja python3 + ]; + + cmakeFlags = lib.optional (lib.versionAtLeast release_version "15") "-DLLVM_ENABLE_RUNTIMES=libunwind" + ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; + + meta = llvm_meta // { + # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst + homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; + description = "LLVM's unwinder library"; + longDescription = '' + The unwind library provides a family of _Unwind_* functions implementing + the language-neutral stack unwinding portion of the Itanium C++ ABI (Level + I). It is a dependency of the C++ ABI library, and sometimes is a + dependency of other runtimes. + ''; + }; +} // (if postUnpack != "" then { inherit postUnpack; } else {}) + // (if (lib.versionAtLeast release_version "15") then { inherit postInstall; } else {}) + // (if prePatch != "" then { inherit prePatch; } else {}) + // (if postPatch != "" then { inherit postPatch; } else {})) diff --git a/pkgs/development/compilers/llvm/12/lld/default.nix b/pkgs/development/compilers/llvm/common/lld/default.nix index 01b7e410aa073..be296be91e770 100644 --- a/pkgs/development/compilers/llvm/12/lld/default.nix +++ b/pkgs/development/compilers/llvm/common/lld/default.nix @@ -1,35 +1,58 @@ -{ lib, stdenv, llvm_meta +{ lib +, stdenv +, llvm_meta +, release_version +, patches ? [] , buildLlvmTools -, fetch -, libunwind +, monorepoSrc ? null +, src ? null +, libunwind ? null +, runCommand , cmake +, ninja , libxml2 , libllvm , version }: - -stdenv.mkDerivation rec { +let pname = "lld"; - inherit version; - - src = fetch pname "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9"; - - patches = [ - ./gnu-install-dirs.patch - ]; + src' = + if monorepoSrc != null then + runCommand "lld-src-${version}" {} '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + mkdir -p "$out/libunwind" + cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" + mkdir -p "$out/llvm" + '' else src; - postPatch = '' + postPatch = lib.optionalString (lib.versions.major release_version == "12") '' substituteInPlace MachO/CMakeLists.txt --replace \ '(''${LLVM_MAIN_SRC_DIR}/' '(' mkdir -p libunwind/include tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/" + '' + lib.optionalString (lib.versions.major release_version == "13" && stdenv.isDarwin) '' + substituteInPlace MachO/CMakeLists.txt --replace \ + '(''${LLVM_MAIN_SRC_DIR}/' '(../' ''; +in +stdenv.mkDerivation (rec { + inherit pname version patches; + + src = src'; + + sourceRoot = + if lib.versionOlder release_version "13" then null + else "${src.name}/${pname}"; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ cmake ] ++ lib.optional (lib.versionAtLeast release_version "15") ninja; buildInputs = [ libllvm libxml2 ]; - cmakeFlags = [ + cmakeFlags = lib.optionals (lib.versionOlder release_version "14") [ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" + ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ + "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" ]; @@ -51,4 +74,4 @@ stdenv.mkDerivation rec { of several different linkers. ''; }; -} +} // (if (postPatch == "" && lib.versions.major release_version != "13") then {} else { inherit postPatch; })) diff --git a/pkgs/development/compilers/llvm/18/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix index e1c3c2379af2a..7d9d813f024c7 100644 --- a/pkgs/development/compilers/llvm/18/openmp/default.nix +++ b/pkgs/development/compilers/llvm/common/openmp/default.nix @@ -1,7 +1,10 @@ { lib , stdenv , llvm_meta -, monorepoSrc +, release_version +, patches ? [] +, monorepoSrc ? null +, src ? null , runCommand , cmake , ninja @@ -14,43 +17,47 @@ , xcbuild , version }: - -stdenv.mkDerivation rec { +let pname = "openmp"; - inherit version; + src' = + if monorepoSrc != null then + runCommand "${pname}-src-${version}" {} '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + '' else src; +in +stdenv.mkDerivation (rec { + inherit pname version patches; - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; + src = src'; - sourceRoot = "${src.name}/${pname}"; + sourceRoot = + if lib.versionOlder release_version "13" then null + else "${src.name}/${pname}"; - patches = [ - ./fix-find-tool.patch - ./run-lit-directly.patch - ]; + outputs = [ "out" ] + ++ lib.optionals (lib.versionAtLeast release_version "14") [ "dev" ]; - outputs = [ "out" "dev" ]; + patchFlags = + if lib.versionOlder release_version "14" then [ "-p2" ] + else null; + + nativeBuildInputs = [ + cmake + ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ + ninja + ] ++ [ perl ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ + pkg-config lit + ]; - nativeBuildInputs = [ cmake ninja perl pkg-config lit ]; buildInputs = [ (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) ]; - nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ + cmakeFlags = lib.optionals (lib.versions.major release_version == "13") [ + "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL fails + ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" "-DOPT_TOOL=${llvm}/bin/opt" "-DLINK_TOOL=${llvm}/bin/llvm-link" @@ -70,4 +77,10 @@ stdenv.mkDerivation rec { # License (a BSD-like license)": license = with lib.licenses; [ mit ncsa ]; }; -} +} // (lib.optionalAttrs (lib.versionAtLeast release_version "14") { + doCheck = false; + checkTarget = "check-openmp"; + preCheck = '' + patchShebangs ../tools/archer/tests/deflake.bash + ''; +})) diff --git a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix index f51316beb5705..606ae2868893d 100644 --- a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix @@ -81,6 +81,8 @@ stdenv.mkDerivation { # `COMPILER_RT_DEFAULT_TARGET_ONLY` does not apply to Darwin: # https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/base-config-ix.cmake#L153 "-DCOMPILER_RT_ENABLE_IOS=OFF" + ] ++ lib.optionals (lib.versionAtLeast version "19" && stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [ + "-DSANITIZER_MIN_OSX_VERSION=10.10" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index bd21a75b8c2fc..d578c2a290e23 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -19,9 +19,9 @@ # LLVM release information; specify one of these but not both: , gitRelease ? { version = "19.0.0-git"; - rev = "65058a8d732c3c41664a4dad1a1ae2a504d5c98e"; - rev-version = "19.0.0-unstable-2024-03-16"; - sha256 = "sha256-xV33kx/8OZ2KLtaz25RmudDrlIX7nScauTykf87jyTE="; + rev = "cebf77fb936a7270c7e3fa5c4a7e76216321d385"; + rev-version = "19.0.0-unstable-2024-04-07"; + sha256 = "sha256-616tscgsiFgHQcXW4KzK5srrudYizQFnJVM6K0qRf+I="; } # i.e.: # { @@ -141,7 +141,10 @@ in let extraBuildCommands = mkExtraBuildCommands cc; }; - lld = callPackage ./lld { + lld = callPackage ../common/lld { + patches = [ + ./lld/gnu-install-dirs.patch + ]; inherit llvm_meta; }; @@ -317,12 +320,16 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - openmp = callPackage ./openmp { + openmp = callPackage ../common/openmp { + patches = [ + ./openmp/fix-find-tool.patch + ./openmp/run-lit-directly.patch + ]; inherit llvm_meta targetLlvm; }; }); diff --git a/pkgs/development/compilers/llvm/git/libunwind/default.nix b/pkgs/development/compilers/llvm/git/libunwind/default.nix deleted file mode 100644 index e67823ffb85c2..0000000000000 --- a/pkgs/development/compilers/llvm/git/libunwind/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/git/lld/default.nix b/pkgs/development/compilers/llvm/git/lld/default.nix deleted file mode 100644 index 24ff0933dd1d8..0000000000000 --- a/pkgs/development/compilers/llvm/git/lld/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ lib, stdenv, llvm_meta -, buildLlvmTools -, monorepoSrc, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: - -stdenv.mkDerivation rec { - pname = "lld"; - inherit version; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ libllvm libxml2 ]; - - patches = [ - ./gnu-install-dirs.patch - ]; - - cmakeFlags = [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # 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"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "The LLVM linker (unwrapped)"; - longDescription = '' - LLD is a linker from the LLVM project that is a drop-in replacement for - system linkers and runs much faster than them. It also provides features - that are useful for toolchain developers. - The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and - WebAssembly in descending order of completeness. Internally, LLD consists - of several different linkers. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix index a9732763e9d7b..8987103e22fe5 100644 --- a/pkgs/development/compilers/llvm/git/llvm/default.nix +++ b/pkgs/development/compilers/llvm/git/llvm/default.nix @@ -214,10 +214,6 @@ stdenv.mkDerivation (rec { # TODO(@rrbutani): fix/follow-up substituteInPlace unittests/TargetParser/Host.cpp \ --replace "getMacOSHostVersion" "DISABLED_getMacOSHostVersion" - - # This test fails with a `dysmutil` crash; have not yet dug into what's - # going on here (TODO(@rrbutani)). - rm test/tools/dsymutil/ARM/obfuscated.test '' + '' # FileSystem permissions tests fail with various special bits substituteInPlace unittests/Support/CMakeLists.txt \ diff --git a/pkgs/development/compilers/llvm/git/openmp/default.nix b/pkgs/development/compilers/llvm/git/openmp/default.nix deleted file mode 100644 index e1c3c2379af2a..0000000000000 --- a/pkgs/development/compilers/llvm/git/openmp/default.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, monorepoSrc -, runCommand -, cmake -, ninja -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, xcbuild -, version -}: - -stdenv.mkDerivation rec { - pname = "openmp"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./fix-find-tool.patch - ./run-lit-directly.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja perl pkg-config lit ]; - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; - - # Unsup:Pass:XFail:Fail - # 26:267:16:8 - doCheck = false; - checkTarget = "check-openmp"; - - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; - - cmakeFlags = [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} |