summaryrefslogtreecommitdiff
path: root/system/ruby
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-24 03:07:52 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-24 03:07:52 -0500
commit965d80ca4ac1c981343de938f066f5c6627a716a (patch)
treeeb2f89411cd5a5042e930d86871fa7dda84c833f /system/ruby
parentb34e6fe698af4901a2a662cc0ce671afa755e121 (diff)
downloadpackages-965d80ca4ac1c981343de938f066f5c6627a716a.tar.gz
packages-965d80ca4ac1c981343de938f066f5c6627a716a.tar.bz2
packages-965d80ca4ac1c981343de938f066f5c6627a716a.tar.xz
packages-965d80ca4ac1c981343de938f066f5c6627a716a.zip
system/ruby: pull in for asciidoctor
Diffstat (limited to 'system/ruby')
-rw-r--r--system/ruby/APKBUILD315
-rw-r--r--system/ruby/ruby.post-upgrade17
-rw-r--r--system/ruby/rubygems-avoid-platform-specific-gems.patch31
-rw-r--r--system/ruby/test_insns-lower-recursion-depth.patch47
4 files changed, 410 insertions, 0 deletions
diff --git a/system/ruby/APKBUILD b/system/ruby/APKBUILD
new file mode 100644
index 000000000..b6547468f
--- /dev/null
+++ b/system/ruby/APKBUILD
@@ -0,0 +1,315 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+#
+# secfixes:
+# 2.4.2-r0:
+# - CVE-2017-0898
+# - CVE-2017-10784
+# - CVE-2017-14033
+# - CVE-2017-14064
+# - CVE-2017-0899
+# - CVE-2017-0900
+# - CVE-2017-0901
+# - CVE-2017-0902
+# 2.4.3-r0:
+# - CVE-2017-17405
+# 2.5.1-r0:
+# - CVE-2017-17742
+# - CVE-2018-6914
+# - CVE-2018-8777
+# - CVE-2018-8778
+# - CVE-2018-8779
+# - CVE-2018-8780
+#
+pkgname=ruby
+pkgver=2.5.1
+_abiver="${pkgver%.*}.0"
+pkgrel=0
+pkgdesc="An object-oriented language for quick and easy programming"
+url="http://www.ruby-lang.org/"
+arch="all"
+license="Ruby AND BSD-2-Clause"
+depends="ca-certificates"
+depends_dev="gmp-dev"
+makedepends="$depends_dev zlib-dev openssl-dev db-dev libedit-dev
+ libffi-dev coreutils yaml-dev linux-headers autoconf"
+install="$pkgname.post-upgrade"
+subpackages="$pkgname-doc $pkgname-dev
+ $pkgname-bigdecimal
+ $pkgname-did_you_mean::noarch
+ $pkgname-etc
+ $pkgname-fiddle
+ $pkgname-io-console:io_console
+ $pkgname-irb::noarch
+ $pkgname-json
+ $pkgname-minitest::noarch
+ $pkgname-net-telnet:net_telnet:noarch
+ $pkgname-power_assert::noarch
+ $pkgname-rake::noarch
+ $pkgname-rdoc::noarch
+ $pkgname-sdbm
+ $pkgname-test-unit:test_unit:noarch
+ $pkgname-webrick::noarch
+ $pkgname-xmlrpc::noarch
+ $pkgname-libs
+ $pkgname-full::noarch
+ "
+source="https://cache.ruby-lang.org/pub/ruby/${pkgver%.*}/$pkgname-$pkgver.tar.xz
+ rubygems-avoid-platform-specific-gems.patch
+ test_insns-lower-recursion-depth.patch"
+replaces="ruby-gems"
+
+_gemdir="/usr/lib/ruby/gems/$_abiver"
+_rubydir="/usr/lib/ruby/$_abiver"
+_chost="${CHOST/-foxkit-/-}"
+
+case "$CARCH" in
+ x86 | pmmx) _arch="i386";;
+ *) _arch="$CARCH";;
+esac
+
+_bundled_gems=""
+for _i in $subpackages; do
+ case "$_i" in
+ *-dev | *-doc | *-libs | *-full:*) continue;;
+ *) _bundled_gems="$_bundled_gems ${_i%%:*}";;
+ esac
+done
+
+prepare() {
+ default_prepare
+
+ 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"
+ export CPPFLAGS="$CPPFLAGS -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
+ make
+}
+
+check() {
+ cd "$builddir"
+ make test
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install
+
+ install -m 644 -D COPYING \
+ "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+
+ rm -R "$pkgdir"$_gemdir/cache/*
+
+ 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
+ rm -r "$pkgdir"/usr/local
+ fi
+}
+
+bigdecimal() {
+ pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic"
+ license="Ruby"
+ depends="$pkgname-libs"
+
+ _mvgem bigdecimal
+}
+
+did_you_mean() {
+ pkgdesc="Did you mean? experience in Ruby"
+ license="MIT"
+ depends="$pkgname-libs"
+
+ _mvgem did_you_mean
+}
+
+etc() {
+ pkgdesc="Provides access to information typically stored in UNIX /etc directory"
+ license="BSD-2-Clause"
+ depends=""
+
+ _mvgem etc
+}
+
+fiddle() {
+ pkgdesc="A libffi wrapper for Ruby"
+ license="BSD-2-Clause"
+ depends=""
+
+ _mvgem fiddle
+}
+
+io_console() {
+ pkgdesc="Ruby simple console IO library"
+ license="BSD-2-Clause"
+ depends=""
+
+ _mvgem io-console
+ _mv $_rubydir/io \
+ $_rubydir/$_chost/io/console.so
+}
+
+irb() {
+ pkgdesc="The Interactive Ruby"
+ replaces="$pkgname"
+ depends="$pkgname"
+
+ cd "$pkgdir"
+ _mv usr/bin/irb \
+ usr/lib/ruby/$_abiver/irb*
+}
+
+json() {
+ pkgdesc="JSON implementation as a Ruby extension in C"
+ license="Ruby"
+ depends=""
+
+ _mvgem json
+}
+
+minitest() {
+ pkgdesc="Ruby suite of testing facilities"
+ license="MIT"
+ depends="$pkgname"
+
+ _mvgem minitest
+}
+
+net_telnet() {
+ pkgdesc="Telnet client functionality for Ruby"
+ depends="$pkgname-libs"
+
+ _mvgem net-telnet
+}
+
+power_assert() {
+ pkgdesc="Power Assert for Ruby"
+ depends="$pkgname-libs"
+
+ _mvgem power_assert
+}
+
+rake() {
+ pkgdesc="Ruby based make-like utility"
+ license="MIT"
+ depends="$pkgname"
+
+ _mvgem rake
+ _mv usr/bin/rake
+}
+
+rdoc() {
+ pkgdesc="Ruby documentation tool"
+ license="Ruby"
+ depends="$pkgname $pkgname-json $pkgname-io-console"
+
+ _mvgem rdoc
+ _mv usr/bin/ri \
+ usr/bin/rdoc
+}
+
+sdbm() {
+ pkgdesc="A simple file-based key-value store with String keys and values for Ruby"
+ license="BSD-2-Clause"
+ depends=""
+
+ _mvgem sdbm
+}
+
+test_unit() {
+ pkgdesc="An xUnit family unit testing framework for Ruby"
+ license="Ruby PSFL"
+ depends="$pkgname $pkgname-power_assert"
+
+ _mvgem test-unit
+}
+
+webrick() {
+ pkgdesc="HTTP server toolkit for Ruby"
+ license="BSD-2-Clause"
+ depends="$pkgname"
+
+ _mvgem webrick
+}
+
+xmlrpc() {
+ pkgdesc="XMLRPC library for Ruby"
+ license="Ruby"
+ depends="$pkgname-libs"
+
+ _mvgem xmlrpc
+}
+
+libs() {
+ pkgdesc="Libraries necessary to run Ruby"
+ depends=""
+
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
+}
+
+full() {
+ pkgdesc="Ruby with all bundled gems"
+ depends="ruby $_bundled_gems"
+
+ mkdir -p "$subpkgdir"
+}
+
+_mv() {
+ local i; for i in "$@"; do
+ mkdir -p "$subpkgdir"/${i%/*}
+ mv "$pkgdir"/${i} "$subpkgdir"/${i%/*}/
+ done
+}
+
+_mvgem() {
+ cd "$pkgdir"
+ local path; for path in ./$_rubydir/${1}.rb \
+ ./$_rubydir/${1} \
+ ./$_rubydir/$_chost/${1} \
+ ./$_rubydir/$_chost/${1}.so \
+ ./$_gemdir/gems/${1}-* \
+ ./$_gemdir/specifications/${1}-* \
+ ./$_gemdir/specifications/default/${1}-* ; do
+ [ ! -e "$pkgdir/$path" ] || _mv "$path"
+ done
+}
+
+sha512sums="31bacf58469953282cd5d8b51862dcf4b84dedb927c1871bc3fca32fc157fe49187631575a70838705fe246f4555647577a7ecc26894445a7d64de5503dc11b4 ruby-2.5.1.tar.xz
+cfdc5ea3b2e2ea69c51f38e8e2180cb1dc27008ca55cc6301f142ebafdbab31c3379b3b6bba9ff543153876dd98ed2ad194df3255b7ea77a62e931c935f80538 rubygems-avoid-platform-specific-gems.patch
+814fe6359505b70d8ff680adf22f20a74b4dbd3fecc9a63a6c2456ee9824257815929917b6df5394ed069a6869511b8c6dce5b95b4acbbb7867c1f3a975a0150 test_insns-lower-recursion-depth.patch"
diff --git a/system/ruby/ruby.post-upgrade b/system/ruby/ruby.post-upgrade
new file mode 100644
index 000000000..6cba787e6
--- /dev/null
+++ b/system/ruby/ruby.post-upgrade
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+ver_new="$1"
+ver_old="$2"
+
+if [ "$(apk version -t "$ver_old" "2.5.0-r0")" = "<" ]; then
+ cat >&2 <<-EOF
+ *
+ * In Ruby 2.5 more parts of the stdlib has been splitted into standalone
+ * gems, yet still installed with Ruby by default. We have moved some of
+ * them into separate subpackages. If you don't know which subpackages you
+ * need, you may install meta-package "ruby-full".
+ *
+ EOF
+fi
+
+exit 0
diff --git a/system/ruby/rubygems-avoid-platform-specific-gems.patch b/system/ruby/rubygems-avoid-platform-specific-gems.patch
new file mode 100644
index 000000000..74a536558
--- /dev/null
+++ b/system/ruby/rubygems-avoid-platform-specific-gems.patch
@@ -0,0 +1,31 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Fri, 19 May 2017 19:56:00 +0200
+Subject: [PATCH] Rubygems: don't install platform-specific gems
+
+Gems with native extensions typically contain just source code that is
+built during installation on user's system. However, Rubygems allows to
+publish even platform-specific gems with prebuilt binaries for specific
+platform. The problem is that Rubygems uses only short platform
+identification like x86_64-linux; it does not identify used libc.
+And sadly platform-specific gems for linux are built against glibc, so
+they may not work on musl libc.
+
+This patch is a workaround for the aforesaid problem. It removes local
+platform from Rubygems' supported platforms to force it always pick
+a platform-agnostic (source) gem. Users can override it using
+`--platform` option.
+
+--- a/lib/rubygems.rb
++++ b/lib/rubygems.rb
+@@ -743,7 +743,10 @@
+ def self.platforms
+ @platforms ||= []
+ if @platforms.empty?
+- @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
++ # XXX: Patched to avoid installing platform-specific gems with binaries
++ # linked against glibc.
++ @platforms = [Gem::Platform::RUBY]
++ #@platforms = [Gem::Platform::RUBY, Gem::Platform.local]
+ end
+ @platforms
+ end
diff --git a/system/ruby/test_insns-lower-recursion-depth.patch b/system/ruby/test_insns-lower-recursion-depth.patch
new file mode 100644
index 000000000..48e88dfd6
--- /dev/null
+++ b/system/ruby/test_insns-lower-recursion-depth.patch
@@ -0,0 +1,47 @@
+The patched test is a recursion function. We have lower stack size,
+so we hit SystemStackError sooner than on other platforms.
+
+ #361 test_insns.rb:389:in `block in <top (required)>':
+ # recursive once
+ def once n
+ return %r/#{
+ if n == 0
+ true
+ else
+ once(n-1) # here
+ end
+ }/ox
+ end
+ x = once(128); x = once(7); x = once(16);
+ x =~ "true" && $~
+ #=> "" (expected "true") once
+ Stderr output is not empty
+ bootstraptest.tmp.rb:3:in `once': stack level too deep (SystemStackError)
+ from bootstraptest.tmp.rb:7:in `block in once'
+ from bootstraptest.tmp.rb:3:in `once'
+ from bootstraptest.tmp.rb:7:in `block in once'
+ from bootstraptest.tmp.rb:3:in `once'
+ from bootstraptest.tmp.rb:7:in `block in once'
+ from bootstraptest.tmp.rb:3:in `once'
+ from bootstraptest.tmp.rb:7:in `block in once'
+ from bootstraptest.tmp.rb:3:in `once'
+ ... 125 levels...
+ from bootstraptest.tmp.rb:3:in `once'
+ from bootstraptest.tmp.rb:7:in `block in once'
+ from bootstraptest.tmp.rb:3:in `once'
+ from bootstraptest.tmp.rb:11:in `<main>'
+ Test_insns.rb FAIL 1/187
+ FAIL 1/1197 tests failed
+ Make: *** [uncommon.mk:666: yes-btest-ruby] Error 1
+
+--- a/bootstraptest/test_insns.rb
++++ b/bootstraptest/test_insns.rb
+@@ -248,7 +248,7 @@
+ end
+ }/ox
+ end
+- x = once(128); x = once(7); x = once(16);
++ x = once(32); x = once(7); x = once(16);
+ x =~ "true" && $~
+ },
+ [ 'once', <<~'},', ], # {