1{
2 lib,
3 stdenv,
4 buildPackages,
5 staticBuild ? stdenv.hostPlatform.isStatic,
6}:
7
8let
9 inherit (buildPackages.buildPackages) gcc;
10in
11
12stdenv.mkDerivation {
13 pname = "libiberty";
14 version = "${gcc.cc.version}";
15
16 inherit (gcc.cc) src;
17
18 outputs = [
19 "out"
20 "dev"
21 ];
22
23 postUnpack = "sourceRoot=\${sourceRoot}/libiberty";
24
25 # needed until config scripts are updated to not use /usr/bin/uname on FreeBSD native
26 # updateAutotoolsGnuConfigScriptsHook doesn't seem to work here
27 postPatch = ''
28 substituteInPlace ../config.guess --replace-fail /usr/bin/uname uname
29 '';
30
31 configureFlags = [ "--enable-install-libiberty" ] ++ lib.optional (!staticBuild) "--enable-shared";
32
33 postInstall = lib.optionalString (!staticBuild) ''
34 cp pic/libiberty.a $out/lib*/libiberty.a
35 '';
36
37 meta = with lib; {
38 homepage = "https://gcc.gnu.org/";
39 license = licenses.lgpl2;
40 description = "Collection of subroutines used by various GNU programs";
41 maintainers = with maintainers; [
42 abbradar
43 ericson2314
44 ];
45 platforms = platforms.unix;
46 };
47}