1 |
commit: 628ac95758dbf75a9008e370c032890355eca716 |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 29 10:34:20 2020 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 29 10:34:57 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=628ac957 |
7 |
|
8 |
dev-lang/ruby: fix compilation with USE=socks5 |
9 |
|
10 |
Thanks to Phobos Kappa for providing the patch both to use and upstream. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/762253 |
13 |
Package-Manager: Portage-3.0.9, Repoman-3.0.2 |
14 |
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org> |
15 |
|
16 |
dev-lang/ruby/files/3.0/001-socksocket-fix.patch | 15 ++ |
17 |
dev-lang/ruby/ruby-3.0.0-r1.ebuild | 262 +++++++++++++++++++++++ |
18 |
2 files changed, 277 insertions(+) |
19 |
|
20 |
diff --git a/dev-lang/ruby/files/3.0/001-socksocket-fix.patch b/dev-lang/ruby/files/3.0/001-socksocket-fix.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..1a79e25491c |
23 |
--- /dev/null |
24 |
+++ b/dev-lang/ruby/files/3.0/001-socksocket-fix.patch |
25 |
@@ -0,0 +1,15 @@ |
26 |
+Fix compilation with socks5 USE flag. |
27 |
+ |
28 |
+Patch by Phobos Kappa in https://bugs.gentoo.org/762253 |
29 |
+ |
30 |
+--- a/ext/socket/sockssocket.c 2020-12-25 05:33:01.000000000 +0200 |
31 |
++++ b/ext/socket/sockssocket.c 2020-12-28 15:42:50.310029778 +0200 |
32 |
+@@ -34,7 +34,7 @@ |
33 |
+ init = 1; |
34 |
+ } |
35 |
+ |
36 |
+- return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil); |
37 |
++ return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil, Qnil); |
38 |
+ } |
39 |
+ |
40 |
+ #ifdef SOCKS5 |
41 |
|
42 |
diff --git a/dev-lang/ruby/ruby-3.0.0-r1.ebuild b/dev-lang/ruby/ruby-3.0.0-r1.ebuild |
43 |
new file mode 100644 |
44 |
index 00000000000..2ac7bec3231 |
45 |
--- /dev/null |
46 |
+++ b/dev-lang/ruby/ruby-3.0.0-r1.ebuild |
47 |
@@ -0,0 +1,262 @@ |
48 |
+# Copyright 1999-2020 Gentoo Authors |
49 |
+# Distributed under the terms of the GNU General Public License v2 |
50 |
+ |
51 |
+EAPI=7 |
52 |
+ |
53 |
+inherit autotools flag-o-matic multilib |
54 |
+ |
55 |
+MY_P="${PN}-$(ver_cut 1-3)" |
56 |
+S=${WORKDIR}/${MY_P} |
57 |
+ |
58 |
+SLOT=$(ver_cut 1-2) |
59 |
+MY_SUFFIX=$(ver_rs 1 '' ${SLOT}) |
60 |
+RUBYVERSION=${SLOT}.0 |
61 |
+ |
62 |
+DESCRIPTION="An object-oriented scripting language" |
63 |
+HOMEPAGE="https://www.ruby-lang.org/" |
64 |
+SRC_URI="https://cache.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.xz" |
65 |
+ |
66 |
+LICENSE="|| ( Ruby-BSD BSD-2 )" |
67 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
68 |
+IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit libressl +rdoc rubytests socks5 +ssl static-libs systemtap tk xemacs" |
69 |
+ |
70 |
+RDEPEND=" |
71 |
+ berkdb? ( sys-libs/db:= ) |
72 |
+ gdbm? ( sys-libs/gdbm:= ) |
73 |
+ jemalloc? ( dev-libs/jemalloc ) |
74 |
+ jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) ) |
75 |
+ ssl? ( |
76 |
+ !libressl? ( dev-libs/openssl:0= ) |
77 |
+ libressl? ( dev-libs/libressl ) |
78 |
+ ) |
79 |
+ socks5? ( >=net-proxy/dante-1.1.13 ) |
80 |
+ systemtap? ( dev-util/systemtap ) |
81 |
+ tk? ( |
82 |
+ dev-lang/tcl:0=[threads] |
83 |
+ dev-lang/tk:0=[threads] |
84 |
+ ) |
85 |
+ dev-libs/libyaml |
86 |
+ dev-libs/libffi:= |
87 |
+ sys-libs/readline:0= |
88 |
+ sys-libs/zlib |
89 |
+ >=app-eselect/eselect-ruby-20201225 |
90 |
+" |
91 |
+ |
92 |
+DEPEND="${RDEPEND}" |
93 |
+ |
94 |
+BUNDLED_GEMS=" |
95 |
+ >=dev-ruby/minitest-5.14.2[ruby_targets_ruby30] |
96 |
+ >=dev-ruby/power_assert-1.2.0[ruby_targets_ruby30] |
97 |
+ >=dev-ruby/rake-13.0.3[ruby_targets_ruby30] |
98 |
+ >=dev-ruby/rbs-1.0.0[ruby_targets_ruby30] |
99 |
+ >=dev-ruby/rexml-3.2.4[ruby_targets_ruby30] |
100 |
+ >=dev-ruby/rss-0.2.9[ruby_targets_ruby30] |
101 |
+ >=dev-ruby/test-unit-3.3.7[ruby_targets_ruby30] |
102 |
+ >=dev-ruby/typeprof-0.11.0[ruby_targets_ruby30] |
103 |
+" |
104 |
+ |
105 |
+PDEPEND=" |
106 |
+ ${BUNDLED_GEMS} |
107 |
+ virtual/rubygems[ruby_targets_ruby30] |
108 |
+ >=dev-ruby/bundler-2.1.4[ruby_targets_ruby30] |
109 |
+ >=dev-ruby/did_you_mean-1.5.0[ruby_targets_ruby30] |
110 |
+ >=dev-ruby/json-2.5.1[ruby_targets_ruby30] |
111 |
+ rdoc? ( >=dev-ruby/rdoc-6.3.0[ruby_targets_ruby30] ) |
112 |
+ xemacs? ( app-xemacs/ruby-modes )" |
113 |
+ |
114 |
+src_prepare() { |
115 |
+ eapply "${FILESDIR}"/"${SLOT}"/{001,010}*.patch |
116 |
+ |
117 |
+ einfo "Unbundling gems..." |
118 |
+ cd "$S" |
119 |
+ # Remove bundled gems that we will install via PDEPEND, bug |
120 |
+ # 539700. |
121 |
+ rm -fr gems/* || die |
122 |
+ touch gems/bundled_gems || die |
123 |
+ # Don't install CLI tools since they will clash with the gem |
124 |
+ rm -f bin/{racc,racc2y,y2racc} || die |
125 |
+ sed -i -e '/executables/ s:^:#:' lib/racc/racc.gemspec || die |
126 |
+ |
127 |
+ einfo "Removing bundled libraries..." |
128 |
+ rm -fr ext/fiddle/libffi-3.2.1 || die |
129 |
+ |
130 |
+ if use prefix ; then |
131 |
+ # Fix hardcoded SHELL var in mkmf library |
132 |
+ sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die |
133 |
+ |
134 |
+ if [[ ${CHOST} == *darwin* ]] ; then |
135 |
+ # avoid symlink loop on Darwin (?!) |
136 |
+ sed -i \ |
137 |
+ -e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \ |
138 |
+ configure.ac || die |
139 |
+ |
140 |
+ # make ar/libtool hack for Darwin work |
141 |
+ sed -i \ |
142 |
+ -e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \ |
143 |
+ configure.ac || die |
144 |
+ fi |
145 |
+ fi |
146 |
+ |
147 |
+ eapply_user |
148 |
+ |
149 |
+ eautoreconf |
150 |
+} |
151 |
+ |
152 |
+src_configure() { |
153 |
+ local modules= myconf= |
154 |
+ |
155 |
+ # -fomit-frame-pointer makes ruby segfault, see bug #150413. |
156 |
+ filter-flags -fomit-frame-pointer |
157 |
+ # In many places aliasing rules are broken; play it safe |
158 |
+ # as it's risky with newer compilers to leave it as it is. |
159 |
+ append-flags -fno-strict-aliasing |
160 |
+ |
161 |
+ # Socks support via dante |
162 |
+ if use socks5 ; then |
163 |
+ # Socks support can't be disabled as long as SOCKS_SERVER is |
164 |
+ # set and socks library is present, so need to unset |
165 |
+ # SOCKS_SERVER in that case. |
166 |
+ unset SOCKS_SERVER |
167 |
+ fi |
168 |
+ |
169 |
+ # Increase GC_MALLOC_LIMIT if set (default is 8000000) |
170 |
+ if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then |
171 |
+ append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}" |
172 |
+ fi |
173 |
+ |
174 |
+ # ipv6 hack, bug 168939. Needs --enable-ipv6. |
175 |
+ use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET" |
176 |
+ |
177 |
+ # Determine which modules *not* to build depending in the USE flags. |
178 |
+ if ! use berkdb ; then |
179 |
+ modules="${modules},dbm" |
180 |
+ fi |
181 |
+ if ! use gdbm ; then |
182 |
+ modules="${modules},gdbm" |
183 |
+ fi |
184 |
+ if ! use ssl ; then |
185 |
+ modules="${modules},openssl" |
186 |
+ fi |
187 |
+ if ! use tk ; then |
188 |
+ modules="${modules},tk" |
189 |
+ fi |
190 |
+ |
191 |
+ # Provide an empty LIBPATHENV because we disable rpath but we do not |
192 |
+ # need LD_LIBRARY_PATH by default since that breaks USE=multitarget |
193 |
+ # #564272 |
194 |
+ INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \ |
195 |
+ --program-suffix=${MY_SUFFIX} \ |
196 |
+ --with-soname=ruby${MY_SUFFIX} \ |
197 |
+ --with-readline-dir="${EPREFIX}"/usr \ |
198 |
+ --enable-shared \ |
199 |
+ --enable-pthread \ |
200 |
+ --disable-rpath \ |
201 |
+ --with-out-ext="${modules}" \ |
202 |
+ $(use_with jemalloc jemalloc) \ |
203 |
+ $(use_enable jit jit-support ) \ |
204 |
+ $(use_enable socks5 socks) \ |
205 |
+ $(use_enable systemtap dtrace) \ |
206 |
+ $(use_enable doc install-doc) \ |
207 |
+ --enable-ipv6 \ |
208 |
+ $(use_enable static-libs static) \ |
209 |
+ $(use_enable static-libs install-static-library) \ |
210 |
+ $(use_with static-libs static-linked-ext) \ |
211 |
+ $(use_enable debug) \ |
212 |
+ ${myconf} \ |
213 |
+ --enable-option-checking=no |
214 |
+ |
215 |
+ # Makefile is broken because it lacks -ldl |
216 |
+ rm -rf ext/-test-/popen_deadlock || die |
217 |
+} |
218 |
+ |
219 |
+src_compile() { |
220 |
+ emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS="" |
221 |
+} |
222 |
+ |
223 |
+src_test() { |
224 |
+ emake -j1 V=1 test |
225 |
+ |
226 |
+ elog "Ruby's make test has been run. Ruby also ships with a make check" |
227 |
+ elog "that cannot be run until after ruby has been installed." |
228 |
+ elog |
229 |
+ if use rubytests; then |
230 |
+ elog "You have enabled rubytests, so they will be installed to" |
231 |
+ elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other" |
232 |
+ elog "than root, and you must place them into a writeable directory." |
233 |
+ elog "Then call: " |
234 |
+ elog |
235 |
+ elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb" |
236 |
+ else |
237 |
+ elog "Enable the rubytests USE flag to install the make check tests" |
238 |
+ fi |
239 |
+} |
240 |
+ |
241 |
+src_install() { |
242 |
+ # Remove the remaining bundled gems. We do this late in the process |
243 |
+ # since they are used during the build to e.g. create the |
244 |
+ # documentation. |
245 |
+ rm -rf ext/json || die |
246 |
+ rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die |
247 |
+ |
248 |
+ # Ruby is involved in the install process, we don't want interference here. |
249 |
+ unset RUBYOPT |
250 |
+ |
251 |
+ local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby) |
252 |
+ |
253 |
+ LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}" |
254 |
+ |
255 |
+ if [[ ${CHOST} == *darwin* ]] ; then |
256 |
+ DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}" |
257 |
+ export DYLD_LIBRARY_PATH |
258 |
+ fi |
259 |
+ |
260 |
+ RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}" |
261 |
+ for d in $(find "${S}/ext" -type d) ; do |
262 |
+ RUBYLIB="${RUBYLIB}:$d" |
263 |
+ done |
264 |
+ export LD_LIBRARY_PATH RUBYLIB |
265 |
+ |
266 |
+ # Create directory for the default gems |
267 |
+ local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}" |
268 |
+ mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed" |
269 |
+ |
270 |
+ emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install |
271 |
+ |
272 |
+ # Remove installed rubygems and rdoc copy |
273 |
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed" |
274 |
+ rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed" |
275 |
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed" |
276 |
+ rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed" |
277 |
+ |
278 |
+ if use doc; then |
279 |
+ emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc |
280 |
+ fi |
281 |
+ |
282 |
+ if use examples; then |
283 |
+ dodoc -r sample |
284 |
+ fi |
285 |
+ |
286 |
+ dodoc ChangeLog NEWS.md doc/NEWS* README* |
287 |
+ |
288 |
+ if use rubytests; then |
289 |
+ pushd test |
290 |
+ insinto /usr/share/${PN}-${SLOT}/test |
291 |
+ doins -r . |
292 |
+ popd |
293 |
+ fi |
294 |
+} |
295 |
+ |
296 |
+pkg_postinst() { |
297 |
+ if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then |
298 |
+ eselect ruby set ruby${MY_SUFFIX} |
299 |
+ fi |
300 |
+ |
301 |
+ elog |
302 |
+ elog "To switch between available Ruby profiles, execute as root:" |
303 |
+ elog "\teselect ruby set ruby(23|24|...)" |
304 |
+ elog |
305 |
+} |
306 |
+ |
307 |
+pkg_postrm() { |
308 |
+ eselect ruby cleanup |
309 |
+} |