commit
684c73c9e6
@ -0,0 +1,37 @@ |
||||
{ lib, stdenv, fetchurl, fetchpatch }: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "libamplsolver"; |
||||
version = "20211109"; |
||||
|
||||
src = fetchurl { |
||||
url = "https://ampl.com/netlib/ampl/solvers.tgz"; |
||||
sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM="; |
||||
}; |
||||
|
||||
patches = [ |
||||
# Debian provides a patch to build a shared library |
||||
(fetchpatch { |
||||
url = "https://sources.debian.org/data/main/liba/libamplsolver/0~20190702-2/debian/patches/fix-makefile-shared-lib.patch"; |
||||
sha256 = "sha256-96qwj3fLugzbsfxguKMce13cUo7XGC4VUE7xKcJs42Y="; |
||||
}) |
||||
]; |
||||
|
||||
installPhase = '' |
||||
runHook preInstall |
||||
pushd sys.`uname -m`.`uname -s` |
||||
install -D -m 0644 *.h -t $out/include |
||||
install -D -m 0644 *.so* -t $out/lib |
||||
install -D -m 0644 *.a -t $out/lib |
||||
popd |
||||
runHook postInstall |
||||
''; |
||||
|
||||
meta = with lib; { |
||||
description = "A library of routines that help solvers work with AMPL"; |
||||
homepage = "https://ampl.com/netlib/ampl/"; |
||||
license = [ licenses.mit ]; |
||||
platforms = platforms.linux; |
||||
maintainers = with maintainers; [ aanderse ]; |
||||
}; |
||||
} |
@ -1,52 +1,63 @@ |
||||
{ lib |
||||
, buildPythonPackage |
||||
, stdenv |
||||
, toPythonModule |
||||
, fetchFromGitHub |
||||
, cmake |
||||
, boost |
||||
, eigen |
||||
, nlopt |
||||
, ipopt |
||||
, boost |
||||
, nlopt |
||||
, pagmo2 |
||||
, numpy |
||||
, python |
||||
, cloudpickle |
||||
, ipyparallel |
||||
, numba |
||||
, python |
||||
, numpy |
||||
, pybind11 |
||||
}: |
||||
|
||||
let |
||||
propagatedBuildInputs = [ numpy cloudpickle ipyparallel numba ]; |
||||
|
||||
pagmo2WithPython = pagmo2.overrideAttrs (oldAttrs: { |
||||
cmakeFlags = oldAttrs.cmakeFlags ++ [ |
||||
"-DPAGMO_BUILD_PYGMO=yes" |
||||
"-DPAGMO_BUILD_PAGMO=no" |
||||
"-DPagmo_DIR=${pagmo2}" |
||||
]; |
||||
buildInputs = [ eigen nlopt ipopt boost pagmo2 ] ++ propagatedBuildInputs; |
||||
postInstall = '' |
||||
mv wheel $out |
||||
''; |
||||
}); |
||||
|
||||
in buildPythonPackage { |
||||
toPythonModule (stdenv.mkDerivation rec { |
||||
pname = "pygmo"; |
||||
version = pagmo2WithPython.version; |
||||
|
||||
inherit propagatedBuildInputs; |
||||
version = "2.18.0"; |
||||
|
||||
src = pagmo2WithPython; |
||||
|
||||
preBuild = '' |
||||
mv ${python.sitePackages}/pygmo wheel |
||||
cd wheel |
||||
''; |
||||
src = fetchFromGitHub { |
||||
owner = "esa"; |
||||
repo = "pygmo2"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256-he7gxRRJd6bBrD0Z0i+CQTr5JH4P3Im/beNGO+HfmNM="; |
||||
}; |
||||
|
||||
# dont do tests |
||||
doCheck = false; |
||||
cmakeFlags = [ |
||||
"-DPYGMO_INSTALL_PATH=${placeholder "out"}/lib/${python.libPrefix}/site-packages" |
||||
]; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
]; |
||||
|
||||
propagatedBuildInputs = [ |
||||
cloudpickle |
||||
ipyparallel |
||||
numba |
||||
numpy |
||||
python |
||||
]; |
||||
|
||||
buildInputs = [ |
||||
boost |
||||
eigen |
||||
ipopt |
||||
nlopt |
||||
pagmo2 |
||||
pybind11 |
||||
]; |
||||
|
||||
doCheck = true; |
||||
|
||||
meta = with lib; { |
||||
description = "Parallel optimisation for Python"; |
||||
homepage = "https://esa.github.io/pagmo2/"; |
||||
homepage = "https://github.com/esa/pygmo2"; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = [ maintainers.costrouc ]; |
||||
}; |
||||
} |
||||
}) |
||||
|
Loading…
Reference in new issue