tdev-lang/ruby: Add 2.99.9_p648 with musl-libc and libressl support. - parlay - yet another gentoo overlay HTML git clone https://git.parazyd.org/parlay DIR Log DIR Files DIR Refs DIR README --- DIR commit 7eaaaa0c586aa19e78b0bcb08fe148a4ea16e64a DIR parent b30ee860e28db3f1c3a5791ff02b4d24f65026a5 HTML Author: parazyd <parazyd@dyne.org> Date: Wed, 5 Oct 2016 09:57:42 +0200 dev-lang/ruby: Add 2.99.9_p648 with musl-libc and libressl support. Diffstat: A dev-lang/ruby/Manifest | 2 ++ A dev-lang/ruby/files/ruby-add-asm_i… | 11 +++++++++++ A dev-lang/ruby/files/ruby-condition… | 41 +++++++++++++++++++++++++++++++ A dev-lang/ruby/files/ruby-no-ssl3.p… | 29 +++++++++++++++++++++++++++++ A dev-lang/ruby/ruby-2.0.0_p648.ebui… | 240 +++++++++++++++++++++++++++++++ 5 files changed, 323 insertions(+), 0 deletions(-) --- DIR diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest t@@ -0,0 +1,2 @@ +DIST ruby-2.0.0-p648.tar.xz 8303584 SHA256 22fe97739110ba9171b13fc4dcd1a92e767f16769de3593ee41ef1283d218402 SHA512 95df515d37f04193eaceaded4a4f568f83041683349cd44767803f77361a66533226d83eac6586ac894ae61d79bd36ce047f951aed43f9a8356dbb3244280774 WHIRLPOOL ef78b838d061b1707219453a70c8b4a503d46e9f95797007555943a837de21f22c0c93039c75172d7df4fe9b5eca38472ee7177f98785cb5993c7e80140a1d27 +DIST ruby-patches-2.0.0_p648.tar.bz2 3341 SHA256 7d82403fed6216baed59ac1fbba888e2b9a4a9cb742ffd01531753bae07ab6b8 SHA512 40d07275a391df3e0a7a0c2705913c8120a548e223032dc39993f8f873c8d0639646cf728dc95f1400352a13766623ac6d69a1b1ff03183df6fabf32946dd7a6 WHIRLPOOL ed7ea6b1c1fd3570ea85b885f7455d8273cff2a9db2540c9e89faca867bd5eed2b4de52c7d21a96bb33ae0beedce113c68bb6c8cee4688650ff5169bd9c265fd DIR diff --git a/dev-lang/ruby/files/ruby-add-asm_ioctl_h.patch b/dev-lang/ruby/files/ruby-add-asm_ioctl_h.patch t@@ -0,0 +1,11 @@ +diff -Nuar ruby-2.0.0-p353.orig/io.c ruby-2.0.0-p353/io.c +--- ruby-2.0.0-p353.orig/io.c 2013-10-04 17:30:50.000000000 +0000 ++++ ruby-2.0.0-p353/io.c 2014-02-23 13:22:06.038406133 +0000 +@@ -19,6 +19,7 @@ + #include "id.h" + #include <ctype.h> + #include <errno.h> ++#include <asm/ioctl.h> + #include "ruby_atomic.h" + + #define free(x) xfree(x) DIR diff --git a/dev-lang/ruby/files/ruby-conditional-randegd.patch b/dev-lang/ruby/files/ruby-conditional-randegd.patch t@@ -0,0 +1,41 @@ +diff -Naur ruby-2_0_0_648.orig/ext/openssl/extconf.rb ruby-2_0_0_648/ext/openssl/extconf.rb +--- ruby-2_0_0_648.orig/ext/openssl/extconf.rb 2015-12-16 04:31:18.000000000 -0800 ++++ ruby-2_0_0_648/ext/openssl/extconf.rb 2016-03-28 13:38:19.894451758 -0700 +@@ -87,6 +87,7 @@ + have_func("PEM_def_callback") + have_func("PKCS5_PBKDF2_HMAC") + have_func("PKCS5_PBKDF2_HMAC_SHA1") ++have_func("RAND_egd") + have_func("X509V3_set_nconf") + have_func("X509V3_EXT_nconf_nid") + have_func("X509_CRL_add0_revoked") +diff -Naur ruby-2_0_0_648.orig/ext/openssl/ossl_rand.c ruby-2_0_0_648/ext/openssl/ossl_rand.c +--- ruby-2_0_0_648.orig/ext/openssl/ossl_rand.c 2015-12-16 04:31:18.000000000 -0800 ++++ ruby-2_0_0_648/ext/openssl/ossl_rand.c 2016-03-28 13:37:51.301178552 -0700 +@@ -125,6 +125,7 @@ + return str; + } + ++#ifdef HAVE_RAND_EGD + /* + * call-seq: + * egd(filename) -> true +@@ -158,6 +159,7 @@ + } + return Qtrue; + } ++#endif /* HAVE_RAND_EGD */ + + /* + * call-seq: +@@ -195,8 +197,10 @@ + DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1); + DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1); + DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1); ++#ifdef HAVE_RAND_EGD + DEFMETH(mRandom, "egd", ossl_rand_egd, 1); + DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2); ++#endif /* HAVE_RAND_EGD */ + DEFMETH(mRandom, "status?", ossl_rand_status, 0) + } + DIR diff --git a/dev-lang/ruby/files/ruby-no-ssl3.patch b/dev-lang/ruby/files/ruby-no-ssl3.patch t@@ -0,0 +1,29 @@ +diff -Naur ruby-2_0_0_648.orig/ext/openssl/extconf.rb ruby-2_0_0_648/ext/openssl/extconf.rb +--- ruby-2_0_0_648.orig/ext/openssl/extconf.rb 2015-12-16 04:31:18.000000000 -0800 ++++ ruby-2_0_0_648/ext/openssl/extconf.rb 2016-03-28 13:32:05.837065312 -0700 +@@ -103,6 +103,9 @@ + have_func("SSLv2_method") + have_func("SSLv2_server_method") + have_func("SSLv2_client_method") ++have_func("SSLv3_method") ++have_func("SSLv3_server_method") ++have_func("SSLv3_client_method") + have_func("TLSv1_1_method") + have_func("TLSv1_1_server_method") + have_func("TLSv1_1_client_method") +diff -Naur ruby-2_0_0_648.orig/ext/openssl/ossl_ssl.c ruby-2_0_0_648/ext/openssl/ossl_ssl.c +--- ruby-2_0_0_648.orig/ext/openssl/ossl_ssl.c 2015-12-16 04:31:18.000000000 -0800 ++++ ruby-2_0_0_648/ext/openssl/ossl_ssl.c 2016-03-28 13:32:05.839065329 -0700 +@@ -129,9 +129,12 @@ + OSSL_SSL_METHOD_ENTRY(SSLv2_server), + OSSL_SSL_METHOD_ENTRY(SSLv2_client), + #endif ++#if defined(HAVE_SSLV3_METHOD) && defined(HAVE_SSLV3_SERVER_METHOD) && \ ++ defined(HAVE_SSLV3_CLIENT_METHOD) + OSSL_SSL_METHOD_ENTRY(SSLv3), + OSSL_SSL_METHOD_ENTRY(SSLv3_server), + OSSL_SSL_METHOD_ENTRY(SSLv3_client), ++#endif + OSSL_SSL_METHOD_ENTRY(SSLv23), + OSSL_SSL_METHOD_ENTRY(SSLv23_server), + OSSL_SSL_METHOD_ENTRY(SSLv23_client), DIR diff --git a/dev-lang/ruby/ruby-2.0.0_p648.ebuild b/dev-lang/ruby/ruby-2.0.0_p648.ebuild t@@ -0,0 +1,240 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +#PATCHSET=1 + +inherit autotools eutils flag-o-matic multilib versionator + +RUBYPL=$(get_version_component_range 4) + +MY_P="${PN}-$(get_version_component_range 1-3)-${RUBYPL:-0}" +S=${WORKDIR}/${MY_P} + +SLOT=$(get_version_component_range 1-2) +MY_SUFFIX=$(delete_version_separator 1 ${SLOT}) +RUBYVERSION=2.0.0 + +if [[ -n ${PATCHSET} ]]; then + if [[ ${PVR} == ${PV} ]]; then + PATCHSET="${PV}-r0.${PATCHSET}" + else + PATCHSET="${PVR}.${PATCHSET}" + fi +else + PATCHSET="${PVR}" +fi + +DESCRIPTION="An object-oriented scripting language" +HOMEPAGE="http://www.ruby-lang.org/" +SRC_URI="mirror://ruby/2.0/${MY_P}.tar.xz + https://dev.gentoo.org/~flameeyes/ruby-team/${PN}-patches-${PATCHSET}.tar.bz2" + +LICENSE="|| ( Ruby-BSD BSD-2 )" +KEYWORDS="amd64 arm ~mips ppc x86" +IUSE="berkdb debug doc examples gdbm ipv6 +rdoc rubytests socks5 ssl libressl xemacs ncurses +readline cpu_flags_x86_sse2" + +RDEPEND=" + berkdb? ( sys-libs/db:= ) + gdbm? ( sys-libs/gdbm ) + ssl? ( + !libressl? ( dev-libs/openssl:0 ) + libressl? ( dev-libs/libressl:= ) + ) + socks5? ( >=net-proxy/dante-1.1.13 ) + ncurses? ( sys-libs/ncurses:0= ) + readline? ( sys-libs/readline:0 ) + dev-libs/libyaml + virtual/libffi + sys-libs/zlib + >=app-eselect/eselect-ruby-20100402 + !<dev-ruby/rdoc-3.9.4 + !<dev-ruby/rubygems-1.8.10-r1" + +DEPEND="${RDEPEND}" +PDEPEND=" + virtual/rubygems[ruby_targets_ruby20] + >=dev-ruby/json-1.7.7[ruby_targets_ruby20] + >=dev-ruby/rake-0.9.6[ruby_targets_ruby20] + rdoc? ( >=dev-ruby/rdoc-4.0.0[ruby_targets_ruby20] ) + xemacs? ( app-xemacs/ruby-modes )" + +src_prepare() { + if use cpu_flags_x86_sse2 ; then + excluded_patches="012_no_forced_sse2.patch" + fi + + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \ + epatch "${WORKDIR}/patches" + + epatch "${FILESDIR}"/${PN}-add-asm_ioctl_h.patch + + # Add LibreSSL Support + epatch "${FILESDIR}/${PN}-no-ssl3.patch" + epatch "${FILESDIR}/${PN}-conditional-rangegd.patch" + + # We can no longer unbundle all of rake because rubygems now depends + # on this. We leave the actual rake code around to bootstrap + # rubygems, but remove the bits that would cause a file collision. + einfo "Unbundling gems..." + cd "$S" + rm -r \ + {bin,lib}/rake lib/rake.rb man/rake.1 \ + bin/gem || die "removal failed" + + # Fix a hardcoded lib path in configure script + sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \ + configure.in || die "sed failed" + + eautoreconf +} + +src_configure() { + local myconf= + + # The Tk module can no longer be built because the module code is no + # longer compatible with newer stable versions. + # https://bugs.gentoo.org/show_bug.cgi?id=500894 + local modules="tk" + + # -fomit-frame-pointer makes ruby segfault, see bug #150413. + filter-flags -fomit-frame-pointer + # In many places aliasing rules are broken; play it safe + # as it's risky with newer compilers to leave it as it is. + append-flags -fno-strict-aliasing + # SuperH needs this + use sh && append-flags -mieee + + # Socks support via dante + if use socks5 ; then + # Socks support can't be disabled as long as SOCKS_SERVER is + # set and socks library is present, so need to unset + # SOCKS_SERVER in that case. + unset SOCKS_SERVER + fi + + # Increase GC_MALLOC_LIMIT if set (default is 8000000) + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}" + fi + + # ipv6 hack, bug 168939. Needs --enable-ipv6. + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET" + + # Determine which modules *not* to build depending in the USE flags. + if ! use readline ; then + modules="${modules},readline" + fi + if ! use berkdb ; then + modules="${modules},dbm" + fi + if ! use gdbm ; then + modules="${modules},gdbm" + fi + if ! use ssl ; then + modules="${modules},openssl" + fi + if ! use ncurses ; then + modules="${modules},curses" + fi + + INSTALL="${EPREFIX}/usr/bin/install -c" econf \ + --program-suffix=${MY_SUFFIX} \ + --with-soname=ruby${MY_SUFFIX} \ + --docdir=${EPREFIX}/usr/share/doc/${P} \ + --enable-shared \ + --enable-pthread \ + --disable-rpath \ + --with-out-ext="${modules}" \ + $(use_enable socks5 socks) \ + $(use_enable doc install-doc) \ + --enable-ipv6 \ + $(use_enable debug) \ + ${myconf} \ + --enable-option-checking=no \ + || die "econf failed" +} + +src_compile() { + emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed" +} + +src_test() { + emake -j1 V=1 test || die "make test failed" + + elog "Ruby's make test has been run. Ruby also ships with a make check" + elog "that cannot be run until after ruby has been installed." + elog + if use rubytests; then + elog "You have enabled rubytests, so they will be installed to" + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other" + elog "than root, and you must place them into a writeable directory." + elog "Then call: " + elog + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb" + else + elog "Enable the rubytests USE flag to install the make check tests" + fi +} + +src_install() { + # Remove the remaining bundled gems. We do this late in the process + # since they are used during the build to e.g. create the + # documentation. + rm -rf ext/json || die + + # Ruby is involved in the install process, we don't want interference here. + unset RUBYOPT + + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby) + + LD_LIBRARY_PATH="${D}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}" + RUBYLIB="${S}:${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}" + for d in $(find "${S}/ext" -type d) ; do + RUBYLIB="${RUBYLIB}:$d" + done + export LD_LIBRARY_PATH RUBYLIB + + emake V=1 DESTDIR="${D}" install || die "make install failed" + + # Remove installed rubygems copy + rm -r "${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed" + rm -r "${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed" + rm -r "${D}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed" + + if use doc; then + make DESTDIR="${D}" install-doc || die "make install-doc failed" + fi + + if use examples; then + insinto /usr/share/doc/${PF} + doins -r sample + fi + + dodoc ChangeLog NEWS doc/NEWS* README* || die + + if use rubytests; then + pushd test + insinto /usr/share/${PN}-${SLOT}/test + doins -r . + popd + fi +} + +pkg_postinst() { + if [[ ! -n $(readlink "${ROOT}"usr/bin/ruby) ]] ; then + eselect ruby set ruby${MY_SUFFIX} + fi + + elog + elog "To switch between available Ruby profiles, execute as root:" + elog "\teselect ruby set ruby(19|20|...)" + elog +} + +pkg_postrm() { + eselect ruby cleanup +} +