aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-ox/APKBUILD
blob: 7dccc2127cd67bdf11425e4d34e48bba0ce034c3 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-ox
_gemname=${pkgname#ruby-}
pkgver=2.11.0
pkgrel=0
pkgdesc="A fast XML parser and object serializer for Ruby"
url="https://github.com/ohler55/ox"
arch="all"
license="MIT"
depends="ruby-bigdecimal"
checkdepends="ruby ruby-test-unit"
makedepends="ruby-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ohler55/$_gemname/archive/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	cd "$builddir"

	gem build $_gemname.gemspec
	gem install --local \
		--install-dir dist \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	cd dist/extensions/*/*/$_gemname-*/

	# ox expects ox.so to be in ox/ subdirectory, but does not install it here.
	mkdir ox && mv *.so ox/
	# Needed for tests.
	cp -l ox/*.so "$builddir"/ext/$_gemname/
}

check() {
	cd "$builddir"

	./test/tests.rb

	./test/sax/sax_test.rb > sax_test.log || {
		tail -n 50 sax_test.log
		return 1
	}
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	cd "$builddir"/dist

	mkdir -p "$gemdir"
	cp -r extensions gems specifications "$gemdir"/

	# Remove unnecessary and duplicated files.
	cd "$gemdir"/gems/$_gemname-$pkgver
	rm -r ext/ lib/*.so || true
}

sha512sums="4a755f6d1f832ec41b50b92deb686307d177c35eb1e27bb1e61c0b0a698db7730239fa4167f8a84892a9fb81cc67abeef059b1138b01759ba993a57471e4eff7  ruby-ox-2.11.0.tar.gz
c65e16d1611c64dc640c11f00f2e6ef8c70e3efa68fe479f0d7b5d54a96241fedfb7d0775c9371c7deef0b9dce1de63dbb75cb2e6c5756c7dd066164549da0ed  gemspec.patch"