| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/ruby/ruby-1.8.7_p370.ebuild,v 1.6 2012/10/20 14:07:45 jer Exp $ |
| 4 |
|
| 5 |
EAPI=2 |
| 6 |
|
| 7 |
inherit autotools eutils flag-o-matic multilib versionator |
| 8 |
|
| 9 |
MY_P="${PN}-$(replace_version_separator 3 '-')" |
| 10 |
S=${WORKDIR}/${MY_P} |
| 11 |
|
| 12 |
SLOT=$(get_version_component_range 1-2) |
| 13 |
MY_SUFFIX=$(delete_version_separator 1 ${SLOT}) |
| 14 |
# 1.8 and 1.9 series disagree on this |
| 15 |
RUBYVERSION=$(get_version_component_range 1-2) |
| 16 |
|
| 17 |
if [[ -n ${PATCHSET} ]]; then |
| 18 |
if [[ ${PVR} == ${PV} ]]; then |
| 19 |
PATCHSET="${PV}-r0.${PATCHSET}" |
| 20 |
else |
| 21 |
PATCHSET="${PVR}.${PATCHSET}" |
| 22 |
fi |
| 23 |
else |
| 24 |
PATCHSET="${PVR}" |
| 25 |
fi |
| 26 |
|
| 27 |
DESCRIPTION="An object-oriented scripting language" |
| 28 |
HOMEPAGE="http://www.ruby-lang.org/" |
| 29 |
SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.bz2 |
| 30 |
http://dev.gentoo.org/~flameeyes/ruby-team/${PN}-patches-${PATCHSET}.tar.bz2" |
| 31 |
|
| 32 |
LICENSE="|| ( Ruby GPL-2 )" |
| 33 |
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
| 34 |
IUSE="+berkdb debug doc examples +gdbm ipv6 rubytests socks5 ssl threads tk xemacs ncurses +readline libedit" |
| 35 |
|
| 36 |
RDEPEND=" |
| 37 |
berkdb? ( sys-libs/db ) |
| 38 |
gdbm? ( sys-libs/gdbm ) |
| 39 |
ssl? ( >=dev-libs/openssl-0.9.8m ) |
| 40 |
socks5? ( >=net-proxy/dante-1.1.13 ) |
| 41 |
tk? ( dev-lang/tk[threads=] ) |
| 42 |
ncurses? ( sys-libs/ncurses ) |
| 43 |
libedit? ( dev-libs/libedit ) |
| 44 |
!libedit? ( readline? ( sys-libs/readline ) ) |
| 45 |
sys-libs/zlib |
| 46 |
>=app-admin/eselect-ruby-20100603 |
| 47 |
!<dev-ruby/rdoc-2" |
| 48 |
DEPEND="${RDEPEND}" |
| 49 |
PDEPEND="xemacs? ( app-xemacs/ruby-modes )" |
| 50 |
|
| 51 |
src_prepare() { |
| 52 |
EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \ |
| 53 |
epatch "${WORKDIR}/patches" |
| 54 |
|
| 55 |
# Fix a hardcoded lib path in configure script |
| 56 |
sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \ |
| 57 |
configure.in || die "sed failed" |
| 58 |
|
| 59 |
eautoreconf |
| 60 |
} |
| 61 |
|
| 62 |
src_configure() { |
| 63 |
local myconf= |
| 64 |
|
| 65 |
# -fomit-frame-pointer makes ruby segfault, see bug #150413. |
| 66 |
filter-flags -fomit-frame-pointer |
| 67 |
# In many places aliasing rules are broken; play it safe |
| 68 |
# as it's risky with newer compilers to leave it as it is. |
| 69 |
append-flags -fno-strict-aliasing |
| 70 |
|
| 71 |
# Socks support via dante |
| 72 |
if use socks5 ; then |
| 73 |
# Socks support can't be disabled as long as SOCKS_SERVER is |
| 74 |
# set and socks library is present, so need to unset |
| 75 |
# SOCKS_SERVER in that case. |
| 76 |
unset SOCKS_SERVER |
| 77 |
fi |
| 78 |
|
| 79 |
# Increase GC_MALLOC_LIMIT if set (default is 8000000) |
| 80 |
if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then |
| 81 |
append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}" |
| 82 |
fi |
| 83 |
|
| 84 |
# ipv6 hack, bug 168939. Needs --enable-ipv6. |
| 85 |
use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET" |
| 86 |
|
| 87 |
if use libedit; then |
| 88 |
einfo "Using libedit to provide readline extension" |
| 89 |
myconf="${myconf} --enable-libedit --with-readline" |
| 90 |
elif use readline; then |
| 91 |
einfo "Using readline to provide readline extension" |
| 92 |
myconf="${myconf} --with-readline" |
| 93 |
else |
| 94 |
myconf="${myconf} --without-readline" |
| 95 |
fi |
| 96 |
|
| 97 |
econf \ |
| 98 |
--program-suffix="${MY_SUFFIX}" \ |
| 99 |
--enable-shared \ |
| 100 |
$(use_enable socks5 socks) \ |
| 101 |
$(use_enable doc install-doc) \ |
| 102 |
$(use_enable threads pthread) \ |
| 103 |
--enable-ipv6 \ |
| 104 |
$(use_enable debug) \ |
| 105 |
$(use_with berkdb dbm) \ |
| 106 |
$(use_with gdbm) \ |
| 107 |
$(use_with ssl openssl) \ |
| 108 |
$(use_with tk) \ |
| 109 |
$(use_with ncurses curses) \ |
| 110 |
${myconf} \ |
| 111 |
--with-sitedir=/usr/$(get_libdir)/ruby/site_ruby \ |
| 112 |
--enable-option-checking=no \ |
| 113 |
|| die "econf failed" |
| 114 |
} |
| 115 |
|
| 116 |
src_compile() { |
| 117 |
emake EXTLDFLAGS="${LDFLAGS}" || die "emake failed" |
| 118 |
} |
| 119 |
|
| 120 |
src_test() { |
| 121 |
emake -j1 test || die "make test failed" |
| 122 |
|
| 123 |
elog "Ruby's make test has been run. Ruby also ships with a make check" |
| 124 |
elog "that cannot be run until after ruby has been installed." |
| 125 |
elog |
| 126 |
if use rubytests; then |
| 127 |
elog "You have enabled rubytests, so they will be installed to" |
| 128 |
elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other" |
| 129 |
elog "than root, and you must place them into a writeable directory." |
| 130 |
elog "Then call: " |
| 131 |
elog |
| 132 |
elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb" |
| 133 |
else |
| 134 |
elog "Enable the rubytests USE flag to install the make check tests" |
| 135 |
fi |
| 136 |
} |
| 137 |
|
| 138 |
src_install() { |
| 139 |
# Ruby is involved in the install process, we don't want interference here. |
| 140 |
unset RUBYOPT |
| 141 |
|
| 142 |
local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby) |
| 143 |
|
| 144 |
LD_LIBRARY_PATH="${D}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}" |
| 145 |
RUBYLIB="${S}:${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}" |
| 146 |
for d in $(find "${S}/ext" -type d) ; do |
| 147 |
RUBYLIB="${RUBYLIB}:$d" |
| 148 |
done |
| 149 |
export LD_LIBRARY_PATH RUBYLIB |
| 150 |
|
| 151 |
emake DESTDIR="${D}" install || die "make install failed" |
| 152 |
|
| 153 |
keepdir $(${MINIRUBY} -rrbconfig -e "print Config::CONFIG['sitelibdir']") |
| 154 |
keepdir $(${MINIRUBY} -rrbconfig -e "print Config::CONFIG['sitearchdir']") |
| 155 |
|
| 156 |
if use doc; then |
| 157 |
make DESTDIR="${D}" install-doc || die "make install-doc failed" |
| 158 |
fi |
| 159 |
|
| 160 |
if use examples; then |
| 161 |
insinto /usr/share/doc/${PF} |
| 162 |
doins -r sample |
| 163 |
fi |
| 164 |
|
| 165 |
dosym "libruby${MY_SUFFIX}$(get_libname ${PV%_*})" \ |
| 166 |
"/usr/$(get_libdir)/libruby$(get_libname ${PV%.*})" |
| 167 |
dosym "libruby${MY_SUFFIX}$(get_libname ${PV%_*})" \ |
| 168 |
"/usr/$(get_libdir)/libruby$(get_libname ${PV%_*})" |
| 169 |
|
| 170 |
dodoc ChangeLog NEWS README* ToDo || die |
| 171 |
|
| 172 |
if use rubytests; then |
| 173 |
pushd test |
| 174 |
insinto /usr/share/${PN}-${SLOT}/test |
| 175 |
doins -r . |
| 176 |
popd |
| 177 |
fi |
| 178 |
} |
| 179 |
|
| 180 |
pkg_postinst() { |
| 181 |
if [[ ! -n $(readlink "${ROOT}"usr/bin/ruby) ]] ; then |
| 182 |
eselect ruby set ruby${MY_SUFFIX} |
| 183 |
fi |
| 184 |
|
| 185 |
elog |
| 186 |
elog "To switch between available Ruby profiles, execute as root:" |
| 187 |
elog "\teselect ruby set ruby(18|19|...)" |
| 188 |
elog |
| 189 |
} |
| 190 |
|
| 191 |
pkg_postrm() { |
| 192 |
eselect ruby cleanup |
| 193 |
} |