Merge pull request #251048 from risicle/ris-hal-hardware-analyzer-4.2.0

hal-hardware-analyzer: 3.3.0 -> 4.2.0
This commit is contained in:
Robert Scott 2023-08-29 21:46:45 +01:00 committed by GitHub
commit a6f8a0796f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 47 deletions

View File

@ -1,75 +1,71 @@
{ lib { lib
, stdenv , stdenv
, boost
, cmake
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, cmake , graphviz
, igraph
, llvmPackages
, ninja , ninja
, pkg-config , pkg-config
, python3Packages , python3Packages
, boost
, rapidjson
, qtbase , qtbase
, qtsvg , qtsvg
, igraph , quazip
, rapidjson
, spdlog , spdlog
, wrapQtAppsHook
, graphviz
, llvmPackages
, z3
, fmt_8
, suitesparse , suitesparse
, wrapQtAppsHook
, z3
}: }:
let let
igraph' = igraph.overrideAttrs (old: rec { # 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"; version = "0.9.10";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "igraph"; owner = "igraph";
repo = "igraph"; repo = final.pname;
rev = version; rev = final.version;
hash = "sha256-prDadHsNhDRkNp1i0niKIYxE0g85Zs0ngvUy6uK8evk="; hash = "sha256-prDadHsNhDRkNp1i0niKIYxE0g85Zs0ngvUy6uK8evk=";
}; };
postPatch = old.postPatch + lib.optionalString stdenv.isAarch64 '' 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.isAarch64 ''
# https://github.com/igraph/igraph/issues/1694 # https://github.com/igraph/igraph/issues/1694
substituteInPlace tests/CMakeLists.txt \ substituteInPlace tests/CMakeLists.txt \
--replace "igraph_scg_grouping3" "" \ --replace "igraph_scg_grouping3" "" \
--replace "igraph_scg_semiprojectors2" "" --replace "igraph_scg_semiprojectors2" ""
''; '';
buildInputs = old.buildInputs ++ [ suitesparse ]; # general options brought back from the old 0.9.x package
cmakeFlags = old.cmakeFlags ++ [ "-DIGRAPH_USE_INTERNAL_CXSPARSE=OFF" ]; buildInputs = prev.buildInputs ++ [ suitesparse ];
cmakeFlags = prev.cmakeFlags ++ [ "-DIGRAPH_USE_INTERNAL_CXSPARSE=OFF" ];
}); });
# no stable hal release yet with recent spdlog/fmt support, remove
# once 4.0.0 is released - see https://github.com/emsec/hal/issues/452
spdlog' = spdlog.override {
fmt_9 = fmt_8.overrideAttrs (_: rec {
version = "8.0.1";
src = fetchFromGitHub {
owner = "fmtlib";
repo = "fmt";
rev = version;
sha256 = "1mnvxqsan034d2jiqnw2yvkljl7lwvhakmj5bscwp1fpkn655bbw";
};
});
};
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
version = "3.3.0"; version = "4.2.0";
pname = "hal-hardware-analyzer"; pname = "hal-hardware-analyzer";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "emsec"; owner = "emsec";
repo = "hal"; repo = "hal";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-uNpELHhSAVRJL/4iypvnl3nX45SqB419r37lthd2WmQ="; sha256 = "sha256-Yl86AClE3vWygqj1omCOXX8koJK2SjTkMZFReRThez0=";
}; };
patches = [ patches = [
(fetchpatch { (fetchpatch {
# Fix build with python 3.10 name = "cmake-add-no-vendored-options.patch";
# https://github.com/emsec/hal/pull/463 # https://github.com/emsec/hal/pull/529
name = "hal-fix-python-3.10.patch"; url = "https://github.com/emsec/hal/commit/37d5c1a0eacb25de57cc552c13e74f559a5aa6e8.patch";
url = "https://github.com/emsec/hal/commit/f695f55cb2209676ef76366185b7c419417fbbc9.patch"; hash = "sha256-a30VjDt4roJOTntisixqnH17wwCgWc4VWeh1+RgqFuY=";
sha256 = "sha256-HsCdG3tPllUsLw6kQtGaaEGkEHqZPSC2v9k6ycO2I/8=";
includes = [ "plugins/gui/src/python/python_context.cpp" ];
}) })
]; ];
@ -77,14 +73,30 @@ in stdenv.mkDerivation rec {
# copies them in full to the output, bloating the package # copies them in full to the output, bloating the package
postPatch = '' postPatch = ''
shopt -s extglob shopt -s extglob
rm -rf deps/!(sanitizers-cmake)/* rm -rf deps/!(abc|sanitizers-cmake|subprocess)/*
shopt -u extglob shopt -u extglob
''; '';
nativeBuildInputs = [ cmake ninja pkg-config ]; nativeBuildInputs = [
buildInputs = [ qtbase qtsvg boost rapidjson igraph' spdlog' graphviz wrapQtAppsHook z3 ] cmake
++ (with python3Packages; [ python pybind11 ]) ninja
++ lib.optional stdenv.cc.isClang llvmPackages.openmp; pkg-config
wrapQtAppsHook
];
buildInputs = [
qtbase
qtsvg
boost
rapidjson
igraph'
spdlog
graphviz
z3
quazip
]
++ (with python3Packages; [ python pybind11 ])
++ lib.optional stdenv.cc.isClang llvmPackages.openmp
;
cmakeFlags = with lib.versions; [ cmakeFlags = with lib.versions; [
"-DHAL_VERSION_RETURN=${version}" "-DHAL_VERSION_RETURN=${version}"
@ -96,12 +108,23 @@ in stdenv.mkDerivation rec {
"-DHAL_VERSION_DIRTY=false" "-DHAL_VERSION_DIRTY=false"
"-DHAL_VERSION_BROKEN=false" "-DHAL_VERSION_BROKEN=false"
"-DENABLE_INSTALL_LDCONFIG=off" "-DENABLE_INSTALL_LDCONFIG=off"
"-DUSE_VENDORED_PYBIND11=off"
"-DUSE_VENDORED_SPDLOG=off"
"-DUSE_VENDORED_QUAZIP=off"
"-DUSE_VENDORED_IGRAPH=off"
"-DBUILD_ALL_PLUGINS=on" "-DBUILD_ALL_PLUGINS=on"
]; ];
# needed for macos build - this is why we use wrapQtAppsHook instead of # needed for macos build - this is why we use wrapQtAppsHook instead of
# the qt mkDerivation - the latter forcibly overrides this. # the qt mkDerivation - the latter forcibly overrides this.
cmakeBuildType = "MinSizeRel"; cmakeBuildType = "MinSizeRel";
# some plugins depend on other plugins and need to be able to load them
postFixup = lib.optionalString stdenv.isLinux ''
find $out/lib/hal_plugins -name '*.so*' | while read -r f ; do
patchelf --set-rpath "$(patchelf --print-rpath "$f"):$out/lib/hal_plugins" "$f"
done
'';
meta = with lib; { meta = with lib; {
description = "A comprehensive reverse engineering and manipulation framework for gate-level netlists"; description = "A comprehensive reverse engineering and manipulation framework for gate-level netlists";
homepage = "https://github.com/emsec/hal"; homepage = "https://github.com/emsec/hal";

View File

@ -24,19 +24,19 @@ assert (blas.isILP64 == lapack.isILP64 &&
blas.isILP64 == arpack.isILP64 && blas.isILP64 == arpack.isILP64 &&
!blas.isILP64); !blas.isILP64);
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "igraph"; pname = "igraph";
version = "0.10.6"; version = "0.10.6";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "igraph"; owner = "igraph";
repo = pname; repo = finalAttrs.pname;
rev = version; rev = finalAttrs.version;
hash = "sha256-HNc+xU7Gcv9BSpb2OgyG9tCbk/dfWw5Ix1c2gvFZklE="; hash = "sha256-HNc+xU7Gcv9BSpb2OgyG9tCbk/dfWw5Ix1c2gvFZklE=";
}; };
postPatch = '' postPatch = ''
echo "${version}" > IGRAPH_VERSION echo "${finalAttrs.version}" > IGRAPH_VERSION
''; '';
outputs = [ "out" "dev" "doc" ]; outputs = [ "out" "dev" "doc" ];
@ -95,9 +95,9 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "C library for complex network analysis and graph theory"; description = "C library for complex network analysis and graph theory";
homepage = "https://igraph.org/"; homepage = "https://igraph.org/";
changelog = "https://github.com/igraph/igraph/blob/${src.rev}/CHANGELOG.md"; changelog = "https://github.com/igraph/igraph/blob/${finalAttrs.src.rev}/CHANGELOG.md";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
platforms = platforms.all; platforms = platforms.all;
maintainers = with maintainers; [ MostAwesomeDude dotlambda ]; maintainers = with maintainers; [ MostAwesomeDude dotlambda ];
}; };
} })