summary refs log tree commit diff
path: root/pkgs/development/libraries/libopcodes
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-10-10 18:48:42 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-11-13 00:47:37 -0500
commitde28bd48321a3e9ed5da005e69e01862e5551873 (patch)
treee95ebd67010b9d96b9a88d38cc15679ae61acedc /pkgs/development/libraries/libopcodes
parentc0a04ec2f537d21ab18d72d67cc65fe651598e14 (diff)
downloadnixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar.gz
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar.bz2
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar.lz
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar.xz
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.tar.zst
nixpkgs-de28bd48321a3e9ed5da005e69e01862e5551873.zip
bfd, opcodes: Init separate derivations for binutils libraries
On most distros, these are just built and distributed as part of
binutils. We don't use binutils across the board, however, but rather
switch between binutils and a cctools-binutils mashup, and change the
outputs on binutils too. This creates a combinatorial conditional soup
which is hard to maintain.

My hope is to lower the the state space. While my patch isn't the most
maintainable, they make downstream packages become more maintainable to
compensate. The additional derivations themselves are completely
platform-agnostic, always they always supports all possible target
platforms, and always yield "out" and "dev" outputs. That, in turn,
allows downstream packages to not worry about a dependency
shape-shifting under them.

In fact, the actual binutils package can avoid needing multiple outputs
now that these serve the requisite libraries, so that also can become
simpler on all platforms, too, removing the original wart this PR
circumnavigates for now. Actually changing the binutils package to
leverage is a mass rebuild, however, so I'll leave that for a separate
PR.

I do hope to upstream something like my patch too, but until then I'll
make myself maintainer of these derivations
Diffstat (limited to 'pkgs/development/libraries/libopcodes')
-rw-r--r--pkgs/development/libraries/libopcodes/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix
new file mode 100644
index 00000000000..c064ca25c49
--- /dev/null
+++ b/pkgs/development/libraries/libopcodes/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, buildPackages
+, fetchurl, autoreconfHook264, bison, binutils
+, libiberty, libbfd
+}:
+
+stdenv.mkDerivation rec {
+  name = "libopcodes-${version}";
+  inherit (binutils) version src;
+
+  outputs = [ "out" "dev" ];
+
+  patches = binutils.patches ++ [
+    ../../tools/misc/binutils/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>/' \;
+  '';
+
+  nativeBuildInputs = [ autoreconfHook264 bison buildPackages.stdenv.cc ];
+  buildInputs = [ libiberty ];
+  # dis-asm.h includes bfd.h
+  propagatedBuildInputs = [ libbfd ];
+
+  configurePlatforms = [ "build" "host" ];
+  configureFlags = [
+    "--enable-targets=all" "--enable-64-bit-bfd"
+    "--enable-install-libbfd"
+    "--enable-shared"
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A library from binutils for manipulating machine code";
+    homepage = http://www.gnu.org/software/binutils/;
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ericson2314 ];
+    platforms = platforms.unix;
+  };
+}