ruby: Bump to 3.2.0

This commit is contained in:
Tee KOBAYASHI 2022-12-23 14:03:54 +09:00 committed by xtkoba
parent a5211296ec
commit 3607fca6b8
4 changed files with 68 additions and 50 deletions

View File

@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://www.ruby-lang.org/
TERMUX_PKG_DESCRIPTION="Dynamic programming language with a focus on simplicity and productivity"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.1.3
TERMUX_PKG_SRCURL=https://cache.ruby-lang.org/pub/ruby/${TERMUX_PKG_VERSION:0:3}/ruby-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=4ee161939826bcdfdafa757cf8e293a7f14e357f62be7144f040335cc8c7371a
TERMUX_PKG_VERSION=3.2.0
TERMUX_PKG_SRCURL=https://cache.ruby-lang.org/pub/ruby/$(echo $TERMUX_PKG_VERSION | cut -d . -f 1-2)/ruby-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=d2f4577306e6dd932259693233141e5c3ec13622c95b75996541b8d5b68b28b4
# libbffi is used by the fiddle extension module:
TERMUX_PKG_DEPENDS="libandroid-execinfo, libandroid-support, libffi, libgmp, readline, openssl, libyaml, zlib"
TERMUX_PKG_RECOMMENDS="clang, make, pkg-config"
@ -19,14 +19,29 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" rb_cv_type_deprecated=x"
# getresuid(2) does not work on ChromeOS - https://github.com/termux/termux-app/issues/147:
# TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_getresuid=no"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS="
--prefix=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host
--disable-install-doc
--disable-install-rdoc
--disable-install-capi
"
termux_step_host_build() {
"$TERMUX_PKG_SRCDIR/configure" --prefix=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host
"$TERMUX_PKG_SRCDIR/configure" ${TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS}
make -j $TERMUX_MAKE_PROCESSES
make install
}
termux_step_pre_configure() {
_RUBY_API_VERSION=$(echo $TERMUX_PKG_VERSION | cut -d . -f 1-2).0
test ${_RUBY_ABI_VERSION:=} && _RUBY_API_VERSION+=+${_RUBY_ABI_VERSION}
echo "Applying tool-rbinstall.rb.diff"
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
-e "s|@RUBY_API_VERSION@|${_RUBY_API_VERSION}|g" \
$TERMUX_PKG_BUILDER_DIR/tool-rbinstall.rb.diff \
| patch --silent -p1
autoreconf -fi
export PATH=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/bin:$PATH
@ -45,7 +60,7 @@ termux_step_make_install() {
make uninstall # remove possible remains to get fresh timestamps
make install
local RBCONFIG=$TERMUX_PREFIX/lib/ruby/${TERMUX_PKG_VERSION:0:3}.0/${TERMUX_HOST_PLATFORM}/rbconfig.rb
local RBCONFIG=$TERMUX_PREFIX/lib/ruby/${_RUBY_API_VERSION}/${TERMUX_HOST_PLATFORM}/rbconfig.rb
# Fix absolute paths to executables:
perl -p -i -e 's/^.*CONFIG\["INSTALL"\].*$/ CONFIG["INSTALL"] = "install -c"/' $RBCONFIG
@ -57,7 +72,11 @@ termux_step_make_install() {
}
termux_step_post_massage() {
if [ ! -f $TERMUX_PREFIX/lib/ruby/${TERMUX_PKG_VERSION:0:3}.0/${TERMUX_HOST_PLATFORM}/readline.so ]; then
echo "Error: The readline extension was not built"
if [ ! -f ./lib/ruby/${_RUBY_API_VERSION}/${TERMUX_HOST_PLATFORM}/readline.so ]; then
termux_error_exit "The readline extension was not installed."
fi
local _RUBYGEMS_ARCH=${TERMUX_HOST_PLATFORM/i686-/x86-}
if [ ! -d ./lib/ruby/gems/${_RUBY_API_VERSION}/extensions/${_RUBYGEMS_ARCH} ]; then
termux_error_exit "Extensions for bundled gems were not installed."
fi
}

View File

@ -0,0 +1,13 @@
As of writing, extensions for bundled gems are not installed without this patch.
We have a guard for that in build.sh and you can remove this without extra care.
--- a/common.mk
+++ b/common.mk
@@ -1375,7 +1375,6 @@
refresh-gems: update-bundled_gems prepare-gems
prepare-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=extract-gems)
-prepare-gems: $(DOT_WAIT) $(HAVE_BASERUBY:yes=outdate-bundled-gems)
extract-gems: $(HAVE_BASERUBY:yes=update-gems)
update-gems$(gnumake:yes=-sequential): PHONY

View File

@ -25,13 +25,13 @@ diff -uNr ruby-3.0.0/dln_find.c ruby-3.0.0.mod/dln_find.c
@@ -72,10 +72,7 @@
if (!path) {
path =
- "/usr/local/bin" PATH_SEP
- "/usr/ucb" PATH_SEP
- "/usr/bin" PATH_SEP
- "/bin" PATH_SEP
+ "@TERMUX_PREFIX@/bin" PATH_SEP
".";
path =
- "/usr/local/bin" PATH_SEP
- "/usr/ucb" PATH_SEP
- "/usr/bin" PATH_SEP
- "/bin" PATH_SEP
+ "@TERMUX_PREFIX@/bin" PATH_SEP
".";
}
buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG);
diff -uNr ruby-3.0.0/ext/etc/etc.c ruby-3.0.0.mod/ext/etc/etc.c
@ -46,20 +46,6 @@ diff -uNr ruby-3.0.0/ext/etc/etc.c ruby-3.0.0.mod/ext/etc/etc.c
const char *tmpstr = default_tmp;
size_t tmplen = strlen(default_tmp);
# if defined _CS_DARWIN_USER_TEMP_DIR
diff -uNr ruby-3.0.0/ext/fiddle/libffi-3.2.1/src/closures.c ruby-3.0.0.mod/ext/fiddle/libffi-3.2.1/src/closures.c
--- ruby-3.0.0/ext/fiddle/libffi-3.2.1/src/closures.c 2014-11-08 14:47:24.000000000 +0200
+++ ruby-3.0.0.mod/ext/fiddle/libffi-3.2.1/src/closures.c 2021-02-09 17:40:07.564105731 +0200
@@ -391,8 +391,8 @@
int repeat;
} open_temp_exec_file_opts[] = {
{ open_temp_exec_file_env, "TMPDIR", 0 },
- { open_temp_exec_file_dir, "/tmp", 0 },
- { open_temp_exec_file_dir, "/var/tmp", 0 },
+ { open_temp_exec_file_dir, "@TERMUX_PREFIX@/tmp", 0 },
+ { open_temp_exec_file_dir, "@TERMUX_PREFIX@/var/tmp", 0 },
{ open_temp_exec_file_dir, "/dev/shm", 0 },
{ open_temp_exec_file_env, "HOME", 0 },
#ifdef HAVE_MNTENT
diff -uNr ruby-3.0.0/ext/pty/pty.c ruby-3.0.0.mod/ext/pty/pty.c
--- ruby-3.0.0/ext/pty/pty.c 2020-12-25 05:33:01.000000000 +0200
+++ ruby-3.0.0.mod/ext/pty/pty.c 2021-02-09 17:45:16.473977053 +0200
@ -67,11 +53,11 @@ diff -uNr ruby-3.0.0/ext/pty/pty.c ruby-3.0.0.mod/ext/pty/pty.c
char errbuf[32];
if (argc == 0) {
- const char *shellname = "/bin/sh";
+ const char *shellname = "@TERMUX_PREFIX@/bin/sh";
- const char *shellname = "/bin/sh";
+ const char *shellname = "@TERMUX_PREFIX@/bin/sh";
if ((p = getenv("SHELL")) != NULL) {
shellname = p;
if ((p = getenv("SHELL")) != NULL) {
shellname = p;
diff -uNr ruby-3.0.0/hash.c ruby-3.0.0.mod/hash.c
--- ruby-3.0.0/hash.c 2020-12-25 05:33:01.000000000 +0200
+++ ruby-3.0.0.mod/hash.c 2021-02-09 17:43:01.683876134 +0200
@ -172,6 +158,15 @@ diff -uNr ruby-3.0.0/mjit.c ruby-3.0.0.mod/mjit.c
# undef RETURN_ENV
}
@@ -1741,7 +1741,7 @@
M("--mjit-warnings", "", "Enable printing JIT warnings"),
M("--mjit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"),
M("--mjit-wait", "", "Wait until JIT compilation finishes every time (for testing)"),
- M("--mjit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"),
+ M("--mjit-save-temps", "", "Save JIT temporary files in $TMP or @TERMUX_PREFIX@/tmp (for testing)"),
M("--mjit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"),
M("--mjit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: "
STRINGIZE(DEFAULT_MAX_CACHE_SIZE) ")"),
diff -uNr ruby-3.0.0/process.c ruby-3.0.0.mod/process.c
--- ruby-3.0.0/process.c 2020-12-25 05:33:01.000000000 +0200
+++ ruby-3.0.0.mod/process.c 2021-02-09 17:49:30.716668413 +0200
@ -202,24 +197,15 @@ diff -uNr ruby-3.0.0/process.c ruby-3.0.0.mod/process.c
diff -uNr ruby-3.1.0/ruby.c ruby-3.1.0.mod/ruby.c
--- ruby-3.1.0/ruby.c
+++ ruby-3.1.0.mod/ruby.c
@@ -359,7 +359,7 @@
M("--mjit-warnings", "", "Enable printing JIT warnings"),
M("--mjit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"),
M("--mjit-wait", "", "Wait until JIT compilation finishes every time (for testing)"),
- M("--mjit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"),
+ M("--mjit-save-temps", "", "Save JIT temporary files in $TMP or @TERMUX_PREFIX@/tmp (for testing)"),
M("--mjit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"),
M("--mjit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: 100)"),
M("--mjit-min-calls=num", "", "Number of calls to trigger JIT (for testing, default: 10000)"),
@@ -684,7 +684,7 @@
RUBY_ARCH_PATH;
const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir)
- rb_strlen_lit(RUBY_ARCH_PATH) - 1;
- static const char bindir[] = "/bin";
+ static const char bindir[] = "@TERMUX_PREFIX@/bin";
const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;
RUBY_ARCH_PATH;
const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir)
- rb_strlen_lit(RUBY_ARCH_PATH) - 1;
- static const char bindir[] = "/bin";
+ static const char bindir[] = "@TERMUX_PREFIX@/bin";
const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;
const char *p2 = NULL;
const char *p2 = NULL;
diff -uNr ruby-3.0.0/spec/bundler/commands/exec_spec.rb ruby-3.0.0.mod/spec/bundler/commands/exec_spec.rb
--- ruby-3.0.0/spec/bundler/commands/exec_spec.rb 2020-12-25 05:33:01.000000000 +0200
+++ ruby-3.0.0.mod/spec/bundler/commands/exec_spec.rb 2021-02-09 17:50:58.332721054 +0200

View File

@ -5,7 +5,7 @@
def install_default_gem(dir, srcdir, bindir)
- gem_dir = Gem.default_dir
+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/3.1.0"
+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/@RUBY_API_VERSION@"
install_dir = with_destdir(gem_dir)
prepare "default gems from #{dir}", gem_dir
RbInstall.no_write do
@ -14,7 +14,7 @@
install?(:ext, :comm, :gem, :'bundled-gems') do
- gem_dir = Gem.default_dir
+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/3.1.0"
+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/@RUBY_API_VERSION@"
install_dir = with_destdir(gem_dir)
prepare "bundled gems", gem_dir
RbInstall.no_write do