diff --git a/packages/ruby/android-sdk-level.patch b/packages/ruby/android-sdk-level.patch new file mode 100644 index 000000000..43f4cd291 --- /dev/null +++ b/packages/ruby/android-sdk-level.patch @@ -0,0 +1,12 @@ +diff -uNr ruby-3.0.0/configure ruby-3.0.0.mod/configure +--- ruby-3.0.0/configure 2020-12-25 05:33:03.000000000 +0200 ++++ ruby-3.0.0.mod/configure 2021-02-09 18:11:38.400873131 +0200 +@@ -9105,7 +9105,7 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Android API version" >&5 + $as_echo_n "checking for Android API version... " >&6; } + # hacky workaround: https://github.com/termux/termux-packages/issues/6176 +- rb_android_api=`getprop ro.build.version.sdk` ++ rb_android_api=24 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rb_android_api" >&5 + colorize_result "$rb_android_api" ; } + # RUBY_APPEND_OPTIONS(CPPFLAGS) diff --git a/packages/ruby/build.sh b/packages/ruby/build.sh index 774ced3e9..1dc8204f0 100644 --- a/packages/ruby/build.sh +++ b/packages/ruby/build.sh @@ -2,10 +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=2.7.2 -TERMUX_PKG_REVISION=3 +TERMUX_PKG_VERSION=3.0.0 TERMUX_PKG_SRCURL=https://cache.ruby-lang.org/pub/ruby/${TERMUX_PKG_VERSION:0:3}/ruby-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=1b95ab193cc8f5b5e59d2686cb3d5dcf1ddf2a86cb6950e0b4bdaae5040ec0d6 +TERMUX_PKG_SHA256=68bfaeef027b6ccd0032504a68ae69721a70e97d921ff328c0c8836c798f6cb1 # libbffi is used by the fiddle extension module: TERMUX_PKG_DEPENDS="gdbm, libandroid-support, libffi, libgmp, readline, openssl, libyaml, zlib" TERMUX_PKG_RECOMMENDS="clang, make, pkg-config" diff --git a/packages/ruby/ext-etc-etc.c.patch b/packages/ruby/ext-etc-etc.c.patch deleted file mode 100644 index 94e5eca61..000000000 --- a/packages/ruby/ext-etc-etc.c.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -u -r ../ruby-2.4.0/ext/etc/etc.c ./ext/etc/etc.c ---- ../ruby-2.4.0/ext/etc/etc.c 2016-06-02 14:21:42.000000000 +0200 -+++ ./ext/etc/etc.c 2017-01-18 04:18:25.912737382 +0100 -@@ -651,7 +651,7 @@ - if (!len) return Qnil; - tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding()); - #else -- const char default_tmp[] = "/tmp"; -+ const char default_tmp[] = "@TERMUX_PREFIX@/tmp"; - const char *tmpstr = default_tmp; - size_t tmplen = strlen(default_tmp); - # if defined _CS_DARWIN_USER_TEMP_DIR diff --git a/packages/ruby/fix-paths.patch b/packages/ruby/fix-paths.patch index 380505976..24e0d5531 100644 --- a/packages/ruby/fix-paths.patch +++ b/packages/ruby/fix-paths.patch @@ -1,18 +1,39 @@ -diff -uNr ruby-2.7.1/addr2line.c ruby-2.7.1.mod/addr2line.c ---- ruby-2.7.1/addr2line.c 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/addr2line.c 2020-07-09 01:48:04.893490147 +0300 -@@ -537,7 +537,7 @@ - /* Ideally we should check 4 paths to follow gnu_debuglink, - but we handle only one case for now as this format is used - by some linux distributions. See GDB's info for detail. */ +diff -uNr ruby-3.0.0/addr2line.c ruby-3.0.0.mod/addr2line.c +--- ruby-3.0.0/addr2line.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/addr2line.c 2021-02-09 17:44:23.586601868 +0200 +@@ -545,7 +545,7 @@ + follow_debuglink(const char *debuglink, int num_traces, void **traces, + obj_info_t **objp, line_info_t *lines, int offset) + { - static const char global_debug_dir[] = "/usr/lib/debug"; + static const char global_debug_dir[] = "@TERMUX_PREFIX@/lib/debug"; const size_t global_debug_dir_len = sizeof(global_debug_dir) - 1; char *p; obj_info_t *o1 = *objp, *o2; -diff -uNr ruby-2.7.1/dln_find.c ruby-2.7.1.mod/dln_find.c ---- ruby-2.7.1/dln_find.c 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/dln_find.c 2020-07-09 01:48:38.137640163 +0300 +@@ -577,7 +577,7 @@ + follow_debuglink_build_id(const char *build_id, size_t build_id_size, int num_traces, void **traces, + obj_info_t **objp, line_info_t *lines, int offset) + { +- static const char global_debug_dir[] = "/usr/lib/debug/.build-id/"; ++ static const char global_debug_dir[] = "@TERMUX_PREFIX@/lib/debug/.build-id/"; + const size_t global_debug_dir_len = sizeof(global_debug_dir) - 1; + char *p; + obj_info_t *o1 = *objp, *o2; +diff -uNr ruby-3.0.0/dln.c ruby-3.0.0.mod/dln.c +--- ruby-3.0.0/dln.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/dln.c 2021-02-09 17:44:44.846333261 +0200 +@@ -154,7 +154,7 @@ + #endif + + #ifndef DLN_DEFAULT_LIB_PATH +-# define DLN_DEFAULT_LIB_PATH "/lib:/usr/lib:/usr/local/lib:." ++# define DLN_DEFAULT_LIB_PATH "@TERMUX_PREFIX@/lib:." + #endif + + #include +diff -uNr ruby-3.0.0/dln_find.c ruby-3.0.0.mod/dln_find.c +--- ruby-3.0.0/dln_find.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/dln_find.c 2021-02-09 17:35:46.039359196 +0200 @@ -72,10 +72,7 @@ if (!path) { @@ -25,9 +46,64 @@ diff -uNr ruby-2.7.1/dln_find.c ruby-2.7.1.mod/dln_find.c "."; } buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG); -diff -uNr ruby-2.7.1/lib/drb/gw.rb ruby-2.7.1.mod/lib/drb/gw.rb ---- ruby-2.7.1/lib/drb/gw.rb 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/lib/drb/gw.rb 2020-07-09 01:48:04.893490147 +0300 +diff -uNr ruby-3.0.0/ext/etc/etc.c ruby-3.0.0.mod/ext/etc/etc.c +--- ruby-3.0.0/ext/etc/etc.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/ext/etc/etc.c 2021-02-09 17:41:07.618382244 +0200 +@@ -672,7 +672,7 @@ + if (!len) return Qnil; + tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding()); + #else +- const char default_tmp[] = "/tmp"; ++ const char default_tmp[] = "@TERMUX_PREFIX@/tmp"; + 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 +@@ -176,7 +176,7 @@ + char errbuf[32]; + + if (argc == 0) { +- const char *shellname = "/bin/sh"; ++ const char *shellname = "@TERMUX_PREFIX@/bin/sh"; + + 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 +@@ -717,11 +717,11 @@ + else { + #if 0 + static int pid; +- static char fname[256]; ++ static char fname[sizeof("@TERMUX_PREFIX@/tmp")+256]; + static FILE *fp; + + if (pid != getpid()) { +- snprintf(fname, sizeof(fname), "/tmp/ruby-armiss.%d", pid = getpid()); ++ snprintf(fname, sizeof(fname), "@TERMUX_PREFIX@/tmp/ruby-armiss.%d", pid = getpid()); + if ((fp = fopen(fname, "w")) == NULL) rb_bug("fopen"); + } + +diff -uNr ruby-3.0.0/lib/drb/gw.rb ruby-3.0.0.mod/lib/drb/gw.rb +--- ruby-3.0.0/lib/drb/gw.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/lib/drb/gw.rb 2021-02-09 17:35:46.039359196 +0200 @@ -99,8 +99,8 @@ front = DRb::GW.new @@ -63,9 +139,9 @@ diff -uNr ruby-2.7.1/lib/drb/gw.rb ruby-2.7.1.mod/lib/drb/gw.rb puts "c->b" a = robj[:a] -diff -uNr ruby-2.7.1/lib/mkmf.rb ruby-2.7.1.mod/lib/mkmf.rb ---- ruby-2.7.1/lib/mkmf.rb 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/lib/mkmf.rb 2020-07-09 01:51:26.902401365 +0300 +diff -uNr ruby-3.0.0/lib/mkmf.rb ruby-3.0.0.mod/lib/mkmf.rb +--- ruby-3.0.0/lib/mkmf.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/lib/mkmf.rb 2021-02-09 17:35:46.039359196 +0200 @@ -1580,7 +1580,7 @@ if path ||= ENV['PATH'] path = path.split(File::PATH_SEPARATOR) @@ -75,9 +151,9 @@ diff -uNr ruby-2.7.1/lib/mkmf.rb ruby-2.7.1.mod/lib/mkmf.rb end file = nil path.each do |dir| -diff -uNr ruby-2.7.1/lib/resolv.rb ruby-2.7.1.mod/lib/resolv.rb ---- ruby-2.7.1/lib/resolv.rb 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/lib/resolv.rb 2020-07-09 01:48:04.893490147 +0300 +diff -uNr ruby-3.0.0/lib/resolv.rb ruby-3.0.0.mod/lib/resolv.rb +--- ruby-3.0.0/lib/resolv.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/lib/resolv.rb 2021-02-09 17:35:46.043359300 +0200 @@ -173,7 +173,7 @@ rescue LoadError end @@ -87,7 +163,7 @@ diff -uNr ruby-2.7.1/lib/resolv.rb ruby-2.7.1.mod/lib/resolv.rb ## # Creates a new Resolv::Hosts, using +filename+ for its data source. -@@ -984,7 +984,7 @@ +@@ -985,7 +985,7 @@ return { :nameserver => nameserver, :search => search, :ndots => ndots } end @@ -96,29 +172,151 @@ diff -uNr ruby-2.7.1/lib/resolv.rb ruby-2.7.1.mod/lib/resolv.rb if File.exist? filename config_hash = Config.parse_resolv_conf(filename) else -diff -uNr ruby-2.7.1/lib/tmpdir.rb ruby-2.7.1.mod/lib/tmpdir.rb ---- ruby-2.7.1/lib/tmpdir.rb 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/lib/tmpdir.rb 2020-07-09 01:48:04.893490147 +0300 -@@ -13,14 +13,14 @@ +diff -uNr ruby-3.0.0/mjit.c ruby-3.0.0.mod/mjit.c +--- ruby-3.0.0/mjit.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/mjit.c 2021-02-09 17:41:47.157406979 +0200 +@@ -606,7 +606,7 @@ + RETURN_ENV("TMP"); + tmpdir = system_default_tmpdir(); + if (check_tmpdir(tmpdir)) return tmpdir; +- return ruby_strdup("/tmp"); ++ return ruby_strdup("@TERMUX_PREFIX@/tmp"); + # undef RETURN_ENV + } - class Dir +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 +@@ -1810,9 +1810,9 @@ + *argv = (char *)prog; + *--argv = (char *)"sh"; + if (envp) +- execve("/bin/sh", argv, envp); /* async-signal-safe */ ++ execve("@TERMUX_PREFIX@/bin/sh", argv, envp); /* async-signal-safe */ + else +- execv("/bin/sh", argv); /* async-signal-safe (since SUSv4) */ ++ execv("@TERMUX_PREFIX@/bin/sh", argv); /* async-signal-safe (since SUSv4) */ + } -- @@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp' -+ @@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '@TERMUX_PREFIX@/tmp' + #else +@@ -1880,9 +1880,9 @@ + } + #else + if (envp_str) +- execle("/bin/sh", "sh", "-c", str, (char *)NULL, RB_IMEMO_TMPBUF_PTR(envp_str)); /* async-signal-safe */ ++ execle("@TERMUX_PREFIX@/bin/sh", "sh", "-c", str, (char *)NULL, RB_IMEMO_TMPBUF_PTR(envp_str)); /* async-signal-safe */ + else +- execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe (since SUSv4) */ ++ execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe (since SUSv4) */ + #endif /* _WIN32 */ + return errno; + } +diff -uNr ruby-3.0.0/ruby.c ruby-3.0.0.mod/ruby.c +--- ruby-3.0.0/ruby.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/ruby.c 2021-02-09 17:45:51.873636473 +0200 +@@ -333,7 +333,7 @@ + M("--jit-warnings", "", "Enable printing JIT warnings"), + M("--jit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"), + M("--jit-wait", "", "Wait until JIT compilation finishes every time (for testing)"), +- M("--jit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"), ++ M("--jit-save-temps", "", "Save JIT temporary files in $TMP or @TERMUX_PREFIX@/tmp (for testing)"), + M("--jit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"), + M("--jit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: 100)"), + M("--jit-min-calls=num", "", "Number of calls to trigger JIT (for testing, default: 10000)"), +@@ -641,7 +641,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; - ## - # Returns the operating system's temporary file path. + 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 +@@ -156,7 +156,7 @@ - def self.tmpdir - tmp = nil -- [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.'].each do |dir| -+ [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '@TERMUX_PREFIX@/tmp', '.'].each do |dir| - next if !dir - dir = File.expand_path(dir) - if stat = File.stat(dir) and stat.directory? and stat.writable? and -diff -uNr ruby-2.7.1/lib/webrick/config.rb ruby-2.7.1.mod/lib/webrick/config.rb ---- ruby-2.7.1/lib/webrick/config.rb 2020-03-31 13:44:55.000000000 +0300 -+++ ruby-2.7.1.mod/lib/webrick/config.rb 2020-07-09 01:48:04.893490147 +0300 + install_gemfile 'gem "rack"' + File.open(bundled_app("--verbose"), "w") do |f| +- f.puts "#!/bin/sh" ++ f.puts "#!@TERMUX_PREFIX@/bin/sh" + f.puts "echo foobar" + end + File.chmod(0o744, bundled_app("--verbose")) +diff -uNr ruby-3.0.0/spec/ruby/core/dir/shared/pwd.rb ruby-3.0.0.mod/spec/ruby/core/dir/shared/pwd.rb +--- ruby-3.0.0/spec/ruby/core/dir/shared/pwd.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/spec/ruby/core/dir/shared/pwd.rb 2021-02-09 17:50:07.720664849 +0200 +@@ -14,7 +14,7 @@ + # The following uses inode rather than file names to account for + # case insensitive file systems like default OS/X file systems + platform_is_not :windows do +- File.stat(pwd).ino.should == File.stat(`/bin/sh -c "pwd -P"`.chomp).ino ++ File.stat(pwd).ino.should == File.stat(`@TERMUX_PREFIX@/bin/sh -c "pwd -P"`.chomp).ino + end + platform_is :windows do + File.stat(pwd).ino.should == File.stat(File.expand_path(`cd`.chomp)).ino +diff -uNr ruby-3.0.0/spec/ruby/core/process/exec_spec.rb ruby-3.0.0.mod/spec/ruby/core/process/exec_spec.rb +--- ruby-3.0.0/spec/ruby/core/process/exec_spec.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/spec/ruby/core/process/exec_spec.rb 2021-02-09 17:50:27.464678688 +0200 +@@ -154,7 +154,7 @@ + describe "with a command array" do + it "uses the first element as the command name and the second as the argv[0] value" do + platform_is_not :windows do +- ruby_exe('Process.exec(["/bin/sh", "argv_zero"], "-c", "echo $0")', escape: true).should == "argv_zero\n" ++ ruby_exe('Process.exec(["@TERMUX_PREFIX@/bin/sh", "argv_zero"], "-c", "echo $0")', escape: true).should == "argv_zero\n" + end + platform_is :windows do + ruby_exe('Process.exec(["cmd.exe", "/C"], "/C", "echo", "argv_zero")', escape: true).should == "argv_zero\n" +@@ -163,7 +163,7 @@ + + it "coerces the argument using to_ary" do + platform_is_not :windows do +- ruby_exe('o = Object.new; def o.to_ary; ["/bin/sh", "argv_zero"]; end; Process.exec(o, "-c", "echo $0")', escape: true).should == "argv_zero\n" ++ ruby_exe('o = Object.new; def o.to_ary; ["@TERMUX_PREFIX@/bin/sh", "argv_zero"]; end; Process.exec(o, "-c", "echo $0")', escape: true).should == "argv_zero\n" + end + platform_is :windows do + ruby_exe('o = Object.new; def o.to_ary; ["cmd.exe", "/C"]; end; Process.exec(o, "/C", "echo", "argv_zero")', escape: true).should == "argv_zero\n" +diff -uNr ruby-3.0.0/spec/ruby/core/process/spawn_spec.rb ruby-3.0.0.mod/spec/ruby/core/process/spawn_spec.rb +--- ruby-3.0.0/spec/ruby/core/process/spawn_spec.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/spec/ruby/core/process/spawn_spec.rb 2021-02-09 17:50:41.692695143 +0200 +@@ -133,7 +133,7 @@ + describe "with a command array" do + it "uses the first element as the command name and the second as the argv[0] value" do + platform_is_not :windows do +- -> { Process.wait Process.spawn(["/bin/sh", "argv_zero"], "-c", "echo $0") }.should output_to_fd("argv_zero\n") ++ -> { Process.wait Process.spawn(["@TERMUX_PREFIX@/bin/sh", "argv_zero"], "-c", "echo $0") }.should output_to_fd("argv_zero\n") + end + platform_is :windows do + -> { Process.wait Process.spawn(["cmd.exe", "/C"], "/C", "echo", "argv_zero") }.should output_to_fd("argv_zero\n") +@@ -156,7 +156,7 @@ + it "calls #to_ary to convert the argument to an Array" do + o = mock("to_ary") + platform_is_not :windows do +- o.should_receive(:to_ary).and_return(["/bin/sh", "argv_zero"]) ++ o.should_receive(:to_ary).and_return(["@TERMUX_PREFIX@/bin/sh", "argv_zero"]) + -> { Process.wait Process.spawn(o, "-c", "echo $0") }.should output_to_fd("argv_zero\n") + end + platform_is :windows do +diff -uNr ruby-3.0.0/st.c ruby-3.0.0.mod/st.c +--- ruby-3.0.0/st.c 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/st.c 2021-02-09 17:39:08.594113373 +0200 +@@ -496,10 +496,10 @@ + static void + stat_col(void) + { +- char fname[10+sizeof(long)*3]; ++ char fname[sizeof("@TERMUX_PREFIX@/tmp/col")+sizeof(long)*3]; + FILE *f; + if (!collision.total) return; +- f = fopen((snprintf(fname, sizeof(fname), "/tmp/col%ld", (long)getpid()), fname), "w"); ++ f = fopen((snprintf(fname, sizeof(fname), "@TERMUX_PREFIX@/tmp/col%ld", (long)getpid()), fname), "w"); + if (f == NULL) + return; + fprintf(f, "collision: %d / %d (%6.2f)\n", collision.all, collision.total, +diff -uNr ruby-3.0.0/tool/lib/webrick/config.rb ruby-3.0.0.mod/tool/lib/webrick/config.rb +--- ruby-3.0.0/tool/lib/webrick/config.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/tool/lib/webrick/config.rb 2021-02-09 17:35:46.043359300 +0200 @@ -35,7 +35,7 @@ :Logger => nil, # default: WEBrick::Log.new :ServerSoftware => "WEBrick/#{WEBrick::VERSION} " + diff --git a/packages/ruby/process.c.patch b/packages/ruby/process.c.patch deleted file mode 100644 index 90a42e9fb..000000000 --- a/packages/ruby/process.c.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -u -r ../ruby-2.6.1/process.c ./process.c ---- ../ruby-2.6.1/process.c 2018-12-22 10:23:06.000000000 +0000 -+++ ./process.c 2019-02-16 09:27:04.713434722 +0000 -@@ -1569,9 +1569,9 @@ - *argv = (char *)prog; - *--argv = (char *)"sh"; - if (envp) -- execve("/bin/sh", argv, envp); /* async-signal-safe */ -+ execve("@TERMUX_PREFIX@/bin/sh", argv, envp); /* async-signal-safe */ - else -- execv("/bin/sh", argv); /* async-signal-safe (since SUSv4) */ -+ execv("@TERMUX_PREFIX@/bin/sh", argv); /* async-signal-safe (since SUSv4) */ - } - - #else -@@ -1639,9 +1639,9 @@ - } - #else - if (envp_str) -- execle("/bin/sh", "sh", "-c", str, (char *)NULL, RB_IMEMO_TMPBUF_PTR(envp_str)); /* async-signal-safe */ -+ execle("@TERMUX_PREFIX@/bin/sh", "sh", "-c", str, (char *)NULL, RB_IMEMO_TMPBUF_PTR(envp_str)); /* async-signal-safe */ - else -- execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe (since SUSv4) */ -+ execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe (since SUSv4) */ - #endif /* _WIN32 */ - return errno; - } -@@ -1744,7 +1744,7 @@ - if (status == -1 && errno == ENOEXEC) { - *argv = (char *)prog; - *--argv = (char *)"sh"; -- status = spawnv(P_NOWAIT, "/bin/sh", (const char **)argv); -+ status = spawnv(P_NOWAIT, "@TERMUX_PREFIX@/bin/sh", (const char **)argv); - after_exec(); - if (status == -1) errno = ENOEXEC; - } -@@ -1782,7 +1782,7 @@ - - char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf)); - before_exec(); -- status = spawnl(P_NOWAIT, (shell ? shell : "/bin/sh"), "sh", "-c", str, (char*)NULL); -+ status = spawnl(P_NOWAIT, (shell ? shell : "@TERMUX_PREFIX@/bin/sh"), "sh", "-c", str, (char*)NULL); - after_exec(); - return status; - } diff --git a/packages/ruby/pty.c.patch b/packages/ruby/pty.c.patch deleted file mode 100644 index 317d1e7be..000000000 --- a/packages/ruby/pty.c.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -u -r ../ruby-2.4.0/ext/pty/pty.c ./ext/pty/pty.c ---- ../ruby-2.4.0/ext/pty/pty.c 2016-04-29 21:12:52.000000000 -0400 -+++ ./ext/pty/pty.c 2017-01-13 07:15:02.848063672 -0500 -@@ -164,7 +164,7 @@ - char errbuf[32]; - - if (argc == 0) { -- const char *shellname = "/bin/sh"; -+ const char *shellname = "@TERMUX_PREFIX@/bin/sh"; - - if ((p = getenv("SHELL")) != NULL) { - shellname = p; diff --git a/packages/ruby/tool-rbinstall.rb.patch b/packages/ruby/tool-rbinstall.rb.patch index 8daed46dd..6c60a3dda 100644 --- a/packages/ruby/tool-rbinstall.rb.patch +++ b/packages/ruby/tool-rbinstall.rb.patch @@ -1,20 +1,21 @@ ---- /home/vagrant/ruby-2.5.0/tool/rbinstall.rb 2017-10-30 05:45:20.000000000 +0000 -+++ src/tool/rbinstall.rb 2018-02-14 18:53:42.498522407 +0000 -@@ -731,7 +731,7 @@ +diff -uNr ruby-3.0.0/tool/rbinstall.rb ruby-3.0.0.mod/tool/rbinstall.rb +--- ruby-3.0.0/tool/rbinstall.rb 2020-12-25 05:33:01.000000000 +0200 ++++ ruby-3.0.0.mod/tool/rbinstall.rb 2021-02-09 17:56:22.006372416 +0200 +@@ -897,7 +897,7 @@ end def install_default_gem(dir, srcdir) - gem_dir = Gem.default_dir -+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/2.7.0" - directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode) - prepare "default gems from #{dir}", gem_dir, directories - -@@ -765,7 +765,7 @@ ++ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/3.0.0" + install_dir = with_destdir(gem_dir) + prepare "default gems from #{dir}", gem_dir + makedirs(Gem.ensure_default_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)}) +@@ -943,7 +943,7 @@ end install?(:ext, :comm, :gem, :'bundled-gems') do - gem_dir = Gem.default_dir -+ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/2.7.0" - directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode) - prepare "bundled gems", gem_dir, directories ++ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/3.0.0" install_dir = with_destdir(gem_dir) + prepare "bundled gems", gem_dir + makedirs(Gem.ensure_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)})