diff options
author | A git user | 2021-01-16 21:09:23 +0100 |
---|---|---|
committer | A git user | 2021-01-16 21:09:23 +0100 |
commit | bc5f7aba2ce7ed983661d42218b1a79a78b03633 (patch) | |
tree | 63ee0ba0b5b82f2ababf5bd0794367bcd8c88d41 | |
download | aur-bc5f7aba2ce7ed983661d42218b1a79a78b03633.tar.gz |
Initial version
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | PKGBUILD | 86 | ||||
-rw-r--r-- | gurobi.install | 8 | ||||
-rwxr-xr-x | gurobi.sh | 4 | ||||
-rw-r--r-- | gurobi_setup.m | 51 |
5 files changed, 174 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..6d207aeaef58 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = gurobi81 + pkgdesc = State-of-the-art solver for mathematical programming + pkgver = 8.1.0 + pkgrel = 1 + url = http://www.gurobi.com/products/gurobi-optimizer + arch = x86_64 + license = custom + depends = python37 + depends = python2>=2.7.0 + optdepends = gcc: C/C++ programming interfaces support + optdepends = java-environment: Java programming interface support + optdepends = mono: .NET programming interface support + optdepends = matlab: MATLAB programming interface support, versions 2008b onwards + provides = gurobi + conflicts = gurobi + source = https://packages.gurobi.com/8.1/gurobi8.1.0_linux64.tar.gz + source = gurobi.sh + source = gurobi_setup.m + sha256sums = bf0d8369ab5fb69b2fb027c41814c8b8e6d1de32a39960aa9c52126cf15f58fa + sha256sums = 30d535f7100627195dbe8d1c9a5ce603ed645b93eb8869984eb8a15e8db6d1c8 + sha256sums = fd328dc00b276258e7828b301c93574f9aa8e6f143caf5428a648851a6ecf93c + +pkgname = gurobi81 + install = gurobi.install + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..84eb5cfbd250 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,86 @@ +# Maintainer: Lukas Rose <public@lrose.de> +# Contributor: Marcos M. Raimundo <marcosmrai@gmail.com> + +# Before building this PKGBUILD, you must download the Gurobi Optimizer +# archive at http://www.gurobi.com/download/gurobi-optimizer and put it +# in the same directory as this PKGBUILD. Registration at gurobi.com is +# required, though free of charge, to be able to download the archive. + +pkgname=('gurobi81') +_basename=gurobi +pkgver=8.1.0 +pkgrel=1 +pkgdesc="State-of-the-art solver for mathematical programming" +arch=('x86_64') +url="http://www.gurobi.com/products/gurobi-optimizer" +license=('custom') +provides=('gurobi') +conflicts=('gurobi') +depends=('python37' 'python2>=2.7.0') +optdepends=( + 'gcc: C/C++ programming interfaces support' + 'java-environment: Java programming interface support' + 'mono: .NET programming interface support' + 'matlab: MATLAB programming interface support, versions 2008b onwards' +) +source=( +# "${_basename}${pkgver}_linux64.tar.gz::file://${_basename}${pkgver}_linux64.tar.gz" + "https://packages.gurobi.com/8.1/gurobi8.1.0_linux64.tar.gz" + "gurobi.sh" + "gurobi_setup.m" +) +sha256sums=('bf0d8369ab5fb69b2fb027c41814c8b8e6d1de32a39960aa9c52126cf15f58fa' + '30d535f7100627195dbe8d1c9a5ce603ed645b93eb8869984eb8a15e8db6d1c8' + 'fd328dc00b276258e7828b301c93574f9aa8e6f143caf5428a648851a6ecf93c') + +prepare() { + cd "$srcdir/${_basename}${pkgver//./}/linux64/" + + rm bin/python2.7 + rm -r examples/build/ + + # Adapt cross-platform scripts to Arch Linux + cp ${srcdir}/gurobi.sh bin/ + cp ${srcdir}/gurobi_setup.m matlab/ +} + +package_gurobi81() { + install=${_basename}.install + + cd "$srcdir/${_basename}${pkgver//./}/linux64/" + + install -d "${pkgdir}/usr/bin/" "${pkgdir}/usr/share/doc/${_basename}/" \ + "${pkgdir}/usr/include/" "${pkgdir}/usr/lib/${_basename}/matlab/" + + # License + install -D -m644 EULA.pdf "${pkgdir}/usr/share/licenses/${_basename}/EULA.pdf" + + # Examples + install -D -m644 bin/gurobi.env "${pkgdir}/usr/share/${_basename}/gurobi.env" + cp -r examples/ "${pkgdir}/usr/share/${_basename}/" + + # Binaries and related files + install bin/* "${pkgdir}/usr/bin/" + rm "${pkgdir}/usr/bin/gurobi.env" + install -D lib/gurobi.py "${pkgdir}/usr/lib/${_basename}/gurobi.py" + + # Documentation + cp -rT docs/ "${pkgdir}/usr/share/doc/${_basename}/" + + # Headers + install -m644 include/*.h "${pkgdir}/usr/include/" + + # Programming interfaces + install lib/*.so* "${pkgdir}/usr/lib/" + install -m644 lib/*.a "${pkgdir}/usr/lib/" + ln -sf ./libgurobi.so.8.1.0 "${pkgdir}/usr/lib/libgurobi810.so" + ln -sf ./libgurobi_g++5.2.a "${pkgdir}/usr/lib/libgurobi_c++.a" + + python3.7 setup.py install --root="$pkgdir" --optimize=1 + install -D "lib/python3.7_utf32/gurobipy/gurobipy.so" "${pkgdir}/usr/lib/python3.7/site-packages/gurobipy/" + + install -D -m644 lib/gurobi.jar "${pkgdir}/usr/share/java/${_basename}/gurobi.jar" + + install matlab/*.mexa64 "${pkgdir}/usr/lib/${_basename}/matlab/" + install -m644 matlab/*.m "${pkgdir}/usr/lib/${_basename}/matlab/" +} diff --git a/gurobi.install b/gurobi.install new file mode 100644 index 000000000000..f1d76ba33512 --- /dev/null +++ b/gurobi.install @@ -0,0 +1,8 @@ +post_install() { + echo "The Gurobi Optimizer requires a license to run." + echo "To install your Gurobi License, make sure you are connected to Internet" + echo "and run: grbgetkey <license-ID>." + echo "If you choose to store the license file somewhere else than the default" + echo "location (your home directory), you must set the environment variable:" + echo "GRB_LICENSE_FILE=/path/to/gurobi.lic" +} diff --git a/gurobi.sh b/gurobi.sh new file mode 100755 index 000000000000..062e184563c1 --- /dev/null +++ b/gurobi.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export PYTHONSTARTUP=/usr/lib/gurobi/gurobi.py +python $* diff --git a/gurobi_setup.m b/gurobi_setup.m new file mode 100644 index 000000000000..6be62f1aaeb1 --- /dev/null +++ b/gurobi_setup.m @@ -0,0 +1,51 @@ +function gurobi_setup() +% gurobi_setup Setup and test the Gurobi Matlab interface + +% Numeric version +ver = version; +ver(ver=='.') = ' '; +ver = sscanf(ver,'%d'); + +if (ver(1) ~= 7 && ver(1) ~= 8) || ... + (ver(1) == 7 && ver(2) < 7) || ... + (ver(1) == 8 && ver(2) > 3) + warning('gurobi_setup:MATLABver', ... + ['You are using MATLAB %s.\n' ... + 'The Gurobi MATLAB interface currently supports ' ... + 'R2008b-R2015b.'], version); +end + +gurobipath = mfilename('fullpath'); +slashes = strfind(gurobipath, '/'); +gurobipath = gurobipath(1:slashes(end)); +addpath(gurobipath) + +try + gurobi(1) +catch me + if ~strcmp(me.identifier, 'gurobi:BadInput') + throw(me) + end +end + +% gurobi.mex* is loaded, now test for license issues +model.obj = 1; +model.A = sparse(1,1); +model.rhs = 0; +model.sense = '='; +params.outputflag = false; +result = gurobi(model, params); + +fprintf('\nThe MATLAB interface for Gurobi %d.%d.%d has been installed.\n\n', ... + result.versioninfo.major, result.versioninfo.minor, ... + result.versioninfo.technical); + + +disp('The directory') +disp([' ' gurobipath]) +disp('has been added to the MATLAB path.') +disp('To use Gurobi regularly, you must save this new path definition.'); +disp('To do this, type the command' ); +disp(' savepath' ); +disp('at the MATLAB prompt. Please consult the MATLAB documentation'); +disp('if necessary.'); |