diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-11-20 23:22:47 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2016-11-20 23:24:47 +0100 |
commit | b1681a85922d7807a35d563ac75e3f4994507003 (patch) | |
tree | 596ca3a04b82aebee89663730b93b2b9e233f888 /main/ruby | |
parent | 78b50441dfc59a736f0e1a6c554e5063ca131728 (diff) | |
download | aports-b1681a85922d7807a35d563ac75e3f4994507003.tar.bz2 aports-b1681a85922d7807a35d563ac75e3f4994507003.tar.xz |
main/ruby: improve abuild
Diffstat (limited to 'main/ruby')
-rw-r--r-- | main/ruby/APKBUILD | 137 |
1 files changed, 58 insertions, 79 deletions
diff --git a/main/ruby/APKBUILD b/main/ruby/APKBUILD index ed73586be3..1cdcf3316c 100644 --- a/main/ruby/APKBUILD +++ b/main/ruby/APKBUILD @@ -2,11 +2,8 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=ruby pkgver=2.3.2 -_pkgver=${pkgver/_/-} +_abiver=2.3.0 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" @@ -15,41 +12,35 @@ depends="" depends_dev="gmp-dev" makedepends="$depends_dev zlib-dev libressl-dev gdbm-dev db-dev readline-dev libffi-dev coreutils yaml-dev linux-headers autoconf" +# Maybe its a good idea to split dep libs to seperate pkgs. subpackages="$pkgname-doc $pkgname-dev $pkgname-irb::noarch $pkgname-rdoc::noarch $pkgname-rake::noarch $pkgname-bigdecimal::noarch $pkgname-io-console:io_console $pkgname-minitest::noarch $pkgname-json $pkgname-libs " -patches=" - " -source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/${pkgname}-${_pkgver}.tar.bz2 - $patches" +source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/$pkgname-$pkgver.tar.bz2" options="!fhs" replaces="ruby-gems" +builddir="$srcdir/$pkgname-$pkgver" -# -# maybe its a good idea to split dep libs to seperate pkg's. -# +_gemdir="/usr/lib/ruby/gems/$_abiver" +_rubydir="/usr/lib/ruby/$_abiver" +_chost="${CHOST/-alpine-/-}" -_builddir="$srcdir/$pkgname-${_pkgver}" -_gemdir="/usr/lib/ruby/gems/$_abi" -_rubydir="/usr/lib/ruby/$_abi" -_arch=$CARCH -case $CARCH in -x86) _arch=i386;; +case "$CARCH" in + x86) _arch="i386";; + *) _arch="$CARCH";; esac prepare() { - cd "$_builddir" - for i in $patches; do - msg $i - patch -p1 -i "$srcdir"/$i || return 1 - done + default_prepare || return 1 + + cd "$builddir" autoconf } build() { - cd "$_builddir" + cd "$builddir" # -fomit-frame-pointer makes ruby segfault, see gentoo bug #150413 # In many places aliasing rules are broken; play it safe @@ -57,20 +48,12 @@ build() { export CFLAGS="$CFLAGS -fno-omit-frame-pointer -fno-strict-aliasing" export CPPFLAGS="$CPPFLAGS -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 + # 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 \ @@ -91,8 +74,10 @@ build() { } package() { - cd "$_builddir" + 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 @@ -101,61 +86,31 @@ package() { 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 + install -m 644 -D COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING } rake() { pkgdesc="Ruby based make-like utility" - depends="ruby" + depends="$pkgname" + _mvgem rake || return 1 _mv usr/bin/rake } irb() { pkgdesc="The Interactive Ruby" - replaces="ruby" - depends="ruby" + replaces="$pkgname" + depends="$pkgname" + cd "$pkgdir" _mv usr/bin/irb \ - usr/lib/ruby/$_abi/irb* + usr/lib/ruby/$_abiver/irb* } rdoc() { pkgdesc="Ruby documentation tool" - depends="ruby ruby-json" + depends="$pkgname $pkgname-json" + _mvgem rdoc || return 1 _mv usr/bin/ri \ usr/bin/rdoc @@ -163,37 +118,61 @@ rdoc() { bigdecimal() { pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic" - depends="ruby" + depends="$pkgname" + _mvgem bigdecimal } io_console() { pkgdesc="Ruby simple console IO library" - depends="ruby" + depends="$pkgname" + _mvgem io-console _mv $_rubydir/io \ - $_rubydir/${CHOST/-alpine-/-}/io/console.so + $_rubydir/$_chost/io/console.so } minitest() { pkgdesc="Ruby suite of testing facilities" - depends="ruby" + depends="$pkgname" + _mvgem minitest } json() { pkgdesc="JSON implementation as a Ruby extension in C" - depends=ruby + depends="$pkgname" + _mvgem json } libs() { pkgdesc="Libraries necessary to run Ruby" depends="" + mkdir -p "$subpkgdir"/usr mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ } +_mv() { + local i; for i in "$@"; do + mkdir -p "$subpkgdir"/${i%/*} + mv "$pkgdir"/${i} "$subpkgdir"/${i%/*}/ || return 1 + done +} + +_mvgem() { + cd "$pkgdir" + local path; for path in ./$_rubydir/${1}.rb \ + ./$_rubydir/${1} \ + ./$_rubydir/$_chost/${1} \ + ./$_gemdir/gems/${1}-* \ + ./$_gemdir/specifications/${1}-* \ + ./$_gemdir/specifications/default/${1}-* ; do + [ ! -e "$pkgdir/$path" ] || _mv "$path" + done +} + md5sums="9d00f3772f1c8fa5eecdfea089e3032f ruby-2.3.2.tar.bz2" sha256sums="e6ce83d46819c4120c9295ff6b36b90393dd5f6bef3bb117a06d7399c11fc7c0 ruby-2.3.2.tar.bz2" sha512sums="78699bae5b0a2382a58f9d51f7d891341f00ad3a90d9ca06b68b1b245cf5acebc3a82133e39bf6a412ac999a5c0f778a0dab177c2569ffbee085ffff6f6ec38e ruby-2.3.2.tar.bz2" |