From 9ff73686ed0127d9cc65633053e6d7a554ff179a Mon Sep 17 00:00:00 2001 From: Pamplemousse Date: Fri, 8 Jan 2021 15:18:14 -0700 Subject: ocamlPackages.bap: Correct build dependencies As pointed upstream: https://github.com/BinaryAnalysisPlatform/bap/issues/1261#issuecomment-754926500 Signed-off-by: Pamplemousse --- .../ocaml-modules/bap/curses_is_ncurses.patch | 32 ++++++++++++++++++++++ pkgs/development/ocaml-modules/bap/default.nix | 18 ++++++------ .../ocaml-modules/bap/dont-add-curses.patch | 32 ---------------------- 3 files changed, 40 insertions(+), 42 deletions(-) create mode 100644 pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch delete mode 100644 pkgs/development/ocaml-modules/bap/dont-add-curses.patch (limited to 'pkgs/development/ocaml-modules') diff --git a/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch b/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch new file mode 100644 index 000000000000..0b012848601f --- /dev/null +++ b/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch @@ -0,0 +1,32 @@ +From e6f6d1529d1725e8c1ed3c96eecc4aea43417aea Mon Sep 17 00:00:00 2001 +From: Matthew Maurer +Date: Sun, 19 Apr 2020 15:50:01 -0700 +Subject: [PATCH] Remove attempt to work around libcurses dependency issues. + +BAP doesn't actually link against libcurses, LLVM does. By adding +-lcurses to this file, we accidentally broke linking on any systems +where LLVM got linked against libncurses (not libcurses) without a +libcurses compatibility shim. + +Overall, we should get -l flags from llvm-config, not attempt to +shoehorn them in later, as this is fragile. +--- + oasis/llvm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/oasis/llvm b/oasis/llvm +index 966c407..fba3fb4 100644 +--- a/oasis/llvm ++++ b/oasis/llvm +@@ -31,7 +31,7 @@ Library bap_llvm + Bap_llvm_ogre_samples, + Bap_llvm_ogre_types + CCOpt: $cc_optimization +- CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lcurses ++ CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lncurses + CSources: llvm_disasm.h, + llvm_disasm.c, + llvm_stubs.c, +-- +2.22.0 + diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix index e860ad13d405..9cb0859cedc8 100644 --- a/pkgs/development/ocaml-modules/bap/default.nix +++ b/pkgs/development/ocaml-modules/bap/default.nix @@ -1,10 +1,10 @@ { stdenv, fetchFromGitHub, fetchurl -, ocaml, findlib, ocamlbuild, ocaml_oasis, - bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm, frontc, ounit, ppx_jane, parsexp, - utop, libxml2, - ppx_bitstring, - ppx_tools_versioned, - which, makeWrapper, writeText +, ocaml, findlib, ocamlbuild, ocaml_oasis +, bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm, frontc, ounit, ppx_jane, parsexp +, utop, libxml2, ncurses +, ppx_bitstring +, ppx_tools_versioned +, which, makeWrapper, writeText , z3 }: @@ -43,7 +43,7 @@ stdenv.mkDerivation rec { buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis llvm ppx_bitstring ppx_tools_versioned z3 - utop libxml2 ]; + utop libxml2 ncurses ]; propagatedBuildInputs = [ bitstring camlzip cmdliner ppx_jane core_kernel ezjsonm fileutils ocaml_lwt ocamlgraph ocurl re uri zarith piqi parsexp piqi-ocaml uuidm frontc ounit ]; @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { disableIda = "--disable-ida"; - patches = [ ./dont-add-curses.patch ]; + patches = [ ./curses_is_ncurses.patch ]; preConfigure = '' substituteInPlace oasis/elf --replace bitstring.ppx ppx_bitstring @@ -70,8 +70,6 @@ stdenv.mkDerivation rec { configureFlags = [ "--enable-everything ${disableIda}" "--with-llvm-config=${llvm}/bin/llvm-config" ]; - BAPBUILDFLAGS = "-j $(NIX_BUILD_CORES)"; - meta = with stdenv.lib; { description = "Platform for binary analysis. It is written in OCaml, but can be used from other languages."; homepage = "https://github.com/BinaryAnalysisPlatform/bap/"; diff --git a/pkgs/development/ocaml-modules/bap/dont-add-curses.patch b/pkgs/development/ocaml-modules/bap/dont-add-curses.patch deleted file mode 100644 index 438a1bfc6dc0..000000000000 --- a/pkgs/development/ocaml-modules/bap/dont-add-curses.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e6f6d1529d1725e8c1ed3c96eecc4aea43417aea Mon Sep 17 00:00:00 2001 -From: Matthew Maurer -Date: Sun, 19 Apr 2020 15:50:01 -0700 -Subject: [PATCH] Remove attempt to work around libcurses dependency issues. - -BAP doesn't actually link against libcurses, LLVM does. By adding --lcurses to this file, we accidentally broke linking on any systems -where LLVM got linked against libncurses (not libcurses) without a -libcurses compatibility shim. - -Overall, we should get -l flags from llvm-config, not attempt to -shoehorn them in later, as this is fragile. ---- - oasis/llvm | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/oasis/llvm b/oasis/llvm -index 966c407..fba3fb4 100644 ---- a/oasis/llvm -+++ b/oasis/llvm -@@ -31,7 +31,7 @@ Library bap_llvm - Bap_llvm_ogre_samples, - Bap_llvm_ogre_types - CCOpt: $cc_optimization -- CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lcurses -+ CCLib: $llvm_lib $cxxlibs $llvm_ldflags - CSources: llvm_disasm.h, - llvm_disasm.c, - llvm_stubs.c, --- -2.22.0 - -- cgit 1.4.1