aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-ffi/APKBUILD
blob: d950d5b7f4d1f54bf0dbd6814bc487970d67e47a (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-ffi
_gemname=ffi
pkgver=1.11.1
pkgrel=0
pkgdesc="Ruby FFI library"
url="https://github.com/ffi/ffi"
arch="all"
license="BSD-3-Clause"
checkdepends="ruby-fiddle ruby-rspec"
makedepends="libffi-dev ruby ruby-dev"
install="$pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/ffi/$_gemname/archive/$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
	gem install --local \
		--install-dir dist \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname-$pkgver.gem
}

check() {
	GEM_PATH='dist:.gem' rspec
}

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

	local carch
	case "$CARCH" in
		x86) carch="i386";;
		arm*) carch="arm";;
		ppc64le) carch="powerpc64";;
		*) carch="$CARCH";;
	esac

	cd "$builddir"/dist

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

	# Remove unnecessary files and rubbish...
	find "$gemdir"/extensions/ -name mkmf.log -delete

	cd "$gemdir"/gems/$_gemname-$pkgver
	rm -rf ext/ lib/*.so
	find lib/ffi/platform/* -prune ! -name "$carch-linux" -exec rm -rf {} +
}

sha512sums="7f6c2ae66a2ffc40b154ada2d3e2c0f81e79803ba693ce2a83d16ac6a210ac5494bcc4b28948b3b68c9802a7cacce77e4a7cb1c3c1105039c08c50e5c8137fd4  ruby-ffi-1.11.1.tar.gz
4ed0d22ad42dd6b3a20532af09bca0501c7d90fb087d49f7b8e537579aa98ab42bfc21d0f647b601524d72e8187327780b4ee45208d36b6a6507d2cc1b0b7cc2  gemspec.patch"