3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/science/math/gurobi/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

59 lines
1.5 KiB
Nix

{ stdenv, lib, fetchurl, autoPatchelfHook, python }:
let
majorVersion = "8.1";
in stdenv.mkDerivation rec {
pname = "gurobi";
version = "${majorVersion}.0";
src = with stdenv.lib; fetchurl {
url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
sha256 = "1yjqbzqnq4jjkjm616d36bgd3rmqr0a1ii17n0prpdjzmdlq63dz";
};
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
cp lib/*.jar $out/lib/
cp lib/libGurobiJni*.so $out/lib/
cp lib/libgurobi*.so* $out/lib/
cp lib/libgurobi*.a $out/lib/
cp src/build/*.a $out/lib/
mkdir -p $out/share/java
ln -s $out/lib/gurobi.jar $out/share/java/
ln -s $out/lib/gurobi-javadoc.jar $out/share/java/
'';
passthru.libSuffix = lib.replaceStrings ["."] [""] majorVersion;
meta = with lib; {
description = "Optimization solver for mathematical programming";
homepage = "https://www.gurobi.com";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ jfrankenau ];
};
}