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

59 lines
1.5 KiB
Nix
Raw Normal View History

2019-06-22 01:20:28 +02:00
{ stdenv, lib, fetchurl, autoPatchelfHook, python }:
2018-07-14 23:50:24 +02:00
2019-06-22 01:20:28 +02:00
let
majorVersion = "8.1";
in stdenv.mkDerivation rec {
2018-07-14 23:50:24 +02:00
name = "gurobi-${version}";
2019-06-22 01:20:28 +02:00
version = "${majorVersion}.0";
2018-07-14 23:50:24 +02:00
src = with stdenv.lib; fetchurl {
url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
2019-01-13 23:22:55 +01:00
sha256 = "1yjqbzqnq4jjkjm616d36bgd3rmqr0a1ii17n0prpdjzmdlq63dz";
2018-07-14 23:50:24 +02: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 19:38:18 +01:00
cp lib/*.jar $out/lib/
cp lib/libGurobiJni*.so $out/lib/
2018-07-14 23:50:24 +02:00
cp lib/libgurobi*.so* $out/lib/
cp lib/libgurobi*.a $out/lib/
cp src/build/*.a $out/lib/
2018-11-14 19:38:18 +01: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 23:50:24 +02:00
'';
2019-06-22 01:20:28 +02:00
passthru.libSuffix = lib.replaceStrings ["."] [""] majorVersion;
2018-07-14 23:50:24 +02: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 ];
};
}