summaryrefslogtreecommitdiff
path: root/dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch
diff options
context:
space:
mode:
authorZ. Liu <zhixu.liu@gmail.com>2025-07-01 23:32:47 +0800
committerSam James <sam@gentoo.org>2025-09-19 15:08:18 +0100
commita5f0a9720751ddc40ef46cd69493c6d23f0adb95 (patch)
tree776e0ae00906c387fa743fa645daf47c5ec3c9cd /dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch
parenta2354b6ee05e8caa92ce6419f8771a707cc0286b (diff)
downloadgentoo-a5f0a9720751ddc40ef46cd69493c6d23f0adb95.tar.gz
gentoo-a5f0a9720751ddc40ef46cd69493c6d23f0adb95.tar.bz2
gentoo-a5f0a9720751ddc40ef46cd69493c6d23f0adb95.zip
dev-lang/ruby: fix build issue with gcc15
1. if USE="socks5", full protoype is required by C23 2. if CFLAGS="-flto -Werror=lto-type-mismatch", and building with -std=c23 (default for gcc 15), build will fail with" "static declaration of ‘rb_io_closed_p’ follows non-static declaration" all patches are from upstream (w/ minor change if backport) Closes: https://bugs.gentoo.org/945502 Closes: https://bugs.gentoo.org/945643 Signed-off-by: Z. Liu <zhixu.liu@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/42828 Closes: https://github.com/gentoo/gentoo/pull/42828 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch')
-rw-r--r--dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch b/dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch
new file mode 100644
index 000000000000..2dd2846fd161
--- /dev/null
+++ b/dev-lang/ruby/files/3.4/016-io-console-add-header-ruby-io.h.patch
@@ -0,0 +1,58 @@
+had been fixed by upstream in commit
+
+https://github.com/ruby/io-console/commit/dd013030dd276a7372df34cf43ada1c14d0cbc21
+
+This patch is a cherry picked version.
+
+From 3226f1e3cc4787d4a00e639ff763a8b4cfcd5cdd Mon Sep 17 00:00:00 2001
+From: "Z. Liu" <zhixu.liu@gmail.com>
+Date: Sun, 29 Jun 2025 21:41:42 +0800
+Subject: [PATCH 1/2] [ruby/io-console]: add header "ruby/io.h" for rb_io_*
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+otherwise, when compiling using gcc 15 with "-flto
+-Werror=lto-type-mismatch", ext/io/console/extconf.h will have:
+
+> #define HAVE_RB_IO_PATH 1
+> #define HAVE_RB_IO_DESCRIPTOR 1
+> #define HAVE_RB_IO_GET_WRITE_IO 1
+> #define HAVE_RB_IO_CLOSED_P 1
+> #define HAVE_RB_IO_OPEN_DESCRIPTOR 1
+
+the build is failed with:
+
+> console.c:1417:1: error: static declaration of ‘rb_io_closed_p’ follows non-static declaration
+> 1417 | rb_io_closed_p(VALUE io)
+> | ^~~~~~~~~~~~~~
+> ../../.././include/ruby/io.h:385:7: note: previous declaration of ‘rb_io_closed_p’ with type ‘VALUE(VALUE)’ {aka ‘long unsigned int(long unsigned int)’}
+> 385 | VALUE rb_io_closed_p(VALUE io);
+> | ^~~~~~~~~~~~~~
+
+Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
+
+diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb
+index 4ad7ed6996..dd3d221ae5 100644
+--- a/ext/io/console/extconf.rb
++++ b/ext/io/console/extconf.rb
+@@ -10,11 +10,11 @@
+ abort
+
+ have_func("rb_interned_str_cstr")
+-have_func("rb_io_path")
+-have_func("rb_io_descriptor")
+-have_func("rb_io_get_write_io")
+-have_func("rb_io_closed_p")
+-have_func("rb_io_open_descriptor")
++have_func("rb_io_path", "ruby/io.h")
++have_func("rb_io_descriptor", "ruby/io.h")
++have_func("rb_io_get_write_io", "ruby/io.h")
++have_func("rb_io_closed_p", "ruby/io.h")
++have_func("rb_io_open_descriptor", "ruby/io.h")
+ have_func("rb_ractor_local_storage_value_newkey")
+
+ is_wasi = /wasi/ =~ MakeMakefile::RbConfig::CONFIG["platform"]
+--
+2.45.2
+