aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-nokogiri/APKBUILD
blob: 6e89055aa18ffde49eaa06d8767ca58021f393f9 (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
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-nokogiri
_gemname=${pkgname#ruby-}
pkgver=1.11.7
pkgrel=0
pkgdesc="An HTML, XML, SAX, and Reader parser"
url="https://nokogiri.org/"
arch="all !s390x"
license="MIT"
depends="ruby"
makedepends="ruby-dev ruby-mini_portile2 libxml2-dev libxslt-dev"
checkdepends="ruby-json ruby-minitest ruby-test-unit"
source="https://github.com/sparklemotion/$_gemname/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	gemspec-fix-deps.patch
	test-helper-remove-unnecessary-deps.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

# secfixes:
#   1.11.6-r0:
#     - CVE-2020-26247
#   1.10.4-r0:
#     - CVE-2019-5477

build() {
	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/
	rm *.md *.yml
	rm lib/*.jar
	rm lib/nokogiri/*.so
	rm lib/nokogiri/css/*.rex lib/nokogiri/css/*.y
}

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

	# Note: This is based on Fedora package.
	LANG="C.UTF-8" RUBYLIB=".:dist/gems/$_gemname-$pkgver/lib:test:$extpath" ruby \
		-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="
f355185f490e0ce73fdfb496f49e36b39c89835ebef2cbe3aecbfc5aceb5a9757dc07738a709059c3e22b5808fac11e7b340b7ebbb3b2c1b5ea3df8aff0db131  nokogiri-1.11.7.tar.gz
87911f3fa1fa26f2bb5f2abc851fa29527aeab276da05ddb45d92be960a2d742361f388c91d836fad8d43550a7b05822e05806f1591868edd1c82f09f6f1e20e  gemspec-fix-deps.patch
81c05ac93387a5f6f0b3e7389f7c14cc9398344f91061e2cf57682a53979cecbf5c0f05913d8f1b320887fa123fa18421fea8043bb757a9bcca692e4fec84448  test-helper-remove-unnecessary-deps.patch
"