1{ stdenv, buildPackages
2, fetchurl, fetchpatch, gnu-config, autoreconfHook264, bison
3, libiberty, zlib
4}:
5
6let inherit (buildPackages.buildPackages) binutils-raw; in
7
8stdenv.mkDerivation rec {
9 name = "libbfd-${version}";
10 inherit (binutils-raw.bintools) version src;
11
12 outputs = [ "out" "dev" ];
13
14 patches = binutils-raw.bintools.patches ++ [
15 ../../tools/misc/binutils/build-components-separately.patch
16 (fetchpatch {
17 url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
18 sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";
19 })
20 ];
21
22 # We just want to build libbfd
23 postPatch = ''
24 cd bfd
25 '';
26
27 postAutoreconf = ''
28 echo "Updating config.guess and config.sub from ${gnu-config}"
29 cp -f ${gnu-config}/config.{guess,sub} ../
30 '';
31
32 # We update these ourselves
33 dontUpdateAutotoolsGnuConfigScripts = true;
34
35 nativeBuildInputs = [ autoreconfHook264 bison ];
36 buildInputs = [ libiberty zlib ];
37
38 configurePlatforms = [ "build" "host" ];
39 configureFlags = [
40 "--enable-targets=all" "--enable-64-bit-bfd"
41 "--enable-install-libbfd"
42 "--enable-shared"
43 "--with-system-zlib"
44 ];
45
46 enableParallelBuilding = true;
47
48 meta = with stdenv.lib; {
49 description = "A library for manipulating containers of machine code";
50 longDescription = ''
51 BFD is a library which provides a single interface to read and write
52 object files, executables, archive files, and core files in any format.
53 It is associated with GNU Binutils, and elsewhere often distributed with
54 it.
55 '';
56 homepage = http://www.gnu.org/software/binutils/;
57 license = licenses.gpl3Plus;
58 maintainers = with maintainers; [ ericson2314 ];
59 platforms = platforms.unix;
60 };
61}