summary refs log tree commit diff
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-11-03 14:43:23 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2023-11-03 16:35:05 -0400
commitb4f75edb0744abef12d1203c02f23f95db4f4d64 (patch)
treedb3bad0ee50ca639e9fc5c1bf7692d0ce9c034ca
parent3c43b804d4b6811cbafbe506113f12e45a13e19d (diff)
downloadnixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar.gz
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar.bz2
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar.lz
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar.xz
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.tar.zst
nixpkgs-b4f75edb0744abef12d1203c02f23f95db4f4d64.zip
rubyPackages.iconv: fix build with clang 16
Fix incompatible function pointer conversion errors.
-rw-r--r--pkgs/development/ruby-modules/gem-config/default.nix5
-rw-r--r--pkgs/development/ruby-modules/gem-config/iconv-fix-incompatible-function-pointer-conversions.patch51
2 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix
index 1704df297a6..317ed53828a 100644
--- a/pkgs/development/ruby-modules/gem-config/default.nix
+++ b/pkgs/development/ruby-modules/gem-config/default.nix
@@ -369,7 +369,12 @@ in
   };
 
   iconv = attrs: {
+    dontBuild = false;
     buildFlags = lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
+    patches = [
+      # Fix incompatible function pointer conversion errors with clang 16
+      ./iconv-fix-incompatible-function-pointer-conversions.patch
+    ];
   };
 
   idn-ruby = attrs: {
diff --git a/pkgs/development/ruby-modules/gem-config/iconv-fix-incompatible-function-pointer-conversions.patch b/pkgs/development/ruby-modules/gem-config/iconv-fix-incompatible-function-pointer-conversions.patch
new file mode 100644
index 00000000000..1cc38cbae13
--- /dev/null
+++ b/pkgs/development/ruby-modules/gem-config/iconv-fix-incompatible-function-pointer-conversions.patch
@@ -0,0 +1,51 @@
+diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
+index 2801049..77fae7e 100644
+--- a/ext/iconv/iconv.c
++++ b/ext/iconv/iconv.c
+@@ -188,7 +188,7 @@ static VALUE iconv_convert _((iconv_t cd, VALUE str, long start, long length, in
+ static VALUE iconv_s_allocate _((VALUE klass));
+ static VALUE iconv_initialize _((int argc, VALUE *argv, VALUE self));
+ static VALUE iconv_s_open _((int argc, VALUE *argv, VALUE self));
+-static VALUE iconv_s_convert _((struct iconv_env_t* env));
++static VALUE iconv_s_convert _((VALUE env));
+ static VALUE iconv_s_iconv _((int argc, VALUE *argv, VALUE self));
+ static VALUE iconv_init_state _((VALUE cd));
+ static VALUE iconv_finish _((VALUE self));
+@@ -204,7 +204,7 @@ static VALUE charset_map;
+  * Returns the map from canonical name to system dependent name.
+  */
+ static VALUE
+-charset_map_get(void)
++charset_map_get(VALUE klass)
+ {
+     return charset_map;
+ }
+@@ -642,7 +642,7 @@ iconv_s_allocate(VALUE klass)
+ }
+ 
+ static VALUE
+-get_iconv_opt_i(VALUE i, VALUE arg)
++get_iconv_opt_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
+ {
+     VALUE name;
+ #if defined ICONV_SET_TRANSLITERATE || defined ICONV_SET_DISCARD_ILSEQ
+@@ -784,8 +784,9 @@ iconv_s_open(int argc, VALUE *argv, VALUE self)
+ }
+ 
+ static VALUE
+-iconv_s_convert(struct iconv_env_t* env)
++iconv_s_convert(VALUE env_value)
+ {
++    struct iconv_env_t* env = (struct iconv_env_t*)env_value;
+     VALUE last = 0;
+ 
+     for (; env->argc > 0; --env->argc, ++env->argv) {
+@@ -906,7 +907,7 @@ list_iconv(unsigned int namescount, const char *const *names, void *data)
+ 
+ #if defined(HAVE_ICONVLIST) || defined(HAVE___ICONV_FREE_LIST)
+ static VALUE
+-iconv_s_list(void)
++iconv_s_list(VALUE klass)
+ {
+ #ifdef HAVE_ICONVLIST
+     int state;