nixpkgs/pkgs/development/python-modules/gurobipy/darwin.nix

34 lines
1.2 KiB
Nix
Raw Normal View History

{ fetchurl, python, xar, cpio, cctools, insert_dylib }:
2017-12-09 22:41:18 +00:00
assert python.pkgs.isPy27 && python.ucsEncoding == 2;
python.pkgs.buildPythonPackage
{ pname = "gurobipy";
version = "7.5.2";
2017-12-09 20:00:43 +00:00
src = fetchurl
2017-12-22 16:43:09 +00:00
{ url = "http://packages.gurobi.com/7.5/gurobi7.5.2_mac64.pkg";
sha256 = "10zgn8741x48xjdiknj59x66mwj1azhihi1j5a1ajxi2n5fsak2h";
2017-12-09 20:00:43 +00:00
};
buildInputs = [ xar cpio cctools insert_dylib ];
unpackPhase =
2017-12-09 20:00:43 +00:00
''
xar -xf $src
zcat gurobi*mac64tar.pkg/Payload | cpio -i
tar xf gurobi*_mac64.tar.gz
sourceRoot=$(echo gurobi*/*64)
runHook postUnpack
'';
2017-12-22 16:43:09 +00:00
patches = [ ./no-clever-setup.patch ];
postInstall = "mv lib/lib*.so $out/lib";
postFixup =
''
2017-12-09 20:00:43 +00:00
install_name_tool -change \
/System/Library/Frameworks/Python.framework/Versions/2.7/Python \
${python}/lib/libpython2.7.dylib \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
2017-12-22 16:43:09 +00:00
install_name_tool -change /Library/gurobi752/mac64/lib/libgurobi75.so \
$out/lib/libgurobi75.so \
2017-12-09 20:00:43 +00:00
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
2017-12-22 16:43:09 +00:00
insert_dylib --inplace $out/lib/libaes75.so \
2017-12-09 20:00:43 +00:00
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
'';
}