summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libui/package.nix
blob: d7304ee37133f74a0534cadb70d0bc1e2b8d3e70 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  meson,
  ninja,
  pkg-config,
  gtk3,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libui";
  version = "4.1a-unstable-2021-01-02";

  src = fetchFromGitHub {
    owner = "andlabs";
    repo = "libui";
    rev = "fea45b2d5b75839be0af9acc842a147c5cba9295";
    hash = "sha256-BGbL15hBHY4aZE2ANAEd677vzZMQzMCICBafRtoQIvA=";
  };

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
  ];
  propagatedBuildInputs = lib.optional stdenv.hostPlatform.isLinux gtk3;

  patches = [
    ./darwin_versions.patch
    ./pkg-config.patch
  ];

  postPatch = ''
    substituteInPlace meson.build \
      --subst-var-by version "${finalAttrs.version}"
  ''
  + lib.optionalString stdenv.hostPlatform.isLinux ''
    substituteInPlace darwin/text.m unix/text.c \
      --replace-fail "strcasecmp" "g_strcasecmp"
  '';

  meta = {
    homepage = "https://github.com/andlabs/libui";
    description = "Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
  };
})