archrelease: copy trunk to community-any
[ArchLinux/community.git] / r / trunk / PKGBUILD
blob735959d05df090338d2eb428c1c27f57af3a748b
1 # Maintainer: Antonio Rojas <arojas@archlinux.org>
2 # Contributor: Ronald van Haren <ronald.archlinux.org>
3 # Contributor: Damir Perisa <damir.perisa@bluewin.ch>
4 # Contributor: K. Piche <kpiche@rogers.com>
6 pkgname=r
7 pkgver=4.3.0
8 pkgrel=1
9 pkgdesc='Language and environment for statistical computing and graphics'
10 arch=(x86_64)
11 license=(GPL)
12 url='https://www.r-project.org/'
13 depends=(lapack libtiff pcre2 perl libxmu pango zip unzip curl icu which)
14 makedepends=(jdk-openjdk gcc-fortran tk texlive-core)
15 optdepends=('tk: tcl/tk interface'
16             'texlive-bin: latex sty files'
17             'gcc-fortran: needed to compile some CRAN packages'
18             'openblas: faster linear algebra')
19 backup=('etc/R/Makeconf' 'etc/R/Renviron' 'etc/R/ldpaths' 'etc/R/repositories' 'etc/R/javaconf')
20 options=(!emptydirs)
21 source=(https://cran.r-project.org/src/base/R-${pkgver%%.*}/R-$pkgver.tar.gz
22         r.desktop
23         r.png
24         R.conf)
25 sha256sums=('45dcc48b6cf27d361020f77fde1a39209e997b81402b3663ca1c010056a6a609'
26             '25b01ea93fa704884b65ba002d44d4e99725bd826997e8c73b6467df9f23c798'
27             '1580d06a737951f4f3c903cbd514247d9071fc6868eb9c2de94bb999cc195cb1'
28             'b7833166041b06f716b6a79095d27d4abd83549816dc53193213827139eae6ef')
30 prepare() {
31   cd R-$pkgver
32   # set texmf dir correctly in makefile
33   sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
36 build() {
37   cd R-$pkgver
38 # -ffat-lto-objects is needed for third-party packages shipping static libraries
39   CFLAGS+=" -ffat-lto-objects" \
40   CXXFLAGS+=" -ffat-lto-objects" \
41   ./configure  --prefix=/usr \
42                --libdir=/usr/lib \
43                --sysconfdir=/etc/R \
44                --datarootdir=/usr/share \
45                rsharedir=/usr/share/R/ \
46                rincludedir=/usr/include/R/ \
47                rdocdir=/usr/share/doc/R/ \
48                --with-x \
49                --enable-R-shlib \
50                --enable-memory-profiling \
51                --with-lapack \
52                --with-blas \
53                F77=gfortran \
54                LIBnn=lib
55   make
56   make pdf info
58   cd src/nmath/standalone
59   make shared
62 package() {
63   cd R-$pkgver
64   make DESTDIR="$pkgdir" install install-pdf install-info
66 # install libRmath.so
67   cd src/nmath/standalone
68   make DESTDIR="$pkgdir" install
70 # Fixup R wrapper scripts.
71   sed -i "s|$pkgdir ||" "${pkgdir}/usr/bin/R"
72   rm "$pkgdir"/usr/lib/R/bin/R
73   cd "$pkgdir"/usr/lib/R/bin
74   ln -s ../../../bin/R
76 # install some freedesktop.org compatibility
77   install -Dm644 "$srcdir"/r.desktop -t "$pkgdir"/usr/share/applications
78   install -Dm644 "$srcdir"/r.png -t "$pkgdir"/usr/share/pixmaps
80 # move the config directory to /etc and create symlinks
81   install -d "$pkgdir"/etc/R
82   cd "$pkgdir"/usr/lib/R/etc
83   for _i in *; do
84     mv -f $_i "$pkgdir"/etc/R
85     ln -s /etc/R/$_i $_i
86   done
88 # Install ld.so.conf.d file to ensure other applications access the shared lib
89   install -Dm644 "$srcdir"/R.conf -t "$pkgdir"/etc/ld.so.conf.d
91 # Add provides for bundled packages
92   for _f in "$pkgdir"/usr/lib/R/library/*/DESCRIPTION; do
93     _pkg=$(grep Package: $_f | cut -d' ' -f2 | tr '[:upper:]' '[:lower:]')
94     _ver=$(grep Version $_f | cut -d' ' -f2)
95     _prov="r-$_pkg=${_ver/-/.}"
96     provides+=($_prov)
97   done