Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2015 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Id$ |
4 |
|
5 |
EAPI=5 |
6 |
|
7 |
#PATCHSET=1 |
8 |
|
9 |
inherit autotools eutils flag-o-matic multilib versionator |
10 |
|
11 |
MY_P="${PN}-$(get_version_component_range 1-3)" |
12 |
S=${WORKDIR}/${MY_P} |
13 |
|
14 |
SLOT=$(get_version_component_range 1-2) |
15 |
MY_SUFFIX=$(delete_version_separator 1 ${SLOT}) |
16 |
RUBYVERSION=2.2.0 |
17 |
|
18 |
if [[ -n ${PATCHSET} ]]; then |
19 |
if [[ ${PVR} == ${PV} ]]; then |
20 |
PATCHSET="${PV}-r0.${PATCHSET}" |
21 |
else |
22 |
PATCHSET="${PVR}.${PATCHSET}" |
23 |
fi |
24 |
else |
25 |
PATCHSET="${PVR}" |
26 |
fi |
27 |
|
28 |
DESCRIPTION="An object-oriented scripting language" |
29 |
HOMEPAGE="http://www.ruby-lang.org/" |
30 |
SRC_URI="mirror://ruby/2.2/${MY_P}.tar.xz |
31 |
https://dev.gentoo.org/~flameeyes/ruby-team/${PN}-patches-${PATCHSET%-r*}.tar.bz2" |
32 |
|
33 |
LICENSE="|| ( Ruby-BSD BSD-2 )" |
34 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" |
35 |
IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 ssl xemacs ncurses +readline" |
36 |
|
37 |
RDEPEND=" |
38 |
berkdb? ( sys-libs/db:= ) |
39 |
gdbm? ( sys-libs/gdbm ) |
40 |
jemalloc? ( dev-libs/jemalloc ) |
41 |
ssl? ( |
42 |
!libressl? ( dev-libs/openssl:0 ) |
43 |
libressl? ( dev-libs/libressl ) |
44 |
) |
45 |
socks5? ( >=net-proxy/dante-1.1.13 ) |
46 |
ncurses? ( sys-libs/ncurses:0= ) |
47 |
readline? ( sys-libs/readline:0 ) |
48 |
dev-libs/libyaml |
49 |
virtual/libffi |
50 |
sys-libs/zlib |
51 |
>=app-eselect/eselect-ruby-20141227 |
52 |
!<dev-ruby/rdoc-3.9.4 |
53 |
!<dev-ruby/rubygems-1.8.10-r1" |
54 |
|
55 |
DEPEND="${RDEPEND}" |
56 |
|
57 |
BUNDLED_GEMS=" |
58 |
>=dev-ruby/minitest-5.4.3[ruby_targets_ruby22] |
59 |
>=dev-ruby/power_assert-0.2.2[ruby_targets_ruby22] |
60 |
>=dev-ruby/test-unit-3.0.8[ruby_targets_ruby22] |
61 |
" |
62 |
|
63 |
PDEPEND=" |
64 |
${BUNDLED_GEMS} |
65 |
virtual/rubygems[ruby_targets_ruby22] |
66 |
>=dev-ruby/json-1.8.1[ruby_targets_ruby22] |
67 |
>=dev-ruby/rake-0.9.6[ruby_targets_ruby22] |
68 |
rdoc? ( >=dev-ruby/rdoc-4.0.1[ruby_targets_ruby22] ) |
69 |
xemacs? ( app-xemacs/ruby-modes )" |
70 |
|
71 |
src_prepare() { |
72 |
EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \ |
73 |
epatch "${WORKDIR}/patches" |
74 |
|
75 |
epatch "${FILESDIR}"/${PN}-2.2.3-libressl.patch |
76 |
|
77 |
# We can no longer unbundle all of rake because rubygems now depends |
78 |
# on this. We leave the actual rake code around to bootstrap |
79 |
# rubygems, but remove the bits that would cause a file collision. |
80 |
einfo "Unbundling gems..." |
81 |
cd "$S" |
82 |
rm -r \ |
83 |
{bin,lib}/rake lib/rake.rb man/rake.1 \ |
84 |
bin/gem || die "removal failed" |
85 |
# Remove bundled gems that we will install via PDEPEND, bug |
86 |
# 539700. Use explicit version numbers to ensure rm fails when they |
87 |
# change so we can update dependencies accordingly. |
88 |
rm gems/{minitest-5.4.3,power_assert-0.2.2,test-unit-3.0.8}.gem || die |
89 |
|
90 |
# Fix a hardcoded lib path in configure script |
91 |
sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \ |
92 |
configure.in || die "sed failed" |
93 |
|
94 |
eautoreconf |
95 |
} |
96 |
|
97 |
src_configure() { |
98 |
local myconf= |
99 |
|
100 |
# The Tk module can no longer be built because the module code is no |
101 |
# longer compatible with newer stable versions. |
102 |
# https://bugs.gentoo.org/show_bug.cgi?id=500894 |
103 |
local modules="tk" |
104 |
|
105 |
# -fomit-frame-pointer makes ruby segfault, see bug #150413. |
106 |
filter-flags -fomit-frame-pointer |
107 |
# In many places aliasing rules are broken; play it safe |
108 |
# as it's risky with newer compilers to leave it as it is. |
109 |
append-flags -fno-strict-aliasing |
110 |
# SuperH needs this |
111 |
use sh && append-flags -mieee |
112 |
|
113 |
# Socks support via dante |
114 |
if use socks5 ; then |
115 |
# Socks support can't be disabled as long as SOCKS_SERVER is |
116 |
# set and socks library is present, so need to unset |
117 |
# SOCKS_SERVER in that case. |
118 |
unset SOCKS_SERVER |
119 |
fi |
120 |
|
121 |
# Increase GC_MALLOC_LIMIT if set (default is 8000000) |
122 |
if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then |
123 |
append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}" |
124 |
fi |
125 |
|
126 |
# ipv6 hack, bug 168939. Needs --enable-ipv6. |
127 |
use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET" |
128 |
|
129 |
# Determine which modules *not* to build depending in the USE flags. |
130 |
if ! use readline ; then |
131 |
modules="${modules},readline" |
132 |
fi |
133 |
if ! use berkdb ; then |
134 |
modules="${modules},dbm" |
135 |
fi |
136 |
if ! use gdbm ; then |
137 |
modules="${modules},gdbm" |
138 |
fi |
139 |
if ! use ssl ; then |
140 |
modules="${modules},openssl" |
141 |
fi |
142 |
if ! use ncurses ; then |
143 |
modules="${modules},curses" |
144 |
fi |
145 |
|
146 |
INSTALL="${EPREFIX}/usr/bin/install -c" econf \ |
147 |
--program-suffix=${MY_SUFFIX} \ |
148 |
--with-soname=ruby${MY_SUFFIX} \ |
149 |
--docdir=${EPREFIX}/usr/share/doc/${P} \ |
150 |
--enable-shared \ |
151 |
--enable-pthread \ |
152 |
--disable-rpath \ |
153 |
--with-out-ext="${modules}" \ |
154 |
$(use_enable jemalloc jemalloc) \ |
155 |
$(use_enable socks5 socks) \ |
156 |
$(use_enable doc install-doc) \ |
157 |
--enable-ipv6 \ |
158 |
$(use_enable debug) \ |
159 |
${myconf} \ |
160 |
--enable-option-checking=no \ |
161 |
|| die "econf failed" |
162 |
} |
163 |
|
164 |
src_compile() { |
165 |
emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed" |
166 |
} |
167 |
|
168 |
src_test() { |
169 |
emake -j1 V=1 test || die "make test failed" |
170 |
|
171 |
elog "Ruby's make test has been run. Ruby also ships with a make check" |
172 |
elog "that cannot be run until after ruby has been installed." |
173 |
elog |
174 |
if use rubytests; then |
175 |
elog "You have enabled rubytests, so they will be installed to" |
176 |
elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other" |
177 |
elog "than root, and you must place them into a writeable directory." |
178 |
elog "Then call: " |
179 |
elog |
180 |
elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb" |
181 |
else |
182 |
elog "Enable the rubytests USE flag to install the make check tests" |
183 |
fi |
184 |
} |
185 |
|
186 |
src_install() { |
187 |
# Remove the remaining bundled gems. We do this late in the process |
188 |
# since they are used during the build to e.g. create the |
189 |
# documentation. |
190 |
rm -rf ext/json || die |
191 |
|
192 |
# Ruby is involved in the install process, we don't want interference here. |
193 |
unset RUBYOPT |
194 |
|
195 |
local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby) |
196 |
|
197 |
LD_LIBRARY_PATH="${D}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}" |
198 |
RUBYLIB="${S}:${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}" |
199 |
for d in $(find "${S}/ext" -type d) ; do |
200 |
RUBYLIB="${RUBYLIB}:$d" |
201 |
done |
202 |
export LD_LIBRARY_PATH RUBYLIB |
203 |
|
204 |
emake V=1 DESTDIR="${D}" install || die "make install failed" |
205 |
|
206 |
# Remove installed rubygems copy |
207 |
rm -r "${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed" |
208 |
rm -r "${D}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed" |
209 |
rm -r "${D}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed" |
210 |
|
211 |
if use doc; then |
212 |
make DESTDIR="${D}" install-doc || die "make install-doc failed" |
213 |
fi |
214 |
|
215 |
if use examples; then |
216 |
insinto /usr/share/doc/${PF} |
217 |
doins -r sample |
218 |
fi |
219 |
|
220 |
dodoc ChangeLog NEWS doc/NEWS* README* || die |
221 |
|
222 |
if use rubytests; then |
223 |
pushd test |
224 |
insinto /usr/share/${PN}-${SLOT}/test |
225 |
doins -r . |
226 |
popd |
227 |
fi |
228 |
} |
229 |
|
230 |
pkg_postinst() { |
231 |
if [[ ! -n $(readlink "${ROOT}"usr/bin/ruby) ]] ; then |
232 |
eselect ruby set ruby${MY_SUFFIX} |
233 |
fi |
234 |
|
235 |
elog |
236 |
elog "To switch between available Ruby profiles, execute as root:" |
237 |
elog "\teselect ruby set ruby(19|20|...)" |
238 |
elog |
239 |
} |
240 |
|
241 |
pkg_postrm() { |
242 |
eselect ruby cleanup |
243 |
} |