aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-nokogiri/APKBUILD
blob: d70f8fff40d4bd88b396424b4cacf81f0b956b1d (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.10.4
pkgrel=1
pkgdesc="An HTML, XML, SAX, and Reader parser"
url="https://nokogiri.org/"
arch="all"
license="MIT"
depends="ruby ruby-mini_portile2"
makedepends="ruby-dev libxml2-dev libxslt-dev"
checkdepends="ruby-minitest ruby-test-unit"
source="https://github.com/sparklemotion/$_gemname/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	https://rubygems.org/downloads/$_gemname-$pkgver.gem
	remove-simplecov.patch
	skip-tests-broken-on-musl.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

# secfixes:
#   1.10.4-r0:
#     - CVE-2019-5477

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

	# Remove unnecessary files and rubbish...
	find dist/extensions/ -name mkmf.log -delete
	cd dist/gems/$_gemname-$pkgver/
	rm -rf ext/ patches/ lib/nokogiri/*.so *.md *.yml
}

check() {
	local extpath=$(dirname dist/extensions/*/*/$_gemname-$pkgver/gem_make.out)

	cd "$builddir"

	# Note: This is copied from Fedora package.
	export LANG=ja_JP.UTF-8
	ruby -I.:test:dist/gems/$_gemname-$pkgver/lib:$extpath \
		-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"/
}

sha512sums="c27877297d432b9a9baf3e0639600d6ca5b382a87ff0dc1efb5d9bb3c79aaa31a589a4491f938283e4f9d35e8d29b6f88a60e27a5d4c81e7b491e100f8d06a9d  nokogiri-1.10.4.tar.gz
4d852546d430d7de3da79d0b4006f71e9a909779a824530ced5df79a76dfd79ddc0415caa9f9bde582399abb816ea279de0fea6cdd40eafa0652347fb86aa220  nokogiri-1.10.4.gem
b3346647e55ded3c20775458f35f85c81222a7147c8e4040db0e09f1161e999d824570e29f4fc5bd34b9808ea047b9d2308ea32718b46143cceb777ffa2e63a6  remove-simplecov.patch
5f92d4cf87751c404a33dfbdc035dd5b54163eccdc46b4f515e6d6367a9573cf3fc4ef3c12c5b9e099b20f6c563d5a573acb1c2716890e492bfb26aa91f2cb5d  skip-tests-broken-on-musl.patch"