From 436960830627e55d8e6c601be064ceda52ec6f6c Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Tue, 1 Aug 2023 14:25:04 +0900 Subject: [PATCH 1/3] circt: 1.45.0 -> 1.48.0 --- pkgs/development/compilers/circt/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/circt/default.nix b/pkgs/development/compilers/circt/default.nix index 7e7f6823bcfd..f74ec33966c9 100644 --- a/pkgs/development/compilers/circt/default.nix +++ b/pkgs/development/compilers/circt/default.nix @@ -13,12 +13,12 @@ let in stdenv.mkDerivation rec { pname = "circt"; - version = "1.45.0"; + version = "1.48.0"; src = fetchFromGitHub { owner = "llvm"; repo = "circt"; rev = "firtool-${version}"; - sha256 = "sha256-yzXYiqRIwV3bkMfvmduow3QWJASXhOspM8CHZPN2/uE="; + sha256 = "sha256-8mqh3PPfB50ZkiJ+1OjclWw19t6OLv1mNiVkBnDz5jQ="; fetchSubmodules = true; }; From 444797ac0240a84157d685ab9513bfc7bdd568ff Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Tue, 1 Aug 2023 14:25:49 +0900 Subject: [PATCH 2/3] circt: fix version info --- .../compilers/circt/circt-version.diff | 34 +++++++++++++++++++ pkgs/development/compilers/circt/default.nix | 8 +++++ 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/compilers/circt/circt-version.diff diff --git a/pkgs/development/compilers/circt/circt-version.diff b/pkgs/development/compilers/circt/circt-version.diff new file mode 100644 index 000000000000..94ece9ec45f7 --- /dev/null +++ b/pkgs/development/compilers/circt/circt-version.diff @@ -0,0 +1,34 @@ +diff --git a/cmake/modules/GenVersionFile.cmake b/cmake/modules/GenVersionFile.cmake +index 570088f39..700399173 100644 +--- a/cmake/modules/GenVersionFile.cmake ++++ b/cmake/modules/GenVersionFile.cmake +@@ -6,27 +6,8 @@ + # DRY_RUN - If true, make the version unknown. + # SOURCE_ROOT - Path to root directory of source + +-set(GIT_DESCRIBE_DEFAULT "unknown git version") +-if (DRY_RUN) +- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") +-else () +- message(STATUS "Generating ${OUT_FILE} from ${IN_FILE} by `git describe --dirty --tags --match ${RELEASE_PATTERN}`") +- find_package(Git QUIET) +- if (Git_FOUND) +- execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty --tags --match ${RELEASE_PATTERN} +- WORKING_DIRECTORY "${SOURCE_ROOT}" +- RESULT_VARIABLE GIT_OUTPUT_RESULT +- OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT +- OUTPUT_STRIP_TRAILING_WHITESPACE) +- if (NOT ${GIT_OUTPUT_RESULT} EQUAL 0) +- message(WARNING "git describe failed, set version to ${GIT_DESCRIBE_DEFAULT}") +- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") +- endif () +- else () +- message(WARNING "Git not found: ${GIT_EXECUTABLE}, set version to ${GIT_DESCRIBE_DEFAULT}") +- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") +- endif () +-endif() ++message(WARNING "Git can't be used in the nix build system, set version to ${GIT_DESCRIBE_OUTPUT}") ++set(GIT_DESCRIBE_OUTPUT "@version@") + + # This command will prepend CMAKE_CURRENT_{SOURCE,BINARY}_DIR if or is relative, + # that's why I need IN_FILE and OUT_FILE to be absolute path. \ No newline at end of file diff --git a/pkgs/development/compilers/circt/default.nix b/pkgs/development/compilers/circt/default.nix index f74ec33966c9..17f49810ed24 100644 --- a/pkgs/development/compilers/circt/default.nix +++ b/pkgs/development/compilers/circt/default.nix @@ -6,6 +6,7 @@ , git , fetchFromGitHub , ninja +, substituteAll }: let @@ -22,6 +23,13 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + patches = [ + # circt uses git to check its version, + # but when cloned on nix it can't access git. + # So this patch hard codes the version. + (substituteAll { src = ./circt-version.diff; version = src.rev; }) + ]; + requiredSystemFeatures = [ "big-parallel" ]; nativeBuildInputs = [ cmake ninja git pythonEnv ]; From 2838d990639de962915b9701b1b0e3bc85938265 Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Tue, 1 Aug 2023 16:07:04 +0900 Subject: [PATCH 3/3] circt: refactor patch to substituteInPlace --- .../compilers/circt/circt-version.diff | 34 ------------------- pkgs/development/compilers/circt/default.nix | 11 ++---- 2 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 pkgs/development/compilers/circt/circt-version.diff diff --git a/pkgs/development/compilers/circt/circt-version.diff b/pkgs/development/compilers/circt/circt-version.diff deleted file mode 100644 index 94ece9ec45f7..000000000000 --- a/pkgs/development/compilers/circt/circt-version.diff +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/cmake/modules/GenVersionFile.cmake b/cmake/modules/GenVersionFile.cmake -index 570088f39..700399173 100644 ---- a/cmake/modules/GenVersionFile.cmake -+++ b/cmake/modules/GenVersionFile.cmake -@@ -6,27 +6,8 @@ - # DRY_RUN - If true, make the version unknown. - # SOURCE_ROOT - Path to root directory of source - --set(GIT_DESCRIBE_DEFAULT "unknown git version") --if (DRY_RUN) -- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") --else () -- message(STATUS "Generating ${OUT_FILE} from ${IN_FILE} by `git describe --dirty --tags --match ${RELEASE_PATTERN}`") -- find_package(Git QUIET) -- if (Git_FOUND) -- execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty --tags --match ${RELEASE_PATTERN} -- WORKING_DIRECTORY "${SOURCE_ROOT}" -- RESULT_VARIABLE GIT_OUTPUT_RESULT -- OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT -- OUTPUT_STRIP_TRAILING_WHITESPACE) -- if (NOT ${GIT_OUTPUT_RESULT} EQUAL 0) -- message(WARNING "git describe failed, set version to ${GIT_DESCRIBE_DEFAULT}") -- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") -- endif () -- else () -- message(WARNING "Git not found: ${GIT_EXECUTABLE}, set version to ${GIT_DESCRIBE_DEFAULT}") -- set(GIT_DESCRIBE_OUTPUT "${GIT_DESCRIBE_DEFAULT}") -- endif () --endif() -+message(WARNING "Git can't be used in the nix build system, set version to ${GIT_DESCRIBE_OUTPUT}") -+set(GIT_DESCRIBE_OUTPUT "@version@") - - # This command will prepend CMAKE_CURRENT_{SOURCE,BINARY}_DIR if or is relative, - # that's why I need IN_FILE and OUT_FILE to be absolute path. \ No newline at end of file diff --git a/pkgs/development/compilers/circt/default.nix b/pkgs/development/compilers/circt/default.nix index 17f49810ed24..8e2a009a1db2 100644 --- a/pkgs/development/compilers/circt/default.nix +++ b/pkgs/development/compilers/circt/default.nix @@ -6,7 +6,6 @@ , git , fetchFromGitHub , ninja -, substituteAll }: let @@ -23,13 +22,6 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; - patches = [ - # circt uses git to check its version, - # but when cloned on nix it can't access git. - # So this patch hard codes the version. - (substituteAll { src = ./circt-version.diff; version = src.rev; }) - ]; - requiredSystemFeatures = [ "big-parallel" ]; nativeBuildInputs = [ cmake ninja git pythonEnv ]; @@ -62,6 +54,9 @@ stdenv.mkDerivation rec { preConfigure = '' find ./test -name '*.mlir' -exec sed -i 's|/usr/bin/env|${coreutils}/bin/env|g' {} \; + # circt uses git to check its version, but when cloned on nix it can't access git. + # So this hard codes the version. + substituteInPlace cmake/modules/GenVersionFile.cmake --replace "unknown git version" "${src.rev}" ''; installPhase = ''