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