aboutsummaryrefslogtreecommitdiffstats
path: root/testing/R/APKBUILD
blob: 9c89f611123afd6f40e032307e24404bc26d51da (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
112
113
114
# Contributor: Nirosan <pnirosan@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=R
pkgver=3.3.0
pkgrel=3
pkgdesc="Language and environment for statistical computing"
url="https://www.r-project.org"
arch="x86_64 x86"
license="GPL-2 GPL-3 LGPL-2.1"
depends=""
depends_dev="gcc gfortran icu-dev lapack-dev libjpeg-turbo libpng-dev make
	pcre-dev>=8.10 readline-dev xz-dev zlib-dev
	"
makedepends="$depends_dev bzip2-dev cairo-dev curl-dev>=7.28 libxmu-dev
	openjdk8-jre-base pango-dev perl tiff-dev tk-dev
	"
install="$pkgname.post-install"
subpackages="
	$pkgname-mathlib
	$pkgname-mathlib-dev:mathlib_dev
	$pkgname-dev
	$pkgname-doc
	"
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"

build() {
	cd "$builddir"

	./configure \
		--prefix=/usr \
		--sysconfdir=/etc/R \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--libdir=/usr/lib \
		rdocdir=/usr/share/doc/R \
		rincludedir=/usr/include/R \
		rsharedir=/usr/share/R \
		--disable-nls \
		--enable-R-shlib \
		--enable-java \
		--without-recommended-packages \
		--with-blas \
		--with-cairo \
		--with-ICU \
		--with-jpeglib \
		--with-lapack \
		--with-libpng \
		--with-libtiff \
		--with-tcltk \
		--with-x \
		|| return 1
	make || return 1

	cd src/nmath/standalone
	make shared
}

package() {
	local destdir="$pkgdir/$_rhome"

	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1

	# Install libRmath.so.
	cd src/nmath/standalone
	make DESTDIR="$pkgdir" install || return 1
	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).
	rm "$destdir"/COPYING "$destdir"/SVN-REVISION

	mkdir -p "$pkgdir"/etc/R

	# R apparently ignores --sysconfdir, so we must manually move configs
	# to /etc/R and make symlinks.
	cd "$destdir"/etc || return 1
	local f; for f in *; do
		mv "$f" "$pkgdir"/etc/R/ && ln -sf /etc/R/$f $f || return 1
	done
	cd -
}

mathlib() {
	pkgdesc="$pkgdesc (libRmath)"

	install -D "$pkgdir"/usr/lib/libRmath.so \
		"$subpkgdir"/usr/lib/libRmath.so
}

mathlib_dev() {
	pkgdesc="$pkgdesc (libRmath, development files)"
	depends="$pkgname-mathlib"

	local path
	for path in usr/lib/libRmath.so usr/lib/pkgconfig/libRmath.pc; do
		mkdir -p "$subpkgdir"/$(dirname $path)
		mv "$pkgdir"/$path "$subpkgdir"/$path || return 1
	done
}

md5sums="5a7506c8813432d1621c9725e86baf7a  R-3.3.0.tar.gz"
sha256sums="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4  R-3.3.0.tar.gz"
sha512sums="81e9ef761bee4d9322ca785fbed843ab13c2f5b55be769d982a81a7e7694e03980cbc7ee067fc850bd7a17ab65d93be81f27db50d428665773174c690383d4cc  R-3.3.0.tar.gz"