Last active
March 17, 2016 19:03
-
-
Save skahack/d3b52193b0ced8aee3ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contributor: Carlo Landmeter <[email protected]> | |
# Maintainer: Natanael Copa <[email protected]> | |
pkgname=ruby | |
pkgver=2.3.0 | |
_pkgver=${pkgver/_/-} | |
pkgrel=0 | |
_abi=2.3.0 | |
pkgdesc="An object-oriented language for quick and easy programming" | |
url="http://www.ruby-lang.org/en/" | |
arch="all" | |
license="Ruby" | |
depends="" | |
depends_dev="gmp-dev" | |
makedepends="$depends_dev zlib-dev openssl-dev gdbm-dev db-dev libedit-dev | |
libffi-dev coreutils yaml-dev autoconf linux-headers" | |
subpackages="$pkgname-doc $pkgname-dev $pkgname-irb | |
$pkgname-rdoc $pkgname-rake $pkgname-bigdecimal | |
$pkgname-io-console:io_console $pkgname-minitest | |
$pkgname-json $pkgname-libs | |
" | |
patches=" | |
" | |
source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/${pkgname}-${_pkgver}.tar.bz2 | |
$patches" | |
options="!fhs" | |
replaces="ruby-gems" | |
# | |
# 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" | |
_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 | |
case "$CLIBC" in | |
uclibc | musl) | |
# the configure script does not detect isnan/isinf as macros | |
export ac_cv_func_isnan=yes | |
export ac_cv_func_isinf=yes | |
;; | |
esac | |
./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 \ | |
|| 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 | |
} | |
_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="ruby" | |
arch="noarch" | |
_mvgem rake || return 1 | |
_mv usr/bin/rake | |
} | |
irb() { | |
pkgdesc="The Interactive Ruby" | |
replaces="ruby" | |
depends="ruby" | |
arch="noarch" | |
cd "$pkgdir" | |
_mv usr/bin/irb \ | |
usr/lib/ruby/$_abi/irb* | |
} | |
rdoc() { | |
pkgdesc="Ruby documentation tool" | |
depends="ruby ruby-json" | |
arch="noarch" | |
_mvgem rdoc || return 1 | |
_mv usr/bin/ri \ | |
usr/bin/rdoc | |
} | |
bigdecimal() { | |
pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic" | |
depends="ruby" | |
arch="noarch" | |
_mvgem bigdecimal | |
} | |
io_console() { | |
pkgdesc="Ruby simple console IO library" | |
depends="ruby" | |
_mvgem io-console | |
_mv $_rubydir/io \ | |
$_rubydir/${CHOST/-alpine-/-}/io/console.so | |
} | |
minitest() { | |
pkgdesc="Ruby suite of testing facilities" | |
depends="ruby" | |
arch="noarch" | |
_mvgem minitest | |
} | |
json() { | |
pkgdesc="JSON implementation as a Ruby extension in C" | |
depends=ruby | |
_mvgem json | |
} | |
libs() { | |
pkgdesc="Libraries necessary to run Ruby" | |
depends="" | |
mkdir -p "$subpkgdir"/usr | |
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ | |
} | |
md5sums="c3d65f6d2ebe90dda81a37885ea244f5 ruby-2.2.4.tar.bz2" | |
sha256sums="31203696adbfdda6f2874a2de31f7c5a1f3bcb6628f4d1a241de21b158cd5c76 ruby-2.2.4.tar.bz2" | |
sha512sums="d27ca2f19c214ce87f906b57edd41f2f8af35b2871c191470facded9cfda15ba46e5c3bc7d5540225a38da6bd65050fcc8aaa4ffbadbb6bf7dc891c1821da0df ruby-2.2.4.tar.bz2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment