summaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/libiodata/default.nix
blob: 83de828548f5bb2d68d67b1dcf223b76956bd852 (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
{
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  gitUpdater,
  bison,
  flex,
  qmake,
  pkg-config,
  libxcrypt,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libiodata";
  version = "0.19.14";

  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "sailfishos";
    repo = "libiodata";
    tag = finalAttrs.version;
    hash = "sha256-hhcPKZtg9PEE6rrEfRJ/e4E5xMyButH0Rm0eM3iHPh8=";
  };

  patches = [
    # Remove when version > 0.19.14
    (fetchpatch {
      name = "0001-libiodata-Fix-dependencies-between-sub-projects.patch";
      url = "https://github.com/sailfishos/libiodata/commit/85517a9f2103e461cbb69dc195335df73b7a8b7e.patch";
      hash = "sha256-qrRZ1Af5uBJvEoRHifgUSeVHFC5RATDsL3374CmoUDc=";
    })
  ];

  postPatch = ''
    substituteInPlace root.pro \
      --replace-fail '$$[QT_HOST_DATA]' "$dev"

    substituteInPlace src/src.pro \
      --replace-fail '$$[QT_INSTALL_LIBS]' "$out/lib" \
      --replace-fail '/usr/include' "$dev/include"

    substituteInPlace tests/tests.pro \
      --replace-fail '/usr/bin' "$dev/bin" \
      --replace-fail '/usr/share' "$dev/share"

    substituteInPlace type-to-cxx/type-to-cxx.pro \
      --replace-fail '/usr/bin' "$dev/bin"
  '';

  # QMake doesn't handle strictDeps well
  strictDeps = false;

  nativeBuildInputs = [
    bison
    flex
    pkg-config
    qmake
  ];

  buildInputs = [
    libxcrypt
  ];

  dontWrapQtApps = true;

  postConfigure = ''
    make qmake_all
  '';

  env.IODATA_VERSION = "${finalAttrs.version}";

  passthru.updateScript = gitUpdater { };

  meta = {
    description = "Library for reading and writing simple structured data";
    homepage = "https://github.com/sailfishos/libiodata";
    changelog = "https://github.com/sailfishos/libiodata/releases/tag/${finalAttrs.version}";
    license = lib.licenses.lgpl21Only;
    teams = [ lib.teams.lomiri ];
    platforms = lib.platforms.linux;
  };
})