summaryrefslogtreecommitdiff
path: root/community/sage-mathematics/PKGBUILD
blob: 3046bc23a4f7853d8a171edb19ae43c0af1de885 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# $Id: PKGBUILD 96935 2013-09-09 01:33:22Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Antonio Rojas < nqn1976 @ gmail.com >
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Osman Ugus <ugus11@yahoo.com>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD

pkgname=sage-mathematics
pkgver=5.11
pkgrel=1
pkgdesc='SAGE: Open Source Mathematics Software, a viable free alternative to Magma, Maple, Mathematica, and Matlab.'
url='http://www.sagemath.org'
arch=('i686' 'x86_64')
license=('GPL')
#depends=('xz' 'java-environment=7' 'desktop-file-utils' 'libxmu' 'libtiff' 'sqlite' 'libjpeg-turbo')
depends=('desktop-file-utils')
makedepends=('gcc-fortran' 'freetype2')
optdepends=('imagemagick: some plotting functionality benefits from it'
            'texlive-core: some plotting functionality benefits from it, also to use SageTeX'
            'openssh: to use the notebook in secure mode'
            'ffmpeg: to show animations'
            'cairo: R plots')
install="${pkgname}.install"
source=("http://sage.math.washington.edu/home/release/sage-${pkgver}/sage-${pkgver}.tar"
        'SAGE-notebook.desktop'
        'sage.service')

build() {
  cd sage-${pkgver}

  # fix "missing sage.all error" during build
  unset CFLAGS
  unset CXXFLAGS

  # fix build errors
  unset LDFLAGS

  # enable multiple threads while building, is this really needed? check if uses MAKEFLAGS
  export MAKE="make -j$(nproc)"

  # use archlinux's fortran rather then the one that ships with sage to compile sage's fortran
  export FC=/usr/bin/gfortran

  # disable building with debugging support
  export SAGE_DEBUG='no'

  # enable fat binaries (disables processor specific optimizations)
  # comment out if you're only building it for yourself
  export SAGE_FAT_BINARY='yes'

  # can't write to root in a clean chroot
  mkdir "$srcdir/buiild"
  export DOT_SAGE="$srcdir/build"

  # Singular is broken
  export CPP='/usr/bin/cpp'

  # only build sage, no documents
  #make build
  make
  ./sage --bdist "$pkgver"
}

<< COMMENT
check() {
  cd sage-${pkgver}

  # uncomment if we want to run all the tests (warning: very long)
  #make ptestlong
}
COMMENT

package() {
  cd sage-${pkgver}

  # cp because make install is experimental and will corrupt the install
  install -d ${pkgdir}/opt/sage
  cp -dpr --no-preserve=ownership dist/sage-"$pkgver-$CARCH-Linux/"* ${pkgdir}/opt/sage/

  # move SageTeX files to more appropriate directory
  install -d ${pkgdir}/usr/share
  mv ${pkgdir}/opt/sage/local/share/texmf \
    ${pkgdir}/usr/share

  desktop-file-install ${srcdir}/SAGE-notebook.desktop \
    --dir ${pkgdir}/usr/share/applications 

  # create link to main binary
  install -d ${pkgdir}/usr/bin
  ln -s /opt/sage/sage ${pkgdir}/usr/bin/sage

  # remove build logs
  rm -f ${pkgdir}/opt/sage/*.log
  rm -rf ${pkgdir}/opt/sage/spkg/logs

  # remove source packages, since they are rarely needed, they are 300mb in size (compressed)
  rm -f ${pkgdir}/opt/sage/spkg/base/*spkg
  rm -f ${pkgdir}/opt/sage/spkg/standard/*spkg

  # install a systemd user unit
  install -Dm755 $srcdir/sage.service $pkgdir/usr/lib/systemd/user/sage.service
}

# vim :set ts=2 sw=2 et:
md5sums=('ceeccaa83f45a4fb674acf10f76543d8'
         'b82f94383829eee26648feb977e2d89b'
         '985da1c1d1dcdc3ea9aa73035cb7996b')
md5sums=('ceeccaa83f45a4fb674acf10f76543d8'
         'b82f94383829eee26648feb977e2d89b'
         '985da1c1d1dcdc3ea9aa73035cb7996b')