about summary refs log tree commit diff
path: root/pkgs/by-name/li/libsbml/package.nix
blob: ce895beee00603b8d909d79ec0687b61f3cec42b (plain) (blame)
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
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  bzip2,
  libxml2,
  swig,
}:
stdenv.mkDerivation (attrs: {
  pname = "libsbml";
  version = "5.20.2";

  src = fetchFromGitHub {
    owner = "sbmlteam";
    repo = "libsbml";
    rev = "v${attrs.version}";
    hash = "sha256-8JT2r0zuf61VewtZaOAccaOUmDlQPnllA0fXE9rT5X8=";
  };

  patches = [
    # This should be in next release, remember to remove fetchpatch
    (fetchpatch {
      name = "fix-xmlerror-conversion.patch";
      url = "https://github.com/sbmlteam/libsbml/pull/358.patch";
      hash = "sha256-uirG6XJ+w0hqBUEAGDnzhHoVtJVRdN1eqBYeneKMBao=";
    })
  ];

  nativeBuildInputs = [
    cmake
    pkg-config
    swig
  ];

  buildInputs = [
    bzip2.dev
    libxml2
  ];

  # libSBML doesn't always make use of pkg-config
  cmakeFlags = [
    "-DLIBXML_INCLUDE_DIR=${lib.getDev libxml2}/include/libxml2"
    "-DLIBXML_LIBRARY=${lib.getLib libxml2}/lib/libxml2${stdenv.hostPlatform.extensions.sharedLibrary}"
    "-DPKG_CONFIG_EXECUTABLE=${lib.getBin pkg-config}/bin/pkg-config"
    "-DSWIG_EXECUTABLE=${lib.getBin swig}/bin/swig"
  ];

  meta = with lib; {
    description = "Library for manipulating Systems Biology Markup Language (SBML)";
    homepage = "https://github.com/sbmlteam/libsbml";
    license = licenses.lgpl21Only;
    maintainers = [maintainers.kupac];
    platforms = platforms.all;
  };
})