about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-12-12 14:13:07 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-12-12 14:13:07 +0100
commite8dd1cf066d9e605f72e4ce2dd6c4bef1ac76986 (patch)
tree55dc535219143a2baacdd71941ee17d0917da93b /pkgs/development/compilers
parent14b1b887952e70c12c6b8fc4ee9c1e22ec32faa6 (diff)
parent2525630f4bf6285a6031ad6785da6a3f8e323dd7 (diff)
Merge remote-tracking branch 'origin/staging-next' into staging
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/binaryen/default.nix1
-rw-r--r--pkgs/development/compilers/circt/circt-llvm.nix59
-rw-r--r--pkgs/development/compilers/circt/default.nix42
-rw-r--r--pkgs/development/compilers/dmd/default.nix6
-rw-r--r--pkgs/development/compilers/dmd/generic.nix8
-rw-r--r--pkgs/development/compilers/fasm/bin.nix22
-rw-r--r--pkgs/development/compilers/unison/default.nix6
7 files changed, 103 insertions, 41 deletions
diff --git a/pkgs/development/compilers/binaryen/default.nix b/pkgs/development/compilers/binaryen/default.nix
index 6473d53fbaba6..7b616faf8d8dc 100644
--- a/pkgs/development/compilers/binaryen/default.nix
+++ b/pkgs/development/compilers/binaryen/default.nix
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
     hash = "sha256-gMwbWiP+YDCVafQMBWhTuJGWmkYtnhEdn/oofKaUT08=";
   };
 
+  # FIXME: remove for next release
   patches = [
     (fetchpatch {
       name = "nodejs-20.patch";
diff --git a/pkgs/development/compilers/circt/circt-llvm.nix b/pkgs/development/compilers/circt/circt-llvm.nix
new file mode 100644
index 0000000000000..b3005af55fbbd
--- /dev/null
+++ b/pkgs/development/compilers/circt/circt-llvm.nix
@@ -0,0 +1,59 @@
+{ stdenv
+, cmake
+, ninja
+, circt
+, llvm
+, python3
+}: stdenv.mkDerivation {
+  pname = circt.pname + "-llvm";
+  inherit (circt) version src;
+
+  requiredSystemFeatures = [ "big-parallel" ];
+
+  nativeBuildInputs = [ cmake ninja python3 ];
+
+  preConfigure = ''
+    cd llvm/llvm
+  '';
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DLLVM_ENABLE_BINDINGS=OFF"
+    "-DLLVM_ENABLE_OCAMLDOC=OFF"
+    "-DLLVM_BUILD_EXAMPLES=OFF"
+    "-DLLVM_OPTIMIZED_TABLEGEN=ON"
+    "-DLLVM_ENABLE_PROJECTS=mlir"
+    "-DLLVM_TARGETS_TO_BUILD="
+
+    # This option is needed to install llvm-config
+    "-DLLVM_INSTALL_UTILS=ON"
+  ];
+
+  outputs = [ "out" "lib" "dev" ];
+
+  postInstall = ''
+    # move llvm-config to $dev to resolve a circular dependency
+    moveToOutput "bin/llvm-config*" "$dev"
+
+    # move all lib files to $lib except lib/cmake
+    moveToOutput "lib" "$lib"
+    moveToOutput "lib/cmake" "$dev"
+
+    # patch configuration files so each path points to the new $lib or $dev paths
+    substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+      --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "'"$lib"'")'
+    substituteInPlace \
+      "$dev/lib/cmake/llvm/LLVMExports-release.cmake" \
+      "$dev/lib/cmake/mlir/MLIRTargets-release.cmake" \
+      --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+      --replace "\''${_IMPORT_PREFIX}/lib/objects-Release" "$lib/lib/objects-Release" \
+      --replace "$out/bin/llvm-config" "$dev/bin/llvm-config" # patch path for llvm-config
+  '';
+
+  doCheck = true;
+  checkTarget = "check-mlir";
+
+  meta = llvm.meta // {
+    inherit (circt.meta) maintainers;
+  };
+}
diff --git a/pkgs/development/compilers/circt/default.nix b/pkgs/development/compilers/circt/default.nix
index 4c4f69bc74ff2..6fb609699bad4 100644
--- a/pkgs/development/compilers/circt/default.nix
+++ b/pkgs/development/compilers/circt/default.nix
@@ -6,36 +6,37 @@
 , git
 , fetchFromGitHub
 , ninja
+, lit
 , gitUpdater
+, callPackage
 }:
 
 let
   pythonEnv = python3.withPackages (ps: [ ps.psutil ]);
+  circt-llvm = callPackage ./circt-llvm.nix { };
 in
 stdenv.mkDerivation rec {
   pname = "circt";
-  version = "1.59.0";
+  version = "1.61.0";
   src = fetchFromGitHub {
     owner = "llvm";
     repo = "circt";
     rev = "firtool-${version}";
-    sha256 = "sha256-HsfvLxXyYvzUL+FO/i8iRbyQV8OFF3Cx8/g8/9aJE2M=";
+    sha256 = "sha256-3zuaruaveUeJ7uKP5fMiDFPOGKcs6aTNuGOuhxV6nss=";
     fetchSubmodules = true;
   };
 
   requiredSystemFeatures = [ "big-parallel" ];
 
   nativeBuildInputs = [ cmake ninja git pythonEnv ];
+  buildInputs = [ circt-llvm ];
 
-  cmakeDir = "../llvm/llvm";
   cmakeFlags = [
-    "-DLLVM_ENABLE_BINDINGS=OFF"
-    "-DLLVM_ENABLE_OCAMLDOC=OFF"
-    "-DLLVM_BUILD_EXAMPLES=OFF"
-    "-DLLVM_OPTIMIZED_TABLEGEN=ON"
-    "-DLLVM_ENABLE_PROJECTS=mlir"
-    "-DLLVM_EXTERNAL_PROJECTS=circt"
-    "-DLLVM_EXTERNAL_CIRCT_SOURCE_DIR=.."
+    "-DBUILD_SHARED_LIBS=ON"
+    "-DMLIR_DIR=${circt-llvm.dev}/lib/cmake/mlir"
+
+    # LLVM_EXTERNAL_LIT is executed by python3, the wrapped bash script will not work
+    "-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
     "-DCIRCT_LLHD_SIM_ENABLED=OFF"
   ];
 
@@ -60,18 +61,20 @@ stdenv.mkDerivation rec {
     substituteInPlace cmake/modules/GenVersionFile.cmake --replace "unknown git version" "${src.rev}"
   '';
 
-  installPhase = ''
-    runHook preInstall
-    mkdir -p $out/bin
-    mv bin/{{fir,hls}tool,circt-{as,dis,lsp-server,opt,reduce,translate}} $out/bin
-    runHook postInstall
-  '';
-
   doCheck = true;
   checkTarget = "check-circt check-circt-integration";
 
-  passthru.updateScript = gitUpdater {
-    rev-prefix = "firtool-";
+  outputs = [ "out" "lib" "dev" ];
+
+  postInstall = ''
+    moveToOutput lib "$lib"
+  '';
+
+  passthru = {
+    updateScript = gitUpdater {
+      rev-prefix = "firtool-";
+    };
+    llvm = circt-llvm;
   };
 
   meta = {
@@ -82,4 +85,3 @@ stdenv.mkDerivation rec {
     platforms = lib.platforms.all;
   };
 }
-
diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix
index f73804874cc62..59a8ad8c63c65 100644
--- a/pkgs/development/compilers/dmd/default.nix
+++ b/pkgs/development/compilers/dmd/default.nix
@@ -1,5 +1,5 @@
 import ./generic.nix {
-  version = "2.105.2";
-  dmdSha256 = "sha256-IjzIQZttB1711VayKDWcpYvf1MAan+GWGTdpdDTgo1k=";
-  phobosSha256 = "sha256-2hAq48sBC1qvS1XBWZhGIPUlsA4pGcn4pHNok6lC8R0=";
+  version = "2.106.0";
+  dmdSha256 = "sha256-H28X+8qAjnc5KIvZ7HRVCtjNpf1hBwSPL6QIVeWCjKM=";
+  phobosSha256 = "sha256-umsPMQbomJUu/QBMSgSC0jEajxiJwv1Lay4q4tvfnsI=";
 }
diff --git a/pkgs/development/compilers/dmd/generic.nix b/pkgs/development/compilers/dmd/generic.nix
index 0f6abb574a597..5cf07454141bc 100644
--- a/pkgs/development/compilers/dmd/generic.nix
+++ b/pkgs/development/compilers/dmd/generic.nix
@@ -96,6 +96,7 @@ stdenv.mkDerivation rec {
     rm dmd/compiler/test/runnable/gdb15729.sh
     rm dmd/compiler/test/runnable/gdb4149.d
     rm dmd/compiler/test/runnable/gdb4181.d
+    rm dmd/compiler/test/compilable/ddocYear.d
 
     # Disable tests that rely on objdump whitespace until fixed upstream:
     #   https://issues.dlang.org/show_bug.cgi?id=23317
@@ -103,12 +104,7 @@ stdenv.mkDerivation rec {
     rm dmd/compiler/test/compilable/cdcmp.d
   ''
 
-  + lib.optionalString (lib.versionOlder version "2.091.0") ''
-    # This one has tested against a hardcoded year, then against a current year on
-    # and off again. It just isn't worth it to patch all the historical versions
-    # of it, so just remove it until the most recent change.
-    rm dmd/compiler/test/compilable/ddocYear.d
-  '' + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") ''
+  + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") ''
     rm dmd/compiler/test/dshell/test6952.d
   '' + lib.optionalString (lib.versionAtLeast version "2.092.2") ''
     substituteInPlace dmd/compiler/test/dshell/test6952.d --replace "/usr/bin/env bash" "${bash}/bin/bash"
diff --git a/pkgs/development/compilers/fasm/bin.nix b/pkgs/development/compilers/fasm/bin.nix
index e894d2607bc00..f23e9540928ab 100644
--- a/pkgs/development/compilers/fasm/bin.nix
+++ b/pkgs/development/compilers/fasm/bin.nix
@@ -1,24 +1,28 @@
 { stdenvNoCC, lib, fetchurl }:
 
-stdenvNoCC.mkDerivation rec {
+stdenvNoCC.mkDerivation (finalAttrs: {
   pname = "fasm-bin";
-
-  version = "1.73.31";
+  version = "1.73.32";
 
   src = fetchurl {
-    url = "https://flatassembler.net/fasm-${version}.tgz";
-    sha256 = "sha256-jzjLIayR+xulSGKhvQ9VxWhZC6qRZ/4IHSe3lD8LD+M=";
+    url = "https://flatassembler.net/fasm-${finalAttrs.version}.tgz";
+    hash = "sha256-WVXL4UNWXa9e7K3MSS0CXK3lczgog9V4XUoYChvvym8=";
   };
 
   installPhase = ''
+    runHook preInstall
+
     install -D fasm${lib.optionalString stdenvNoCC.isx86_64 ".x64"} $out/bin/fasm
+
+    runHook postInstall
   '';
 
-  meta = with lib; {
+  meta = {
     description = "x86(-64) macro assembler to binary, MZ, PE, COFF, and ELF";
     homepage = "https://flatassembler.net/download.php";
-    license = licenses.bsd2;
-    maintainers = with maintainers; [ orivej ];
+    license = lib.licenses.bsd2;
+    mainProgram = "fasm";
+    maintainers = with lib.maintainers; [ orivej ];
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
-}
+})
diff --git a/pkgs/development/compilers/unison/default.nix b/pkgs/development/compilers/unison/default.nix
index fbbfba7ae1a56..392a699857a34 100644
--- a/pkgs/development/compilers/unison/default.nix
+++ b/pkgs/development/compilers/unison/default.nix
@@ -11,17 +11,17 @@
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "unison-code-manager";
-  version = "M5g";
+  version = "M5j";
 
   src = if stdenv.isDarwin then
     fetchurl {
       url = "https://github.com/unisonweb/unison/releases/download/release/${finalAttrs.version}/ucm-macos.tar.gz";
-      hash = "sha256-4E/8CfWmD+IVeXBqcTE74k2HZtk9dt/4G9GqBjVhtWo=";
+      hash = "sha256-CDm5a4TR8GfM8QK5mYmEb63PSz469X3R5LaikAcvILI=";
     }
   else
     fetchurl {
       url = "https://github.com/unisonweb/unison/releases/download/release/${finalAttrs.version}/ucm-linux.tar.gz";
-      hash = "sha256-Gl447CSuLgEPPHzgxPTIC8QXGgk/1moNqFU+Phv6e/U=";
+      hash = "sha256-5H4qOPh2tFgOp+uHNndwwh1K+Wb42Umfl0ok9Ixrlc8=";
     };
 
   # The tarball is just the prebuilt binary, in the archive root.