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