nixpkgs/pkgs/applications/science/math/gurobi/default.nix

59 lines
1.5 KiB
Nix
Raw Normal View History

2019-06-22 00:20:28 +01:00
{ stdenv, lib, fetchurl, autoPatchelfHook, python }:
2018-07-14 22:50:24 +01:00
2019-06-22 00:20:28 +01:00
let
majorVersion = "8.1";
in stdenv.mkDerivation rec {
pname = "gurobi";
2019-06-22 00:20:28 +01:00
version = "${majorVersion}.0";
2018-07-14 22:50:24 +01:00
src = with stdenv.lib; fetchurl {
url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
2019-01-13 22:22:55 +00:00
sha256 = "1yjqbzqnq4jjkjm616d36bgd3rmqr0a1ii17n0prpdjzmdlq63dz";
2018-07-14 22:50:24 +01:00
};
sourceRoot = "gurobi${builtins.replaceStrings ["."] [""] version}/linux64";
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ (python.withPackages (ps: [ ps.gurobipy ])) ];
buildPhase = ''
cd src/build
make
cd ../..
'';
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin/
rm $out/bin/gurobi.env
rm $out/bin/gurobi.sh
rm $out/bin/python2.7
cp lib/gurobi.py $out/bin/gurobi.sh
mkdir -p $out/include
cp include/gurobi*.h $out/include/
mkdir -p $out/lib
2018-11-14 18:38:18 +00:00
cp lib/*.jar $out/lib/
cp lib/libGurobiJni*.so $out/lib/
2018-07-14 22:50:24 +01:00
cp lib/libgurobi*.so* $out/lib/
cp lib/libgurobi*.a $out/lib/
cp src/build/*.a $out/lib/
2018-11-14 18:38:18 +00:00
mkdir -p $out/share/java
ln -s $out/lib/gurobi.jar $out/share/java/
ln -s $out/lib/gurobi-javadoc.jar $out/share/java/
2018-07-14 22:50:24 +01:00
'';
2019-06-22 00:20:28 +01:00
passthru.libSuffix = lib.replaceStrings ["."] [""] majorVersion;
2018-07-14 22:50:24 +01:00
meta = with stdenv.lib; {
description = "Optimization solver for mathematical programming";
homepage = https://www.gurobi.com;
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ jfrankenau ];
};
}