APKBUILD 2.67 KB
Newer Older
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
1
# Contributor: Nirosan <pnirosan@gmail.com>
Jakub Jirutka's avatar
Jakub Jirutka committed
2 3
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
4
pkgname=R
5
pkgver=3.4.3
6
pkgrel=0
Jakub Jirutka's avatar
Jakub Jirutka committed
7
pkgdesc="Language and environment for statistical computing"
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
8
url="https://www.r-project.org"
9
arch="all !s390x"
10
license="GPL-2.0 GPL-3 LGPL-2.1"
11
depends="$pkgname-mathlib"
12
depends_dev="gcc gfortran icu-dev libjpeg-turbo libpng-dev make openblas-dev
13
	pcre-dev>=8.10 readline-dev xz-dev zlib-dev bzip2-dev curl-dev>=7.28
Jakub Jirutka's avatar
Jakub Jirutka committed
14
	"
15 16
makedepends="$depends_dev cairo-dev libxmu-dev openjdk8-jre-base pango-dev
	perl tiff-dev tk-dev
17 18
	"
install="$pkgname.post-install"
19
subpackages="$pkgname-mathlib $pkgname-dev $pkgname-doc"
Jakub Jirutka's avatar
Jakub Jirutka committed
20 21 22 23 24
source="https://cran.r-project.org/src/base/R-${pkgver%%.*}/$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

_rhome="usr/lib/R"
ldpath="/$_rhome/lib"
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
25 26

build() {
Jakub Jirutka's avatar
Jakub Jirutka committed
27 28
	cd "$builddir"

29 30 31 32
	# CXXFLAGS is propagated to /etc/R/Makeconf that is read when building
	# additional R modules. -D__MUSL__ is needed for some modules like Rcpp.
	# htps://github.com/RcppCore/Rcpp/issues/448
	CXXFLAGS="$CXXFLAGS -D__MUSL__" ./configure \
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
33
		--prefix=/usr \
Jakub Jirutka's avatar
Jakub Jirutka committed
34 35
		--sysconfdir=/etc/R \
		--localstatedir=/var \
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
36
		--mandir=/usr/share/man \
Jakub Jirutka's avatar
Jakub Jirutka committed
37
		--libdir=/usr/lib \
38 39 40
		rdocdir=/usr/share/doc/R \
		rincludedir=/usr/include/R \
		rsharedir=/usr/share/R \
Jakub Jirutka's avatar
Jakub Jirutka committed
41
		--disable-nls \
42 43 44
		--enable-R-shlib \
		--enable-java \
		--without-recommended-packages \
45
		--with-blas=openblas \
46 47 48
		--with-cairo \
		--with-ICU \
		--with-jpeglib \
Jakub Jirutka's avatar
Jakub Jirutka committed
49
		--with-lapack \
50 51 52
		--with-libpng \
		--with-libtiff \
		--with-tcltk \
tmpfile's avatar
tmpfile committed
53
		--with-x
Jakub Jirutka's avatar
Jakub Jirutka committed
54

55 56
	make -j1
	make -j1 -C src/nmath/standalone
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
57 58
}

59 60 61 62 63 64 65 66
# TODO: Run provided test suite.
check() {
	cd "$builddir"

	./bin/R --version
	./bin/R --slave --vanilla -e 'print("Hello, world!")'
}

Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
67
package() {
Jakub Jirutka's avatar
Jakub Jirutka committed
68 69 70 71
	local destdir="$pkgdir/$_rhome"

	cd "$builddir"

tmpfile's avatar
tmpfile committed
72
	make DESTDIR="$pkgdir" install
Jakub Jirutka's avatar
Jakub Jirutka committed
73 74 75

	# Install libRmath.so.
	cd src/nmath/standalone
tmpfile's avatar
tmpfile committed
76
	make DESTDIR="$pkgdir" install
Jakub Jirutka's avatar
Jakub Jirutka committed
77 78 79 80 81 82 83 84
	cd -

	# Fixup R wrapper script (taken from Arch).
	rm "$destdir"/bin/R
	ln -sf /usr/bin/R "$destdir"/bin/R

	# Remove some useless files (COPYING is duplicated, it will be
	# in -doc, don't worry).
85
	rm "$destdir"/COPYING "$destdir"/SVN-REVISION
Jakub Jirutka's avatar
Jakub Jirutka committed
86 87 88 89 90

	mkdir -p "$pkgdir"/etc/R

	# R apparently ignores --sysconfdir, so we must manually move configs
	# to /etc/R and make symlinks.
tmpfile's avatar
tmpfile committed
91
	cd "$destdir"/etc
Jakub Jirutka's avatar
Jakub Jirutka committed
92
	local f; for f in *; do
tmpfile's avatar
tmpfile committed
93
		mv "$f" "$pkgdir"/etc/R/ && ln -sf /etc/R/$f $f
Jakub Jirutka's avatar
Jakub Jirutka committed
94 95 96 97 98
	done
	cd -
}

mathlib() {
99
	pkgdesc="Standalone math library from the R project"
Jakub Jirutka's avatar
Jakub Jirutka committed
100

101 102
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libRmath.so* "$subpkgdir"/usr/lib
Nirosan Paramanathan's avatar
Nirosan Paramanathan committed
103 104
}

105
sha512sums="d4b89daac5060c6d32b2287192c47fc7e8f71f8c2f70f133799bb279c6e486239cb7f298779a59a124eb4228d728ffdaf6bb138c4fd64653bbce0cdf5b0b3412  R-3.4.3.tar.gz"