2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, makeWrapper, openjdk, gtk2, xorg, glibcLocales, releasePath ? null }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# To use this package, you need to download your own cplex installer from IBM
|
2021-01-17 00:15:33 +00:00
|
|
|
# and override the releasePath attribute to point to the location of the file.
|
2020-04-24 23:36:52 +00:00
|
|
|
#
|
|
|
|
# Note: cplex creates an individual build for each license which screws
|
|
|
|
# somewhat with the use of functions like requireFile as the hash will be
|
|
|
|
# different for every user.
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cplex";
|
|
|
|
version = "128";
|
2021-01-17 00:15:33 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src =
|
|
|
|
if releasePath == null then
|
|
|
|
throw ''
|
|
|
|
This nix expression requires that the cplex installer is already
|
2021-01-17 00:15:33 +00:00
|
|
|
downloaded to your machine. Get it from IBM:
|
|
|
|
https://developer.ibm.com/docloud/blog/2017/12/20/cplex-optimization-studio-12-8-now-available/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
Set `cplex.releasePath = /path/to/download;` in your
|
|
|
|
~/.config/nixpkgs/config.nix for `nix-*` commands, or
|
|
|
|
`config.cplex.releasePath = /path/to/download;` in your
|
|
|
|
`configuration.nix` for NixOS.
|
|
|
|
''
|
|
|
|
else
|
|
|
|
releasePath;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ openjdk gtk2 xorg.libXtst glibcLocales ];
|
|
|
|
|
|
|
|
unpackPhase = "cp $src $name";
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i -e 's|/usr/bin/tr"|tr" |' $name
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
sh $name -i silent -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=$out
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s $out/opl/bin/x86-64_linux/oplrun\
|
|
|
|
$out/opl/bin/x86-64_linux/oplrunjava\
|
|
|
|
$out/opl/oplide/oplide\
|
|
|
|
$out/cplex/bin/x86-64_linux/cplex\
|
|
|
|
$out/cpoptimizer/bin/x86-64_linux/cpoptimizer\
|
|
|
|
$out/bin
|
|
|
|
'';
|
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
fixupPhase =
|
|
|
|
let
|
|
|
|
libraryPath = lib.makeLibraryPath [ stdenv.cc.cc gtk2 xorg.libXtst ];
|
2020-04-24 23:36:52 +00:00
|
|
|
in ''
|
|
|
|
interpreter=${stdenv.glibc}/lib/ld-linux-x86-64.so.2
|
|
|
|
|
|
|
|
for pgm in $out/opl/bin/x86-64_linux/oplrun $out/opl/bin/x86-64_linux/oplrunjava $out/opl/oplide/oplide;
|
|
|
|
do
|
|
|
|
patchelf --set-interpreter "$interpreter" $pgm;
|
|
|
|
wrapProgram $pgm \
|
|
|
|
--prefix LD_LIBRARY_PATH : $out/opl/bin/x86-64_linux:${libraryPath} \
|
|
|
|
--set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive;
|
|
|
|
done
|
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
for pgm in $out/cplex/bin/x86-64_linux/cplex $out/cpoptimizer/bin/x86-64_linux/cpoptimizer $out/opl/oplide/jre/bin/*;
|
2020-04-24 23:36:52 +00:00
|
|
|
do
|
|
|
|
if grep ELF $pgm > /dev/null;
|
|
|
|
then
|
|
|
|
patchelf --set-interpreter "$interpreter" $pgm;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
libArch = "x86-64_linux";
|
|
|
|
libSuffix = "${version}0";
|
|
|
|
};
|
2021-01-17 00:15:33 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Optimization solver for mathematical programming";
|
|
|
|
homepage = "https://www.ibm.com/be-en/marketplace/ibm-ilog-cplex";
|
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ bfortz ];
|
|
|
|
};
|
|
|
|
}
|