aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-ffi
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-10-23 22:14:12 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-10-23 22:14:12 +0200
commit21cc65393156af4cd058b7c06a3f0dfc6dbaa239 (patch)
tree9e891fc6bd9191056a7254788174989b03ffe5bd /community/ruby-ffi
parentf994013bb40eca91a3bb299d1455b8169bb7a28f (diff)
downloadaports-21cc65393156af4cd058b7c06a3f0dfc6dbaa239.tar.bz2
aports-21cc65393156af4cd058b7c06a3f0dfc6dbaa239.tar.xz
community/ruby-ffi: move from testing
Diffstat (limited to 'community/ruby-ffi')
-rw-r--r--community/ruby-ffi/APKBUILD68
-rw-r--r--community/ruby-ffi/ruby-ffi.post-install12
2 files changed, 80 insertions, 0 deletions
diff --git a/community/ruby-ffi/APKBUILD b/community/ruby-ffi/APKBUILD
new file mode 100644
index 0000000000..cb003f29e4
--- /dev/null
+++ b/community/ruby-ffi/APKBUILD
@@ -0,0 +1,68 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=ruby-ffi
+_gemname=ffi
+pkgver=1.9.18
+pkgrel=0
+pkgdesc="Ruby FFI library"
+url="https://github.com/ffi/ffi"
+arch="all"
+license="BSD"
+makedepends="libffi-dev ruby ruby-dev"
+install="$pkgname.post-install"
+source="$pkgname-$pkgver.tar.gz::https://github.com/ffi/$_gemname/archive/$pkgver.tar.gz"
+builddir="$srcdir/$_gemname-$pkgver"
+options="!check" # does not work with PaX (it'd need paxmark -m /usr/bin/ruby)
+
+build() {
+ cd "$builddir"
+
+ gem build $_gemname.gemspec
+ gem install --local \
+ --install-dir dist \
+ --ignore-dependencies \
+ --no-document \
+ --verbose \
+ $_gemname-$pkgver.gem
+}
+
+check() {
+ cd "$builddir"
+
+ # Install missing development dependencies needed and used only for running
+ # tests. We can't install them easily with bundler, because there's
+ # no way how to force it to NOT update already satisifed dependencies.
+ # We can't install them directly with gem either, because there's no
+ # way how to force it to instally only dependencies, not the gem itself.
+ local dev_deps=$(gem install --explain --development --minimal-deps $_gemname-$pkgver.gem \
+ | head -n -1 | sed -En 's/-([^-]+)$/:\1/p')
+ gem install --instal-dir=.gem --conservative $dev_deps
+
+ GEM_PATH='dist:.gem' .gem/bin/rspec
+}
+
+package() {
+ local gemdir="$pkgdir/$(ruby -rubygems -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 -r ext/ gen/ libtest/ spec/ lib/*.so Rakefile *.md || true
+ find lib/ffi/platform/* -prune ! -name "$carch-linux" -exec rm -rf {} +
+}
+
+sha512sums="49c52e5e42e436b7969c35a34b28bd7929d75372638ac5373486a1d624026c12dc682009bc101e4a2c8f1442ed6f1ba17b438cda2e02d4256622b489c4bd9945 ruby-ffi-1.9.18.tar.gz"
diff --git a/community/ruby-ffi/ruby-ffi.post-install b/community/ruby-ffi/ruby-ffi.post-install
new file mode 100644
index 0000000000..17917cc4df
--- /dev/null
+++ b/community/ruby-ffi/ruby-ffi.post-install
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if grep -qw PaX /proc/$$/status 2>/dev/null; then
+ cat >&2 <<-EOF
+ !!
+ !! ruby-ffi does not work on kernel with PaX, unless you disable MPROTECT
+ !! for ruby binary. If you're aware of security implications, execute:
+ !!
+ !! apk add paxmark && paxmark -m /usr/bin/ruby
+ !!
+ EOF
+fi