From ca6184bd6e4b4df25ca1642f9dad1c135e1400e0 Mon Sep 17 00:00:00 2001 From: rina Date: Tue, 19 Sep 2023 16:19:59 +1000 Subject: [PATCH] use cmakeFlags instead of patching. --- .gitignore | 4 ++++ llvm-translator/{retdec.nix => retdec5.nix} | 11 +++++------ overlay.nix | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) rename llvm-translator/{retdec.nix => retdec5.nix} (97%) diff --git a/.gitignore b/.gitignore index 12d6cb3..32157f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +result +result-* +source/ + CMakeLists.txt.user CMakeCache.txt CMakeFiles diff --git a/llvm-translator/retdec.nix b/llvm-translator/retdec5.nix similarity index 97% rename from llvm-translator/retdec.nix rename to llvm-translator/retdec5.nix index f9bd6ca..78b632e 100644 --- a/llvm-translator/retdec.nix +++ b/llvm-translator/retdec5.nix @@ -128,9 +128,6 @@ let echo "The ${dep.dep_name} dependency has the wrong version: ${dep.rev} while $expected_rev is expected." exit 1 fi - - # patch the CMakeLists.txt file to use our local copy of the dependency instead of fetching it at build time - sed -i -e 's|"https\?://.*/${dep.dep_name}/.*"|"${dep}"|' "cmake/deps.cmake" ''; in stdenv.mkDerivation rec { @@ -171,7 +168,11 @@ in stdenv.mkDerivation rec { zlib ]; - cmakeFlags = [ + cmakeFlags_deps = builtins.map + (dep: "-D${lib.toUpper dep.dep_name}_URL=${dep}") + external_deps; + + cmakeFlags = cmakeFlags_deps ++ [ "-DRETDEC_TESTS=${if doInstallCheck then "ON" else "OFF"}" # build tests ]; @@ -191,7 +192,6 @@ in stdenv.mkDerivation rec { (yaracpp // { dep_name = "yara"; }) (yaramod // { dep_name = "yaramod"; }) (retdec-support // { dep_name = "support_pkg"; dep_key = "_VERSION"; }) - ]; patches = []; @@ -214,7 +214,6 @@ ExternalProject_Add_Step(yara chmod ) EOF - # the CMakeLists assumes CMAKE_INSTALL_BINDIR, etc are path components but in Nix, they are absolute. # therefore, we need to remove the unnecessary CMAKE_INSTALL_PREFIX prepend. substituteInPlace ./CMakeLists.txt \ diff --git a/overlay.nix b/overlay.nix index f2df665..b29da46 100644 --- a/overlay.nix +++ b/overlay.nix @@ -32,7 +32,8 @@ let # llvm-translator packages asl-translator = prev.callPackage ./llvm-translator/asl-translator.nix {}; - retdec-tools = prev.callPackage ./llvm-translator/retdec-tools.nix {}; + retdec5 = prev.callPackage ./llvm-translator/retdec5.nix {}; + retdec-tools = prev.callPackage ./llvm-translator/retdec-tools.nix { retdec = final.retdec5; }; llvm-rtti-eh = prev.callPackage ./llvm-translator/llvm-rtti-eh.nix {}; alive2 = prev.callPackage ./llvm-translator/alive2.nix {};