aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ruby-charlock_holmes/APKBUILD
blob: 379eb75d13eefe6bccef87d2d2bfe8a5ab7282f1 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-charlock_holmes
_gemname=charlock_holmes
pkgver=0.7.5
pkgrel=1
pkgdesc="Character encoding detection, brought to you by ICU"
url="https://github.com/brianmario/charlock_holmes"
arch="all"
license="MIT"
checkdepends="ruby-minitest ruby-rake"
makedepends="icu-dev ruby ruby-dev zlib-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/brianmario/$_gemname/archive/$pkgver.tar.gz
	gemspec.patch
	rakefile.patch
	tests-no-bundler.patch
	tests-fix-icu59.1.patch"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	cd "$builddir"

	gem build $_gemname.gemspec

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

	# Needed for tests.
	cp -l dist/extensions/*/*/$_gemname-*/$_gemname/*.so lib/$_gemname/
}

check() {
	cd "$builddir"
	rake test
}

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.
	rm -f "$gemdir"/extensions/*/*/$_gemname-*/mkmf.log
	cd "$gemdir"/gems/$_gemname-$pkgver
	rm -rf ext/ lib/$_gemname/*.so
}

sha512sums="a5ee9d47d8c8386e7be9ad10e93e7bd7663713df285b33e5d8afd865570e463a9f785e568675363f9b949a8207bbcc144a7378dfb206645824e9f0abc33ec668  ruby-charlock_holmes-0.7.5.tar.gz
c30ca2b7ac859bae553f633ed1df1947ad735c804f0edacd20c50d2d38d277d4a5a883459134a8caf832230754f272ec2a55e42e1cdf24eea1954aad9ead2679  gemspec.patch
ac59baaa1f17281f9b07c035b367e697e08943f4e0cf2b5a718e7a957c1c156bbea0c240646cdea94575e7729e60415ee6293edbaa7b86aad3285282b9385181  rakefile.patch
6fcdc90539154a007109a4958d7fc7451b0d5a69840866af928ce7233823b32a0f5a8d7d3d9b249978807ff8dced1a1f85d14187c99b7fff1f2497e26b11a120  tests-no-bundler.patch
231c0563a1bee92aafa0a20d3db8c28ecc9a5e85530825852ec6457edfd6db068f866b52310621c0be97e0e209835b12714f77ded47c0188e4c8180d8429cf64  tests-fix-icu59.1.patch"