aboutsummaryrefslogtreecommitdiffstats
path: root/testing/jruby/APKBUILD
blob: 0156653bac3c3abffd030a5ab9bc4478ddcb2a3c (plain) (blame)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# Note: This abuild excludes Truffle, because it's still experimental,
#       so it's probably not much usable for regular users.
pkgname=jruby
pkgver=9.0.5.0
pkgrel=0
pkgdesc="An implementation of Ruby on the JVM"
url="http://jruby.org"
arch="noarch"
license="EPL GPL-2 LGPL-2.1 custom"
# libc6-compat: https://github.com/jnr/jnr-posix/issues/73
depends="java-jffi-native>=1.2 libc6-compat openjdk8-jre"
makedepends="openjdk8 zip"
install="$pkgname.post-install"
subpackages="$pkgname-irb $pkgname-maven $pkgname-minitest $pkgname-rake
	$pkgname-rdoc $pkgname-readline $pkgname-testunit $pkgname-libs
	"
# jruby (launch script): https://github.com/jruby/jruby/pull/1860
source="https://s3.amazonaws.com/jruby.org/downloads/$pkgver/$pkgname-bin-$pkgver.tar.gz
	jruby
	"
builddir="$srcdir/$pkgname-$pkgver"

_destdir="/usr/share/$pkgname"
_bindir="$_destdir/bin"
_rubydir="$_destdir/lib/ruby"
_gemdir="$_rubydir/gems/shared"
_stdlibdir="$_rubydir/stdlib"

_arch="$CARCH"
case "$CARCH" in
arm*) _arch=arm;;
x86) _arch=i386;;
esac

prepare() {
	cd "$builddir/bin"
	rm *.bat *.dll *.exe
	rm jirb_swing jruby jruby+truffle jruby200.sh jruby.*

	cd "$builddir/lib/ruby/stdlib"
	rm -r win32 Win32API.rb
	find ./ffi/platform -type d -mindepth 1 ! -name "$_arch-linux" -exec rm -r {} +

	# Remove useless native binaries from JARs.
	zip -qd jline/jline/*/jline-*.jar META-INF/native/*
	zip -qd "$builddir"/lib/jruby.jar jni/*
}

build() {
	return 0
}

package() {
	depends="$pkgname-libs"

	cd "$builddir"

	install -m644 -D "$builddir"/lib/jruby.jar \
		"$pkgdir"$_destdir/lib/jruby.jar || return 1

	install -m755 -D "$srcdir"/jruby "$pkgdir"$_bindir/jruby || return 1

	# Some of the below copied files will be moved to subpackages by split functions.

	install -dm755 "$pkgdir"$_rubydir
	cp -r lib/ruby/.mvn lib/ruby/gems lib/ruby/stdlib \
		"$pkgdir"$_destdir/lib/ruby/ || return 1

	cp bin/* "$pkgdir"$_bindir/ || return 1

	install -dm755 "$pkgdir"/usr/bin
	local file; for file in jgem jirb jruby jrubyc; do
		ln -sf $_bindir/$file "$pkgdir"/usr/bin/$file || return 1
	done

        install -m644 -D COPYING \
		"$pkgdir/usr/share/licenses/$pkgname"/COPYING
}

irb() {
	pkgdesc="Interactive Ruby console"
	depends="$pkgname $pkgname-readline"

	_mvgem irb
	_mv $_bindir/irb usr/bin/jirb
}

maven() {
	pkgdesc="JRuby wrapper for Maven 3"
	depends="$pkgname maven>=3.3.3"

	local file; for file in maven/ maven.rb ruby-maven.rb ruby_maven.rb; do
		_mv $_stdlibdir/$file || return 1
	done

	_mv $_rubydir/.mvn || return 1
	ln -sf /usr/share/java/maven-3 "$subpkgdir"$_rubydir/maven-home
}

minitest() {
	pkgdesc="Ruby testing tool supporting TDD, BDD, mocking, and benchmarking"
	depends="$pkgname"

	_mvgem minitest
}

rake() {
	pkgdesc="Ruby based make-like utility."
	depends="$pkgname"

	_mvgem rake || return 1
	_mv $_bindir/rake
}

rdoc() {
	pkgdesc="Ruby documentation tool"
	depends="$pkgname $pkgname-irb"

	_mvgem rdoc || return 1
	_mv $_bindir/rdoc $_bindir/ri
}

readline() {
	pkgdesc="Readline support for JRuby"
	depends="$pkgname java-jansi-native"

	_mv $_stdlibdir/jline || return 1
	mv "$pkgdir"$_stdlibdir/readline* "$subpkgdir"$_stdlibdir/
}

testunit() {
	pkgdesc="Legacy xUnit family unit testing framework for Ruby."
	depends="$pkgname"

	_mvgem test-unit || return 1
	_mv $_stdlibdir/test $_bindir/testrb
}

libs() {
	pkgdesc="JRuby's standard libraries"
	depends=""

	_mv $_rubydir/gems $_rubydir/stdlib
}


_mv() {
	local path; for path in "$@"; do
		mkdir -p "$subpkgdir"/${path%/*}
		mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/ || return 1
	done
}

_mvgem() {
	local name="$1"
	local file

	cd "$pkgdir"
	for file in ./$_stdlibdir/$name.rb \
			./$_stdlibdir/$name \
			./$_gemdir/gems/$name-* \
			./$_gemdir/specifications/default/$name-*; do
		[ -e "$pkgdir"/$file ] || continue
		_mv "$file"
	done
}

md5sums="1d2dc649cbacbe26418ef3ba421018b1  jruby-bin-9.0.5.0.tar.gz
7e6d8f6168f4a69109ea9d14e3e9f874  jruby"
sha256sums="9ef392bd859690c9a838f6475040345e0c512f7fcc0b37c809a91cf671f5daf3  jruby-bin-9.0.5.0.tar.gz
51794ecefb0d8fd3084ffb10867e2feffc9ccfadb45021af68520cf75fe58590  jruby"
sha512sums="7c61cf010fbae571cd6ba334aefcfd917f6de8224d014026297b840d0b890523e94b2fea20f154c82c25c4f9d5992b9481fb569646a7023e5ddb42db1baf5f34  jruby-bin-9.0.5.0.tar.gz
d0f19f791274f00f5b35a5e9a5dfe885d58330ebd3fd959f7325e545357497609403b5646988651265d08ac7a08cfec8b88ec260da558bcb0db623d9b8ce5a20  jruby"