summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libiberty/package.nix
blob: 3e1619adbd573750a0e39a3115117658c61a6a16 (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
{
  lib,
  stdenv,
  buildPackages,
  staticBuild ? stdenv.hostPlatform.isStatic,
}:

let
  inherit (buildPackages.buildPackages) gcc;
in

stdenv.mkDerivation {
  pname = "libiberty";
  version = "${gcc.cc.version}";

  inherit (gcc.cc) src;

  outputs = [
    "out"
    "dev"
  ];

  postUnpack = "sourceRoot=\${sourceRoot}/libiberty";

  # needed until config scripts are updated to not use /usr/bin/uname on FreeBSD native
  # updateAutotoolsGnuConfigScriptsHook doesn't seem to work here
  postPatch = ''
    substituteInPlace ../config.guess --replace-fail /usr/bin/uname uname
  '';

  strictDeps = true;

  configureFlags = [ "--enable-install-libiberty" ] ++ lib.optional (!staticBuild) "--enable-shared";

  postInstall = lib.optionalString (!staticBuild) ''
    cp pic/libiberty.a $out/lib*/libiberty.a
  '';

  __structuredAttrs = true;

  meta = {
    homepage = "https://gcc.gnu.org/";
    license = lib.licenses.lgpl2;
    description = "Collection of subroutines used by various GNU programs";
    maintainers = with lib.maintainers; [
      ericson2314
    ];
    platforms = lib.platforms.unix;
  };
}