diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch b/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch new file mode 100644 index 000000000000..016e74415644 --- /dev/null +++ b/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch @@ -0,0 +1,28 @@ +compatibility with newer spdlog/fmt versions + +diff --git a/plugins/module_identification/src/api/module_identification.cpp b/plugins/module_identification/src/api/module_identification.cpp +index 808875e8a68..3cf3cf1fb8b 100644 +--- a/plugins/module_identification/src/api/module_identification.cpp ++++ b/plugins/module_identification/src/api/module_identification.cpp +@@ -406,7 +406,7 @@ namespace hal + + const u32 num_threads = std::min(config.m_max_thread_count, std::thread::hardware_concurrency() - 1); + +- log_info("module_identification", "running with {} threads and {} multithreading priority", num_threads, config.m_multithreading_priority); ++ log_info("module_identification", "running with {} threads and {} multithreading priority", num_threads, fmt::underlying(config.m_multithreading_priority)); + + auto stats = Statistics(); + +diff --git a/plugins/z3_utils/src/simplification.cpp b/plugins/z3_utils/src/simplification.cpp +index d64cab665f2..561fa7f1a23 100644 +--- a/plugins/z3_utils/src/simplification.cpp ++++ b/plugins/z3_utils/src/simplification.cpp +@@ -617,7 +617,7 @@ namespace hal + return false; + + default: { +- log_error("z3_utils", "commutative check not implemeted for type {}!", t); ++ log_error("z3_utils", "commutative check not implemeted for type {}!", fmt::underlying(t)); + return false; + } + } diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix b/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix index acf52931c7ed..e8c15c35f2f9 100644 --- a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix +++ b/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix @@ -8,6 +8,7 @@ , igraph , llvmPackages , ninja +, nlohmann_json , pkg-config , python3Packages , qtbase @@ -15,75 +16,36 @@ , quazip , rapidjson , spdlog -, suitesparse +, verilator , wrapQtAppsHook , z3 }: -let - # hal doesn't work with igraph 0.10.x yet https://github.com/emsec/hal/pull/487 - igraph' = igraph.overrideAttrs (final: prev: { - version = "0.9.10"; - src = fetchFromGitHub { - owner = "igraph"; - repo = final.pname; - rev = final.version; - hash = "sha256-prDadHsNhDRkNp1i0niKIYxE0g85Zs0ngvUy6uK8evk="; - }; - patches = (prev.patches or []) ++ [ - # needed by clang - (fetchpatch { - name = "libxml2-2.11-compat.patch"; - url = "https://github.com/igraph/igraph/commit/5ad464be5ae2f6ebb69c97cb0140c800cc8d97d6.patch"; - hash = "sha256-adU5SctH+H54UaAmr5BZInytD3wjUzLtQbCwngAWs4o="; - }) - ]; - postPatch = prev.postPatch + lib.optionalString stdenv.hostPlatform.isAarch64 '' - # https://github.com/igraph/igraph/issues/1694 - substituteInPlace tests/CMakeLists.txt \ - --replace "igraph_scg_grouping3" "" \ - --replace "igraph_scg_semiprojectors2" "" - ''; - NIX_CFLAGS_COMPILE = (prev.NIX_CFLAGS_COMPILE or []) ++ lib.optionals stdenv.cc.isClang [ - "-Wno-strict-prototypes" - "-Wno-unused-but-set-parameter" - "-Wno-unused-but-set-variable" - ]; - # general options brought back from the old 0.9.x package - buildInputs = prev.buildInputs ++ [ suitesparse ]; - cmakeFlags = prev.cmakeFlags ++ [ "-DIGRAPH_USE_INTERNAL_CXSPARSE=OFF" ]; - }); - -in stdenv.mkDerivation rec { - version = "4.2.0"; +stdenv.mkDerivation rec { + version = "4.4.1"; pname = "hal-hardware-analyzer"; src = fetchFromGitHub { owner = "emsec"; repo = "hal"; rev = "v${version}"; - sha256 = "sha256-Yl86AClE3vWygqj1omCOXX8koJK2SjTkMZFReRThez0="; + sha256 = "sha256-8kmYeqsmqR7tY044rZb3KuEAVGv37IObX6k1qjXWG0A="; }; patches = [ (fetchpatch { - name = "cmake-add-no-vendored-options.patch"; - # https://github.com/emsec/hal/pull/529 - url = "https://github.com/emsec/hal/commit/37d5c1a0eacb25de57cc552c13e74f559a5aa6e8.patch"; - hash = "sha256-a30VjDt4roJOTntisixqnH17wwCgWc4VWeh1+RgqFuY="; + name = "de-vendor-nlohmann-json.patch"; + # https://github.com/emsec/hal/pull/596 + url = "https://github.com/emsec/hal/commit/f8337d554d80cfa2588512696696fd4c878dd7a3.patch"; + hash = "sha256-QjgvcduwbFccC807JFOevlTfO3KiL9T3HSqYmh3sXAQ="; }) (fetchpatch { - name = "hal-fix-fmt-10.1-compat.patch"; - # https://github.com/emsec/hal/pull/530 - url = "https://github.com/emsec/hal/commit/b639a56b303141afbf6731b70b7cc7452551f024.patch"; - hash = "sha256-a7AyDEKkqdbiHpa4OHTRuP9Yewb3Nxs/j6bwez5m0yU="; - }) - (fetchpatch { - name = "fix-gcc-13-build.patch"; - # https://github.com/emsec/hal/pull/557 - url = "https://github.com/emsec/hal/commit/831b1a7866aa9aabd55ff288c084862dc6a138d8.patch"; - hash = "sha256-kB/sJJtLGl5PUv+mmWVpee/okkJzp5HF0BCiCRCcTKw="; + name = "fix-vendored-igraph-regression.patch"; + # https://github.com/emsec/hal/pull/596 + url = "https://github.com/emsec/hal/commit/fe1fe74719ab4fef873a22e2b28cce0c57d570e0.patch"; + hash = "sha256-bjbW4pr04pP0TCuSdzPcV8h6LbLWMvdGSf61RL9Ju6E="; }) + ./4.4.1-newer-spdlog-fmt-compat.patch ]; # make sure bundled dependencies don't get in the way - install also otherwise @@ -105,9 +67,11 @@ in stdenv.mkDerivation rec { qtsvg boost rapidjson - igraph' + igraph + nlohmann_json spdlog graphviz + verilator z3 quazip ] @@ -129,12 +93,16 @@ in stdenv.mkDerivation rec { "-DUSE_VENDORED_SPDLOG=off" "-DUSE_VENDORED_QUAZIP=off" "-DUSE_VENDORED_IGRAPH=off" + "-DUSE_VENDORED_NLOHMANN_JSON=off" "-DBUILD_ALL_PLUGINS=on" ]; # needed for macos build - this is why we use wrapQtAppsHook instead of # the qt mkDerivation - the latter forcibly overrides this. cmakeBuildType = "MinSizeRel"; + # https://github.com/emsec/hal/issues/598 + NIX_CFLAGS_COMPILE = lib.optional stdenv.hostPlatform.isAarch64 "-flax-vector-conversions"; + # some plugins depend on other plugins and need to be able to load them postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' find $out/lib/hal_plugins -name '*.so*' | while read -r f ; do