summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libx11/package.nix
blob: 1099666b809465d2d53626ffe0ce7ce456f9bfbc (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
  lib,
  stdenv,
  fetchurl,
  buildPackages,
  pkg-config,
  xorgproto,
  libpthread-stubs,
  libxcb,
  xtrans,
  writeScript,
  testers,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "libx11";
  version = "1.8.13";

  outputs = [
    "out"
    "dev"
    "man"
  ];

  src = fetchurl {
    url = "mirror://xorg/individual/lib/libX11-${finalAttrs.version}.tar.xz";
    hash = "sha256-aWBvSFwsB8FO9k91t7sybUhYevM3ldmrPmB8C1+U8Rw=";
  };

  strictDeps = true;

  depsBuildBuild = [ buildPackages.stdenv.cc ];

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [
    xorgproto
    libpthread-stubs
    libxcb
    xtrans
  ];

  propagatedBuildInputs = [
    xorgproto
  ];

  configureFlags =
    lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--enable-malloc0returnsnull"
    ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "ac_cv_path_RAWCPP=cpp";

  env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { CPP = "clang -E -"; };

  postInstall = ''
    # Remove useless DocBook XML files.
    rm -r $out/share/doc
  '';

  passthru = {
    updateScript = writeScript "update-${finalAttrs.pname}" ''
      #!/usr/bin/env nix-shell
      #!nix-shell -i bash -p common-updater-scripts
      version="$(list-directory-versions --pname libX11 \
        --url https://xorg.freedesktop.org/releases/individual/lib/ \
        | sort -V | tail -n1)"
      update-source-version ${finalAttrs.pname} "$version"
    '';
    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
  };

  meta = {
    description = "Core X11 protocol client library (aka \"Xlib\")";
    homepage = "https://gitlab.freedesktop.org/xorg/lib/libx11";
    license = with lib.licenses; [
      mit
      mitOpenGroup
      x11
      hpndDoc
      hpndSellVariant
      tekHvcLicense
      hpndDocSell
      hpnd
      bsd1
      isc
      # The "source code modified by FUJITSU LIMITED under the Joint Development Agreement for the
      # CDE/Motif PST" is possibly unfree.
      # upstream issue: https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/217
      # unfree
    ];
    maintainers = [ ];
    pkgConfigModules = [
      "x11"
      "x11-xcb"
    ];
    platforms = lib.platforms.unix;
  };
})