summarylogtreecommitdiffstats
path: root/PKGBUILD (copy)
blob: f07317dd7cfeb1bc7c6966a167e9d62dd4275fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Maintainer: 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=('gurobi')
_basename=gurobi
pkgver=7.0.1
pkgrel=1
pkgdesc="State-of-the-art solver for mathematical programming"
arch=('x86_64')
url="http://www.gurobi.com/products/gurobi-optimizer"
license=('custom')
depends=('python>=3.5.0' 'python<3.7')
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 to 2015b'
)
source=(
  "${_basename}${pkgver}_linux64.tar.gz::file://${_basename}${pkgver}_linux64.tar.gz"
  "gurobi.sh"
  "gurobi_setup.m"
)
sha256sums=('2af561c9c4511374728cbf8b4dce901845dc9c6660c299a1ecde7a5e84d9f472'
            '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_gurobi() {
  install=${_basename}.install

  cd "$srcdir/${_basename}${pkgver//./}/linux64/"

  awk 'NR==22 {$0="if version != (2, 7) and version != (3, 5) and version != (3, 6):"} 1' setup.py > setup2.py
  mv setup2.py setup.py
  cp -r lib/python3.5_utf32 lib/python3.6_utf32 

  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.7.0.1 "${pkgdir}/usr/lib/libgurobi65.so"
  ln -sf ./libgurobi_g++5.2.a "${pkgdir}/usr/lib/libgurobi_c++.a"

  python2 setup.py install --root="$pkgdir" --optimize=1
  python3 setup.py install --root="$pkgdir" --optimize=1
  install -D "lib/python3.6_utf32/gurobipy/gurobipy.so" "${pkgdir}/usr/lib/python3.6/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/"
}