aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-nokogiri/APKBUILD
blob: d2dd0167da6c7343e391c904eea471b06cd00a8c (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
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-nokogiri
_gemname=${pkgname#ruby-}
pkgver=1.8.4
pkgrel=0
pkgdesc="An HTML, XML, SAX, and Reader parser"
url="http://nokogiri.org/"
arch="all"
license="MIT"
depends="ruby ruby-mini_portile2"
makedepends="ruby-dev libxml2-dev libxslt-dev"
checkdepends="ruby-minitest"
source="https://rubygems.org/downloads/$_gemname-$pkgver.gem
	fix-extconf.patch
	skip-tests-broken-on-musl.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

unpack() {
	default_unpack

	cd "$srcdir"
	gem unpack $_gemname-$pkgver.gem
}

prepare() {
	default_prepare

	cd "$builddir"

	# Generate gemspec (there's no gemspec in the source).
	gem specification -l --ruby "$srcdir"/$_gemname-$pkgver.gem \
		> "$builddir"/$_gemname.gemspec

	# Remove bundled external libraries etc.
	sed -i \
		-e 's|, "ports/archives/[^"][^"]*"||g' \
		-e 's|, "ports/patches/[^"][^"]*"||g' \
		-e '\@mini_portile@d' \
		$_gemname.gemspec
}

build() {
	cd "$builddir"

	gem build $_gemname.gemspec
	gem install \
		--local \
		--install-dir dist \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname-$pkgver.gem -- \
			--use-system-libraries
}

check() {
	cd "$builddir"/dist/gems/$_gemname-$pkgver

	# Note: This is copied from Fedora package.
	export LANG=ja_JP.UTF-8
	ruby -I.:lib:test:ext \
		-e 'require "test/helper"' \
		-e 'Dir.glob("test/**/test_*.rb") {|f| require f }'
}

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

	cd "$builddir"/dist

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

	cd "$gemdir"/gems/$_gemname-$pkgver

	# Remove unnecessary files and rubbish...
	rm -r ext/ patches/ suppressions/ tasks/ test/ \
		build_all test_all Rakefile .[a-z]* *.md *.rdoc *.txt *.yml || true
}

sha512sums="35ef9a4f8129abb0b5336356114be23a436f6cab0d4f3bb12f00415d64f0a2eaa7b9d746930a7198b9238ce13a1365b0de03fef54353fc071e23fec0f0cbe85d  nokogiri-1.8.4.gem
514cc33109357457dfd7739991f3d270fe62a26313a5dfed0f539e89e4ed8de7dd08744540c7becc93ad12e6d096f2c4b4c3fb15f47b827a65352b895ab62a89  fix-extconf.patch
5f92d4cf87751c404a33dfbdc035dd5b54163eccdc46b4f515e6d6367a9573cf3fc4ef3c12c5b9e099b20f6c563d5a573acb1c2716890e492bfb26aa91f2cb5d  skip-tests-broken-on-musl.patch"