diff options
-rw-r--r-- | testing/ruby2.1/APKBUILD | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/testing/ruby2.1/APKBUILD b/testing/ruby2.1/APKBUILD new file mode 100644 index 0000000000..3eee82da9e --- /dev/null +++ b/testing/ruby2.1/APKBUILD @@ -0,0 +1,188 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +pkgname=ruby2.1 +_pkgname=ruby +pkgver=2.1.9 +_pkgver=${pkgver/_/-} +_suffix=${pkgname#ruby} +_abi=2.1.0 +pkgrel=0 +pkgdesc="An object-oriented language for quick and easy programming" +url="http://www.ruby-lang.org/en/" +arch="all" +license="Ruby" +depends="" +makedepends="zlib-dev openssl-dev gdbm-dev db-dev readline-dev + libffi-dev coreutils yaml-dev autoconf" +subpackages="$pkgname-doc $pkgname-dev $pkgname-irb + $pkgname-rdoc $pkgname-rake $pkgname-bigdecimal + $pkgname-io-console:io_console $pkgname-minitest + $pkgname-json $pkgname-libs + " +source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/$_pkgname-$_pkgver.tar.bz2" +options="!fhs" +builddir="$srcdir/$_pkgname-$_pkgver" + +_gemdir="/usr/lib/ruby/gems/$_abi" +_rubydir="/usr/lib/ruby/$_abi" + +_arch=$CARCH +case $CARCH in + x86) _arch=i386;; +esac + +prepare() { + default_prepare || return 1 + + cd "$builddir" + autoconf +} + +build() { + cd "$builddir" + + # -fomit-frame-pointer makes ruby segfault, see gentoo bug #150413 + # In many places aliasing rules are broken; play it safe + # as it's risky with newer compilers to leave it as it is. + export CFLAGS="$CFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" + + # ruby saves path to install. we want use $PATH + export INSTALL=install + + # the configure script does not detect isnan/isinf as macros + export ac_cv_func_isnan=yes + export ac_cv_func_isinf=yes + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --with-sitedir='/usr/local/lib/site_ruby' \ + --with-search-path="/usr/lib/site_ruby/\$(ruby_ver)/$_arch-linux" \ + --enable-pthread \ + --disable-rpath \ + --enable-shared \ + --with-mantype=man \ + --program-suffix=$_suffix \ + --with-soname=$pkgname \ + || return 1 + make || return 1 + make test +} + +package() { + cd "$builddir" + + make DESTDIR="$pkgdir" install || return 1 + if [ -d "$pkgdir"/usr/local ]; then + local f=$(cd "$pkgdir" ; find usr/local -type f) + if [ -n "$f" ]; then + error "Found files in /usr/local:" + echo "$f" + return 1 + fi + fi + install -Dm644 COPYING \ + "${pkgdir}/usr/share/licenses/$pkgname"/COPYING +} + +_mv() { + local i + for i in "$@"; do + mkdir -p "$subpkgdir"/${i%/*} + mv "$pkgdir"/${i} "$subpkgdir"/${i%/*}/ || return 1 + done +} + +_mvgem() { + cd "$pkgdir" + for i in ./$_rubydir/${1}.rb \ + ./$_rubydir/${1} \ + ./$_rubydir/${CHOST/-alpine-/-}/${1} \ + ./$_gemdir/gems/${1}-* \ + ./$_gemdir/specifications/default/${1}-* ; do + [ -e "$pkgdir"/$i ] || continue + _mv "$i" + done +} + +_rmgem() { + cd "$pkgdir" + for i in ./$_rubydir/${1}.rb \ + ./$_rubydir/${1} \ + ./$_rubydir/${CHOST/-alpine-/-}/${1} \ + ./$_gemdir/gems/${1}-* \ + ./$_gemdir/specifications/default/${1}-* ; do + [ -e "$pkgdir"/$i ] && rm -r "$pkgdir/$i" + done + return 0 +} + +rake() { + pkgdesc="Ruby based make-like utility" + depends="$pkgname" + arch="noarch" + _mvgem rake || return 1 + _mv usr/bin/rake$_suffix +} + +irb() { + pkgdesc="The Interactive Ruby" + replaces="$pkgname" + depends="$pkgname" + arch="noarch" + cd "$pkgdir" + _mv usr/bin/irb$_suffix \ + usr/lib/ruby/$_abi/irb* +} + +rdoc() { + pkgdesc="Ruby documentation tool" + depends="$pkgname $pkgname-json" + arch="noarch" + _mvgem rdoc || return 1 + _mv usr/bin/ri$_suffix \ + usr/bin/rdoc$_suffix +} + +bigdecimal() { + pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic" + depends="$pkgname" + arch="noarch" + _mvgem bigdecimal +} + +io_console() { + pkgdesc="Ruby simple console IO library" + depends="$pkgname" + _mvgem io-console + _mv $_rubydir/io \ + $_rubydir/${CHOST/-alpine-/-}/io/console.so +} + +minitest() { + pkgdesc="Ruby suite of testing facilities" + depends="$pkgname" + arch="noarch" + _mvgem minitest +} + +json() { + pkgdesc="JSON implementation as a Ruby extension in C" + depends="$pkgname" + _mvgem json +} + +libs() { + pkgdesc="Libraries necessary to run Ruby" + depends="" + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ +} + +md5sums="62bd1cbfcbc22e4d137462bce992f6d1 ruby-2.1.9.tar.bz2" +sha256sums="4f21376aa11e09b499c3254bbd839e68e053c0d18e28d61c428a32347269036e ruby-2.1.9.tar.bz2" +sha512sums="a86422132e4c64007a84a91696f4557bdcbc8716fbfe1962f1eef3754ee7f994f4de0b5b7e7231c25057515767040d5c4af33339750b6db15744662e9bd24f38 ruby-2.1.9.tar.bz2" |