summaryrefslogtreecommitdiff
path: root/repo/ruby-nokogiri/ruby-nokogiri.xibuild
blob: 75e6d95912449bf3da6374e83e9c8c21c91a4185 (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
#!/bin/sh

NAME="ruby-nokogiri"
DESC="An HTML, XML, SAX, and Reader parser"

MAKEDEPS="libxml2 libxslt ruby ruby-mini_portile2"

_gemname=${NAME#ruby-}

PKG_VER=1.13.8
SOURCE="https://github.com/sparklemotion/$_gemname/archive/v$PKG_VER/$_gemname-$PKG_VER.tar.gz"

ADDITIONAL="
gemspec-fix-deps.patch
shutdown-libxml2-warning.patch
test-helper-remove-unnecessary-deps.patch
"

build() {
	gem build $_gemname.gemspec
	gem install \
		--local \
		--install-dir dist \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname-$PKG_VER.gem -- \
			--use-system-libraries

	# Remove unnecessary files and rubbish...
	find dist/extensions/ -name mkmf.log -delete
	cd dist/gems/$_gemname-$PKG_VER/
	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-$PKG_VER/gem_make.out)

	case "$CARCH" in
		# Fix NotImplementedError: Compaction isn't available on this platform.
		ppc64le) export NOKOGIRI_TEST_GC_LEVEL=major;;
	esac

	# Note: This is based on Fedora package.
	LANG="C.UTF-8" RUBYLIB=".:dist/gems/$_gemname-$PKG_VER/lib:test:$extpath" ruby \
		-e 'require "test/helper"' \
		-e 'Dir.glob("test/**/test_*.rb") {|f| require f }'
}

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

	cd "$BUILD_ROOT"/dist

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