# Contributor: Carlo Landmeter # Maintainer: Natanael Copa pkgname=ruby pkgver=1.9.3_p385 _pkgver=${pkgver/_/-} pkgrel=0 _abi=1.9.1 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 libiconv-dev gdbm-dev db-dev readline-dev libffi-dev coreutils yaml-dev autoconf" subpackages="$pkgname-doc $pkgname-dev $pkgname-irb $pkgname-gems \ $pkgname-rdoc $pkgname-rake $pkgname-bigdecimal $pkgname-io-console:io_console $pkgname-minitest $pkgname-libs " patches=" ruby-1.9.3-always-use-i386.patch " source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/${pkgname}-${_pkgver}.tar.bz2 $patches" options="!fhs" # # maybe its a good idea to split dep libs to seperate pkg's. # _builddir="$srcdir/$pkgname-${_pkgver}" _gemdir="/usr/lib/ruby/gems/$_abi" _rubydir="/usr/lib/ruby/$_abi" [ "$ALPINE_LIBC" != "eglibc" ] && _libc="-uclibc" _arch=$CARCH case $CARCH in x86) _arch=i386;; esac prepare() { cd "$_builddir" for i in $patches; do msg $i patch -p1 -i "$srcdir"/$i || return 1 done 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" # turn off distcc/ccache # http://bugs.alpinelinux.org/issues/show/1 # export CC=gcc # ruby saves path to install. we want use $PATH export INSTALL=install ./configure \ --build=${CHOST:-i486-alpine-linux-uclibc} \ --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 \ || return 1 make || return 1 make test || return 1 } 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 || return 1 # unbundle _rmgem json } _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/$_arch-linux${_libc}/${1} \ ./$_gemdir/gems/${1}-* \ ./$_gemdir/specifications/${1}-* ; do [ -e "$pkgdir"/$i ] || continue _mv "$i" done } _rmgem() { cd "$pkgdir" for i in ./$_rubydir/${1}.rb \ ./$_rubydir/${1} \ ./$_rubydir/$_arch-linux${_libc}/${1} \ ./$_gemdir/gems/${1}-* \ ./$_gemdir/specifications/${1}-* ; do [ -e "$pkgdir"/$i ] && rm -r "$pkgdir/$i" done return 0 } gems() { pkgdesc="The Ruby standard for packaging ruby libraries" replaces="rubygems" depends="ruby" _mv usr/bin/gem \ $_rubydir/rubygems \ || return 1 } rake() { pkgdesc="Ruby based make-like utility" depends="ruby" _mvgem rake || return 1 _mv usr/bin/rake } irb() { pkgdesc="The Interactive Ruby" replaces="ruby" depends="ruby" cd "$pkgdir" _mv usr/bin/irb \ usr/lib/ruby/$_abi/irb* } rdoc() { pkgdesc="Ruby documentation tool" depends="ruby" _mvgem rdoc || return 1 _mv usr/bin/ri \ usr/bin/rdoc } bigdecimal() { pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic" depends="ruby" _mvgem bigdecimal } io_console() { pkgdesc="Ruby simple console IO library" depends="ruby" _mvgem io-console _mv $_rubydir/io \ $_rubydir/$_arch-linux${_libc}/io/console.so } minitest() { pkgdesc="Ruby suite of testing facilities" depends="ruby" _mvgem minitest } libs() { pkgdesc="Libraries necessary to run Ruby" depends="ruby" mkdir -p "$subpkgdir"/usr mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ } md5sums="5ec9aff670f4912b0f6f0e11e855ef6c ruby-1.9.3-p385.tar.bz2 8395693c99415532780605af203a102b ruby-1.9.3-always-use-i386.patch" sha256sums="f991ee50414dc795696bad0fc5c7b0b94d93b9b38fed943326d20ce4e9dda42b ruby-1.9.3-p385.tar.bz2 bce3b741537f7b86e4578c5420a1a8bea87e7c8b94fc3c42cd34eecf8503eb92 ruby-1.9.3-always-use-i386.patch" sha512sums="c73f61ea789714b401c91bfab033eb4c929c39db44531318c5eddf4215ce3f374e90cc57078d45a6c86399c2dac277c9de21aa8c6b8357d447dfa9d9b4f5f724 ruby-1.9.3-p385.tar.bz2 1531a8d056cca385401bdf56523127d3ce405cc2703c24069a5fb3d803dee35122e9274022a2891a32fdb229280bf50918d91b67e9a5f2ad951fe11e49bd3c1c ruby-1.9.3-always-use-i386.patch"