2019-10-04 09:13:42 +02:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, libyaml
|
|
|
|
, swig
|
2019-11-29 10:53:15 +01:00
|
|
|
, eigen
|
2021-01-19 07:50:56 +01:00
|
|
|
, pkg-config
|
2020-12-10 10:37:49 +01:00
|
|
|
, python2
|
2019-10-04 09:13:42 +02:00
|
|
|
, wafHook
|
|
|
|
, makeWrapper
|
|
|
|
, qt4
|
2021-03-25 12:54:37 +01:00
|
|
|
, pythonPackages ? null
|
2019-10-05 07:38:15 +02:00
|
|
|
, pythonSupport ? false
|
2019-10-05 06:58:56 +02:00
|
|
|
# Default to false since it breaks the build, see https://github.com/MTG/gaia/issues/11
|
2019-10-04 09:13:42 +02:00
|
|
|
, stlfacadeSupport ? false
|
|
|
|
, assertsSupport ? true
|
|
|
|
, cyclopsSupport ? true
|
|
|
|
}:
|
|
|
|
|
2019-10-05 07:38:15 +02:00
|
|
|
assert pythonSupport -> pythonPackages != null;
|
2019-10-04 09:13:42 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gaia";
|
2019-11-29 10:53:15 +01:00
|
|
|
version = "2.4.6";
|
2019-10-04 09:13:42 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MTG";
|
|
|
|
repo = "gaia";
|
|
|
|
rev = "v${version}";
|
2019-11-29 10:53:15 +01:00
|
|
|
sha256 = "03vmdq7ca4f7zp2f4sxyqa8sdpdma3mn9fz4z7d93qryl0bhi7z3";
|
2019-10-04 09:13:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# Fix installation error when waf tries to put files in /etc/
|
2021-01-24 10:19:10 +01:00
|
|
|
prePatch = "" + lib.optionalString cyclopsSupport ''
|
2019-10-04 09:13:42 +02:00
|
|
|
substituteInPlace src/wscript \
|
|
|
|
--replace "/etc/cyclops" "$out/etc/cyclops" \
|
|
|
|
--replace "/etc/init.d" "$out/etc/init.d"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-01-19 07:50:56 +01:00
|
|
|
pkg-config
|
2020-12-10 10:37:49 +01:00
|
|
|
python2 # For wafHook
|
2019-10-04 09:13:42 +02:00
|
|
|
swig
|
2020-12-10 10:37:49 +01:00
|
|
|
wafHook
|
2019-10-08 09:20:53 +02:00
|
|
|
]
|
|
|
|
# The gaiafusion binary inside $out/bin needs a shebangs patch, and
|
|
|
|
# wrapping with the appropriate $PYTHONPATH
|
|
|
|
++ lib.optionals (pythonSupport) [
|
|
|
|
pythonPackages.wrapPython
|
|
|
|
]
|
|
|
|
;
|
|
|
|
|
2019-10-04 09:13:42 +02:00
|
|
|
buildInputs = [
|
|
|
|
libyaml
|
2019-11-29 10:53:15 +01:00
|
|
|
eigen
|
2019-10-04 09:13:42 +02:00
|
|
|
qt4
|
2019-10-08 09:20:53 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = []
|
2019-10-04 09:13:42 +02:00
|
|
|
++ lib.optionals (pythonSupport) [
|
2019-10-08 09:20:53 +02:00
|
|
|
# This is not exactly specified in upstream's README but it's needed by the
|
|
|
|
# resulting $out/bin/gaiafusion script
|
|
|
|
pythonPackages.pyyaml
|
2019-10-04 09:13:42 +02:00
|
|
|
]
|
|
|
|
;
|
2019-10-08 09:20:53 +02:00
|
|
|
|
|
|
|
wafConfigureFlags = []
|
2019-10-04 09:13:42 +02:00
|
|
|
++ lib.optionals (pythonSupport) [ "--with-python-bindings" ]
|
|
|
|
++ lib.optionals (stlfacadeSupport) [ "--with-stlfacade" ]
|
|
|
|
++ lib.optionals (assertsSupport) [ "--with-asserts" ]
|
|
|
|
++ lib.optionals (cyclopsSupport) [ "--with-cyclops" ]
|
|
|
|
;
|
2019-10-08 09:20:53 +02:00
|
|
|
|
2021-01-24 10:19:10 +01:00
|
|
|
postFixup = ""
|
2019-10-08 09:20:53 +02:00
|
|
|
+ lib.optionalString pythonSupport ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
''
|
|
|
|
;
|
2019-10-04 09:13:42 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/MTG/gaia";
|
2019-10-05 07:14:40 +02:00
|
|
|
description = "General library to work with points in a semimetric space";
|
2019-10-04 09:13:42 +02:00
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
2019-11-16 15:14:24 +01:00
|
|
|
platforms = platforms.x86; # upstream assume SSE2 / fails on ARM
|
2019-10-04 09:13:42 +02:00
|
|
|
license = licenses.agpl3;
|
|
|
|
};
|
|
|
|
}
|