circt: 1.147.0 -> 1.160.0 (#546434)

This commit is contained in:
Peder Bergebakken Sundt
2026-09-30 11:58:46 +00:00
committed by GitHub
3 changed files with 151 additions and 8 deletions

View File

@@ -9,11 +9,9 @@
ninja,
lit,
z3,
sv-lang_10, # update sv-lang version here according to upstream requirements
fmt,
boost,
mimalloc,
gitUpdater,
callPackage,
versionCheckHook,
@@ -24,15 +22,16 @@
let
pythonEnv = python3.withPackages (ps: [ ps.psutil ]);
circt-llvm = callPackage ./circt-llvm.nix { };
circt-sv-lang = callPackage ./sv-lang.nix { };
in
stdenv.mkDerivation (finalAttrs: {
pname = "circt";
version = "1.147.0";
version = "1.160.0";
src = fetchFromGitHub {
owner = "llvm";
repo = "circt";
tag = "firtool-${finalAttrs.version}";
hash = "sha256-rtnvahI7EzUJXE80X3XPWjjDD/6f9BPmZ7S97Lstuhw=";
hash = "sha256-KWh1z2Pvf+BVyzv6+ruaQRAULrIX9T1WjnIhpuTjzNc=";
fetchSubmodules = true;
};
@@ -55,7 +54,7 @@ stdenv.mkDerivation (finalAttrs: {
boost
fmt
mimalloc
sv-lang_10
circt-sv-lang
];
cmakeFlags = [
@@ -112,6 +111,12 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
patchShebangs tools/circt-test
# Keep the self-contained TableGen tests compatible with nixpkgs' lit.
substituteInPlace test/Tools/circt-tblgen/self-contained/self_contained_td_format.py \
--replace-fail \
'timeout = test.config.maxIndividualTestTime or None' \
'timeout = getattr(test.config, "maxIndividualTestTime", None)'
# Replace slang references to match the package in nixpkgs
substituteInPlace \
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/CMakeLists.txt \
@@ -169,10 +174,9 @@ stdenv.mkDerivation (finalAttrs: {
'';
passthru = {
updateScript = gitUpdater {
rev-prefix = "firtool-";
};
updateScript = ./update.sh;
llvm = circt-llvm;
sv-lang = circt-sv-lang;
};
meta = {

View File

@@ -0,0 +1,68 @@
# CIRCT depends on a specific sv-lang revision, so pin it separately from nixpkgs' sv-lang.
{
lib,
stdenv,
fetchFromGitHub,
boost,
catch2_3,
cmake,
ninja,
fmt,
llvmPackages,
mimalloc,
python3,
tomlplusplus,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "circt-sv-lang";
version = "11.0";
src = fetchFromGitHub {
owner = "MikePopoloski";
repo = "slang";
rev = "44dc55f99b9c64971893013e7931e643fbedcf23";
hash = "sha256-tKse5rV5kHZmCOb8Zb8k4bOw4wN3pDfY5exdpva57bU=";
};
__structuredAttrs = true;
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
python3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Needed for the wrapped clang-scan-deps to find the C++20 module headers.
llvmPackages.clang-tools
];
buildInputs = [
boost
catch2_3
fmt
mimalloc
];
propagatedBuildInputs = [
tomlplusplus
];
cmakeFlags = [
# Keep installation paths compatible with the CIRCT build.
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeBool "SLANG_INCLUDE_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "SLANG_USE_SYSTEM_TOMLPLUSPLUS" true)
];
doCheck = true;
meta = {
description = "SystemVerilog compiler and language services pinned for CIRCT";
homepage = "https://github.com/MikePopoloski/slang";
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
})

71
pkgs/by-name/ci/circt/update.sh Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=. -i bash -p bash coreutils gnugrep jq gnused nix nix-prefetch-git nix-prefetch-github common-updater-scripts
# shellcheck shell=bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(realpath "$ROOT/../../../..")"
cd "$REPO_ROOT"
# Make the checkout available to the nested Nix invocations as well.
export NIX_PATH="nixpkgs=$REPO_ROOT${NIX_PATH:+:$NIX_PATH}"
attrPath="${UPDATE_NIX_ATTR_PATH:-circt}"
# CIRCT publishes firtool releases as firtool-<version> Git tags. Find the
# highest version rather than relying on the ordering returned by GitHub.
latestVersion=$(
list-git-tags --url=https://github.com/llvm/circt.git |
sed -n 's/^firtool-//p' |
sort --version-sort |
tail -n1
)
currentVersion="${UPDATE_NIX_OLD_VERSION:-$(nix-instantiate --eval --strict --raw -A "$attrPath.version" .)}"
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "CIRCT is up to date: $currentVersion"
exit 0
fi
echo "updating CIRCT from $currentVersion to $latestVersion"
update-source-version "$attrPath" "$latestVersion"
# Build only the updated source derivation so its CMakeLists.txt can tell us
# which exact slang revision this CIRCT release expects.
src=$(nix-build --no-out-link -A "$attrPath.src")
# CMakeLists.txt contains several FetchContent declarations and therefore
# several GIT_TAG lines. First isolate the declaration for the slang repository,
# then extract its nearby GIT_TAG. The tag may be followed by a comment or end
# immediately after the revision.
slangRev=$(
grep -A5 "https://github.com/MikePopoloski/slang" "$src/CMakeLists.txt" |
sed -nE 's/.*GIT_TAG[[:space:]]+([0-9a-f]{40}).*/\1/p' |
head -n1
)
if [[ -z "$slangRev" ]]; then
echo "failed to find slang GIT_TAG in $src/CMakeLists.txt" >&2
exit 1
fi
# Prefetch slang independently because CIRCT's source hash does not cover
# FetchContent dependencies when CIRCT uses a system-provided slang package.
slangHash=$(
nix-prefetch-github MikePopoloski slang --rev "$slangRev" |
jq --exit-status --raw-output .hash
)
currentSlangRev=$(nix-instantiate --eval --strict --raw -A "$attrPath.passthru.sv-lang.src.rev" .)
currentSlangHash=$(nix-instantiate --eval --strict --raw -A "$attrPath.passthru.sv-lang.src.outputHash" .)
# Keep the private sv-lang override synchronized with the revision declared by
# CIRCT without changing the version of nixpkgs' general sv-lang package.
if [[ "$currentSlangRev" != "$slangRev" || "$currentSlangHash" != "$slangHash" ]]; then
echo "updating slang from $currentSlangRev to $slangRev"
sed -i \
-e "s|$currentSlangRev|$slangRev|" \
-e "s|$currentSlangHash|$slangHash|" \
"$ROOT/sv-lang.nix"
else
echo "slang is up to date: $slangRev"
fi