3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/gaia/default.nix

83 lines
2.2 KiB
Nix
Raw Normal View History

2019-10-04 08:13:42 +01:00
{ stdenv
, lib
, fetchFromGitHub
, libyaml
, swig
, pkgconfig
, wafHook
, makeWrapper
, qt4
, pythonPackages
, pythonSupport ? false
# Default to false since it breaks the build, see https://github.com/MTG/gaia/issues/11
2019-10-04 08:13:42 +01:00
, stlfacadeSupport ? false
, assertsSupport ? true
, cyclopsSupport ? true
}:
assert pythonSupport -> pythonPackages != null;
2019-10-04 08:13:42 +01:00
stdenv.mkDerivation rec {
pname = "gaia";
version = "2.4.5";
src = fetchFromGitHub {
owner = "MTG";
repo = "gaia";
rev = "v${version}";
sha256 = "12jxb354s2dblr2ghnl3w05m23jgzvrrgywfj8jaa32j3gw48fv2";
};
# Fix installation error when waf tries to put files in /etc/
prePatch = ''
'' + lib.optionalString cyclopsSupport ''
substituteInPlace src/wscript \
--replace "/etc/cyclops" "$out/etc/cyclops" \
--replace "/etc/init.d" "$out/etc/init.d"
'';
# This is not exactly specified in upstream's README but it's needed by the
# resulting $out/bin/gaiafusion script
2019-10-04 08:13:42 +01:00
pythonEnv = (if pythonSupport then
pythonPackages.python.withPackages(ps: with ps; [
2019-10-04 08:13:42 +01:00
pyyaml
])
else null);
nativeBuildInputs = [
wafHook
pkgconfig
swig
makeWrapper
];
buildInputs = [
libyaml
qt4
]
++ lib.optionals (pythonSupport) [
pythonEnv
]
;
wafConfigureFlags = [
]
++ lib.optionals (pythonSupport) [ "--with-python-bindings" ]
++ lib.optionals (stlfacadeSupport) [ "--with-stlfacade" ]
++ lib.optionals (assertsSupport) [ "--with-asserts" ]
++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ]
;
# only gaiafusion is a python executable that needs patchShebangs
postInstall = lib.optionalString (pythonSupport) ''
2019-10-04 08:13:42 +01:00
# We can't use patchShebangs because it will use bare bones $python/bin/python
# and we need a python environment with pyyaml
wrapProgram $out/bin/gaiafusion --prefix PYTHONPATH : $out/${pythonPackages.python.sitePackages}:${pythonEnv}/${pythonPackages.python.sitePackages}
2019-10-05 06:15:16 +01:00
'';
2019-10-04 08:13:42 +01:00
meta = with lib; {
homepage = "https://github.com/MTG/gaia";
description = "General library to work with points in a semimetric space";
2019-10-04 08:13:42 +01:00
maintainers = with maintainers; [ doronbehar ];
2019-10-05 08:20:54 +01:00
platforms = platforms.all;
2019-10-04 08:13:42 +01:00
license = licenses.agpl3;
};
}