summaryrefslogtreecommitdiff
path: root/pkgs/development/tools/misc/binutils/2.38/libopcodes.nix
blob: b6cbfaabd66d4eb09952362b585110c8cc572ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
  lib,
  stdenv,
  buildPackages,
  autoreconfHook,
  bison,
  binutils-unwrapped_2_38,
  libiberty,
  libbfd_2_38,
}:

stdenv.mkDerivation {
  pname = "libopcodes";
  inherit (binutils-unwrapped_2_38) version src;

  outputs = [
    "out"
    "dev"
  ];

  patches = binutils-unwrapped_2_38.patches ++ [
    ./build-components-separately.patch
  ];

  # We just want to build libopcodes
  postPatch = ''
    cd opcodes
    find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \;
  '';

  depsBuildBuild = [ buildPackages.stdenv.cc ];
  nativeBuildInputs = [
    autoreconfHook
    bison
  ];
  buildInputs = [ libiberty ];
  # dis-asm.h includes bfd.h
  propagatedBuildInputs = [ libbfd_2_38 ];

  configurePlatforms = [
    "build"
    "host"
  ];
  configureFlags = [
    "--enable-targets=all"
    "--enable-64-bit-bfd"
    "--enable-install-libbfd"
    "--enable-shared"
  ];

  enableParallelBuilding = true;

  meta = {
    description = "Library from binutils for manipulating machine code";
    homepage = "https://www.gnu.org/software/binutils/";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ ericson2314 ];
    platforms = lib.platforms.unix;
  };
}