diff options
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/ruby/ChangeLog | 9 | ||||
-rw-r--r-- | dev-lang/ruby/Manifest | 11 | ||||
-rw-r--r-- | dev-lang/ruby/files/ruby-1.9.3_p448-asm-ilp32+volatile.diff | 16 | ||||
-rw-r--r-- | dev-lang/ruby/files/ruby-2.0.0_p247-SVNr39186-asm-volatile.diff | 16 | ||||
-rw-r--r-- | dev-lang/ruby/files/ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff | 13 | ||||
-rw-r--r-- | dev-lang/ruby/metadata.xml | 30 | ||||
-rw-r--r-- | dev-lang/ruby/ruby-1.9.3_p448-r1.ebuild | 218 | ||||
-rw-r--r-- | dev-lang/ruby/ruby-2.0.0_p247-r1.ebuild | 228 |
8 files changed, 541 insertions, 0 deletions
diff --git a/dev-lang/ruby/ChangeLog b/dev-lang/ruby/ChangeLog new file mode 100644 index 00000000..5d563c8d --- /dev/null +++ b/dev-lang/ruby/ChangeLog @@ -0,0 +1,9 @@ +*ruby-1.9.3_p448-r1 (09 Aug 2013) +*ruby-2.0.0_p247-r1 (09 Aug 2013) + + 09 Aug 2013; Bertrand Jacquin <beber@meleeweb.net> + +files/ruby-1.9.3_p448-asm-ilp32+volatile.diff, + +files/ruby-2.0.0_p247-SVNr39186-asm-volatile.diff, + +files/ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff, +metadata.xml, + +ruby-1.9.3_p448-r1.ebuild, +ruby-2.0.0_p247-r1.ebuild: + dev-lang/ruby: Fix build for ABI=x32, see #480238 #419851 diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest new file mode 100644 index 00000000..04e212eb --- /dev/null +++ b/dev-lang/ruby/Manifest @@ -0,0 +1,11 @@ +AUX ruby-1.9.3_p448-asm-ilp32+volatile.diff 811 SHA256 59a0dcb93c9d9d937d2a64bf38ea3edb03070b4a2658023dee0c31eabf230dc9 WHIRLPOOL 68c29419065843908ca109cda3c4e36d2ea8ec823f4fff481113776ffc552a5a1e8393299709c672774b5f72aa158d49a9497ca41d40000da6eab7205d98f9cb +AUX ruby-2.0.0_p247-SVNr39186-asm-volatile.diff 793 SHA256 cf80e6ec351e063a8dd0e6a86f26314fa6a9535001ec272f052a7fccc07607cc WHIRLPOOL 8b0267b11ffa15eee050fd9282a1b7307e5bd00b8b9d82746cc919ee51df09f9390512125bdc623693e152a78d255ff4bc578f66c371c0450966d492061c3e52 +AUX ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff 617 SHA256 e9cf9ac459601d09a4a6244082456f9c9c45d22bbabcd3afb06e9b378facefa2 WHIRLPOOL 45dac6c5791f6ebbe59b4af6e066f8f3711b3518d1e48be308c546efc83f9c50a058c78129f01a018ad30899ce72e6444e76169be30ce27b976ea9938ae6a058 +DIST ruby-1.9.3-p448.tar.bz2 10052488 SHA256 a7372230357bfff8e4525fb8019046da521561fe66b02c25d8efc10c9877bc91 WHIRLPOOL 8ee50c811aac11c9b1b7e64bcd8c90af94b9cc84082bb4303fd001943b1b0b2ff26ff431d52fb3e1b996bcb68ca670f426c771902c3541b4a62cd60ae272e387 +DIST ruby-2.0.0-p247.tar.bz2 10804581 SHA256 08e3d4b85b8a1118a8e81261f59dd8b4ddcfd70b6ae554e0ec5ceb99c3185e8a WHIRLPOOL 59eb0a5d71125b63226435d825f5793fd9ff7f065851b902ee45f974fdaf5f5498d12b07d8e20e668a1e4636dbc8f34d025f8713bd98e3c565327484e484a863 +DIST ruby-patches-1.9.3_p448-r1.tar.bz2 2154 SHA256 c1c40f2b1f186a05774fd15c3566d722a5ab1af5b93a7c73f2d3c247d604fd73 WHIRLPOOL 422b7bfcbdb564fd89ae9536c15d78442ad5597c7728f84f2523a751a862807a92a77779cfdd42fcdd20569726f401e391e33c1666b0455432ddff228ea674fc +DIST ruby-patches-2.0.0_p247-r1.tar.bz2 1929 SHA256 4feee409319dbcac7525fb9c1c76c36888a62ee0623c117ae532bf765845f0f9 WHIRLPOOL 869055dd0e14af0dc285a11d95a891ab4686e1d16960d46728ddf680eee58d42570f64d058b88d30805b732b082c354a36dac5a816a7ce5f3034d1b22237aa5a +EBUILD ruby-1.9.3_p448-r1.ebuild 6151 SHA256 a2254d1f2e874ba9b20d9a11ecef9f8256d0f361c35680d1dc664b1ed563e8fe WHIRLPOOL e80f64cdf7b54bf1c1e8e6c8550126a0ab38fda7131a35acf9de00f39672a2bd188e404b370b3eae0bf4ab6d512b92535ebb734c4e13c677a57ce34d9ad4f9d5 +EBUILD ruby-2.0.0_p247-r1.ebuild 6648 SHA256 bffe08ba2cbf7e81cac00e2e5a185070eeb4ddd6a3944bb5b978d28d8e49da82 WHIRLPOOL 6caca656f75681d9c0531b173561f561cee43b14e6a3da62e667970caea99ded66369e620492e9063dcc45c539ff96fb85bef50071d069818f0163407cc55cc6 +MISC ChangeLog 410 SHA256 c597fbeef9301a31aeb3ba5ceda6e9be9642f80d41de50d246a9cfd43aa84679 WHIRLPOOL 3c8d1f0d19990847c419e2a642e1dfd0ce6fdd01bcedb383a73cb69f35f58595ea86ddc8755673678359731248c62eb8acb0f2fe43e73e65e758a38909f153bb +MISC metadata.xml 995 SHA256 b802a8c15353181ea4a0f93666e89dbf1cc3f01947311ef9a8cb1663281f257a WHIRLPOOL 2a28317957c87d390479e4a6ac8ab121200dbaa2bd7de98f58031c17e670c8f096a2c8d9909cc2ca0d02b437ca0b1c61a789a66b39b32ffd731454c2a6e4b65e diff --git a/dev-lang/ruby/files/ruby-1.9.3_p448-asm-ilp32+volatile.diff b/dev-lang/ruby/files/ruby-1.9.3_p448-asm-ilp32+volatile.diff new file mode 100644 index 00000000..05fc2001 --- /dev/null +++ b/dev-lang/ruby/files/ruby-1.9.3_p448-asm-ilp32+volatile.diff @@ -0,0 +1,16 @@ +--- gc.h.ori 2013-08-09 14:48:58.177005287 +0200 ++++ gc.h 2013-08-09 15:21:01.602376807 +0200 +@@ -2,10 +2,10 @@ + #ifndef RUBY_GC_H + #define RUBY_GC_H 1 + +-#if defined(__x86_64__) && defined(__GNUC__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p))) ++#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__) && !defined(__native_client__) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p))) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) + #else + NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p)); + #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p) diff --git a/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr39186-asm-volatile.diff b/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr39186-asm-volatile.diff new file mode 100644 index 00000000..870dc5bb --- /dev/null +++ b/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr39186-asm-volatile.diff @@ -0,0 +1,16 @@ +Index: gc.h +=================================================================== +--- gc.h (revision 39185) ++++ gc.h (revision 39186) +@@ -3,9 +3,9 @@ + #define RUBY_GC_H 1 + + #if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p))) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p))) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) + #else + NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p)); + #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p) diff --git a/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff b/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff new file mode 100644 index 00000000..81b7fe83 --- /dev/null +++ b/dev-lang/ruby/files/ruby-2.0.0_p247-SVNr40636-asm-ilp32.diff @@ -0,0 +1,13 @@ +Index: gc.h +=================================================================== +--- gc.h (revision 40635) ++++ gc.h (revision 40636) +@@ -2,7 +2,7 @@ + #ifndef RUBY_GC_H + #define RUBY_GC_H 1 + +-#if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__) ++#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__) && !defined(__native_client__) + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__) + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) diff --git a/dev-lang/ruby/metadata.xml b/dev-lang/ruby/metadata.xml new file mode 100644 index 00000000..e46ab14c --- /dev/null +++ b/dev-lang/ruby/metadata.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>ruby</herd> + <use> + <flag name='rubytests'> + Install ruby tests that can only be run after ruby is installed + </flag> + + <flag name='readline'> + Use the <pkg>sys-libs/readline</pkg> library to provide the + readline extension, used for instance by the irb tool. This flag + is meaningful only if the libedit USE flag is disabled. + + If neither libedit nor readline USE flags are enabled, the + readline extension will not be built (and irb will lose line + editing functionality). + </flag> + + <flag name='yaml'> + Use the <pkg>dev-libs/libyaml</pkg> library to build the psych + extension, available since Ruby 1.9.2_rc2, in alternative to the + bundled syck-based parser. + </flag> + + <flag name='rdoc'> + Install <pkg>dev-ruby/rdoc</pkg> after installing Ruby. + </flag> + </use> +</pkgmetadata> diff --git a/dev-lang/ruby/ruby-1.9.3_p448-r1.ebuild b/dev-lang/ruby/ruby-1.9.3_p448-r1.ebuild new file mode 100644 index 00000000..623f90c2 --- /dev/null +++ b/dev-lang/ruby/ruby-1.9.3_p448-r1.ebuild @@ -0,0 +1,218 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ruby/ruby-1.9.3_p448-r1.ebuild,v 1.1 2013/07/29 19:06:01 graaff Exp $ + +EAPI=4 + +#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}) +# 1.9.3 still uses 1.9.1 +RUBYVERSION=1.9.1 + +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/1.9/${MY_P}.tar.bz2 + http://dev.gentoo.org/~flameeyes/ruby-team/${PN}-patches-${PATCHSET}.tar.bz2" + +LICENSE="|| ( Ruby-BSD BSD-2 )" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" +IUSE="berkdb debug doc examples gdbm ipv6 +rdoc rubytests socks5 ssl tk xemacs ncurses +readline +yaml" #libedit + +# libedit support is removed everywhere because of this upstream bug: +# http://redmine.ruby-lang.org/issues/show/3698 + +RDEPEND=" + berkdb? ( sys-libs/db ) + gdbm? ( sys-libs/gdbm ) + ssl? ( dev-libs/openssl ) + socks5? ( >=net-proxy/dante-1.1.13 ) + tk? ( dev-lang/tk[threads] ) + ncurses? ( sys-libs/ncurses ) + readline? ( sys-libs/readline ) + yaml? ( dev-libs/libyaml ) + virtual/libffi + sys-libs/zlib + >=app-admin/eselect-ruby-20100402 + !<dev-ruby/rdoc-3.9.4 + !<dev-ruby/rubygems-1.8.10-r1" +# libedit? ( dev-libs/libedit ) +# !libedit? ( readline? ( sys-libs/readline ) ) + +DEPEND="${RDEPEND}" +PDEPEND=" + >=dev-ruby/rubygems-1.8.10-r1[ruby_targets_ruby19] + rdoc? ( >=dev-ruby/rdoc-3.9.4[ruby_targets_ruby19] ) + xemacs? ( app-xemacs/ruby-modes )" + +src_prepare() { + EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \ + epatch "${WORKDIR}/patches" + + epatch "${FILESDIR}/${P}-asm-ilp32+volatile.diff" + + einfo "Unbundling gems..." + cd "$S" + rm -r \ + {bin,lib}/rake lib/rake.rb man/rake.1 \ + ext/json \ + 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= + + # -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" + +# if use libedit; then +# einfo "Using libedit to provide readline extension" +# myconf="${myconf} --enable-libedit --with-readline" +# elif use readline; then +# einfo "Using readline to provide readline extension" +# myconf="${myconf} --with-readline" +# else +# myconf="${myconf} --without-readline" +# fi + myconf="${myconf} $(use_with readline)" + + INSTALL="${EPREFIX}/usr/bin/install -c" econf \ + --program-suffix=${MY_SUFFIX} \ + --with-soname=ruby${MY_SUFFIX} \ + --enable-shared \ + --enable-pthread \ + $(use_enable socks5 socks) \ + $(use_enable doc install-doc) \ + --enable-ipv6 \ + $(use_enable debug) \ + $(use_with berkdb dbm) \ + $(use_with gdbm) \ + $(use_with ssl openssl) \ + $(use_with tk) \ + $(use_with ncurses curses) \ + $(use_with yaml psych) \ + ${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() { + # 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* ToDo || 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(18|19|...)" + elog +} + +pkg_postrm() { + eselect ruby cleanup +} diff --git a/dev-lang/ruby/ruby-2.0.0_p247-r1.ebuild b/dev-lang/ruby/ruby-2.0.0_p247-r1.ebuild new file mode 100644 index 00000000..f9b12b82 --- /dev/null +++ b/dev-lang/ruby/ruby-2.0.0_p247-r1.ebuild @@ -0,0 +1,228 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ruby/ruby-2.0.0_p247-r1.ebuild,v 1.1 2013/07/29 19:06:01 graaff Exp $ + +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.bz2 + http://dev.gentoo.org/~flameeyes/ruby-team/${PN}-patches-${PATCHSET}.tar.bz2" + +LICENSE="|| ( Ruby-BSD BSD-2 )" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" +IUSE="berkdb debug doc examples gdbm ipv6 +rdoc rubytests socks5 ssl tk xemacs ncurses +readline +yaml" + +RDEPEND=" + berkdb? ( sys-libs/db ) + gdbm? ( sys-libs/gdbm ) + ssl? ( dev-libs/openssl ) + socks5? ( >=net-proxy/dante-1.1.13 ) + tk? ( dev-lang/tk[threads] ) + ncurses? ( sys-libs/ncurses ) + readline? ( sys-libs/readline ) + yaml? ( dev-libs/libyaml ) + virtual/libffi + sys-libs/zlib + >=app-admin/eselect-ruby-20100402 + !<dev-ruby/rdoc-3.9.4 + !<dev-ruby/rubygems-1.8.10-r1" + +DEPEND="${RDEPEND}" +PDEPEND=" + >=dev-ruby/rubygems-2.0.2[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() { + EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \ + epatch "${WORKDIR}/patches" + + epatch "${FILESDIR}/${P}-SVNr39186-asm-volatile.diff" + epatch "${FILESDIR}/${P}-SVNr40636-asm-ilp32.diff" + + # 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= + + # -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" + +# if use libedit; then +# einfo "Using libedit to provide readline extension" +# myconf="${myconf} --enable-libedit --with-readline" +# elif use readline; then +# einfo "Using readline to provide readline extension" +# myconf="${myconf} --with-readline" +# else +# myconf="${myconf} --without-readline" +# fi + myconf="${myconf} $(use_with readline)" + + INSTALL="${EPREFIX}/usr/bin/install -c" econf \ + --program-suffix=${MY_SUFFIX} \ + --with-soname=ruby${MY_SUFFIX} \ + --enable-shared \ + --enable-pthread \ + --disable-rpath \ + $(use_enable socks5 socks) \ + $(use_enable doc install-doc) \ + --enable-ipv6 \ + $(use_enable debug) \ + $(use_with berkdb dbm) \ + $(use_with gdbm) \ + $(use_with ssl openssl) \ + $(use_with tk) \ + $(use_with ncurses curses) \ + $(use_with yaml psych) \ + ${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 + + dosym "libruby${MY_SUFFIX}$(get_libname ${PV%_*})" \ + "/usr/$(get_libdir)/libruby$(get_libname ${PV%.*})" + dosym "libruby${MY_SUFFIX}$(get_libname ${PV%_*})" \ + "/usr/$(get_libdir)/libruby$(get_libname ${PV%_*})" + + 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(18|19|...)" + elog +} + +pkg_postrm() { + eselect ruby cleanup +} |