about summary refs log tree commit diff
path: root/pkgs/tools/audio/mpdcron
diff options
context:
space:
mode:
authorManuel Frischknecht <manuel.frischknecht@gmail.com>2023-11-28 20:40:15 +0100
committerManuel Frischknecht <manuel.frischknecht@gmail.com>2023-11-29 22:49:00 +0100
commit37517db1dee39b41b92bde635e75b5f0fbfcdefe (patch)
treead759b2d9158ff02c6cf97bebb09f57c6b80fe14 /pkgs/tools/audio/mpdcron
parenta54350357e763935b54c9d7a3ad6933eb8397c5e (diff)
mpdcron: fix build by correcting a C function conflict in `nokogiri`
`nokogiri` defines a C function called `canonicalize` which conflicts
with another function defined in glibc. Upstream has fixed this
issue [1], but in a much newer version. And because the affected
file has changed since the merged patch [2], it isn't directly
applicable to the old gem version `mpdcron` depends on.

[1]: https://github.com/sparklemotion/nokogiri/issues/2105
[2]: https://github.com/sparklemotion/nokogiri/commit/7a74cdbe4538e964023e5a0fdca58d8af708b91e
Diffstat (limited to 'pkgs/tools/audio/mpdcron')
-rw-r--r--pkgs/tools/audio/mpdcron/fix-canonicalize-conflict-with-glibc.patch22
-rw-r--r--pkgs/tools/audio/mpdcron/gemset.nix13
2 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/tools/audio/mpdcron/fix-canonicalize-conflict-with-glibc.patch b/pkgs/tools/audio/mpdcron/fix-canonicalize-conflict-with-glibc.patch
new file mode 100644
index 0000000000000..dd89f89984985
--- /dev/null
+++ b/pkgs/tools/audio/mpdcron/fix-canonicalize-conflict-with-glibc.patch
@@ -0,0 +1,22 @@
+diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c
+index 1d2119c8..c1c87713 100644
+--- a/ext/nokogiri/xml_document.c
++++ b/ext/nokogiri/xml_document.c
+@@ -492,7 +492,7 @@ static int block_caller(void * ctx, xmlNodePtr _node, xmlNodePtr _parent)
+  * The block must return a non-nil, non-false value if the +obj+ passed in
+  * should be included in the canonicalized document.
+  */
+-static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
++static VALUE nokogiri_xml_document_canonicalize(int argc, VALUE* argv, VALUE self)
+ {
+   VALUE mode;
+   VALUE incl_ns;
+@@ -573,7 +573,7 @@ void init_xml_document()
+   rb_define_method(klass, "encoding", encoding, 0);
+   rb_define_method(klass, "encoding=", set_encoding, 1);
+   rb_define_method(klass, "version", version, 0);
+-  rb_define_method(klass, "canonicalize", canonicalize, -1);
++  rb_define_method(klass, "nokogiri_xml_document_canonicalize", canonicalize, -1);
+   rb_define_method(klass, "dup", duplicate_document, -1);
+   rb_define_method(klass, "url", url, 0);
+   rb_define_method(klass, "create_entity", create_entity, -1);
diff --git a/pkgs/tools/audio/mpdcron/gemset.nix b/pkgs/tools/audio/mpdcron/gemset.nix
index 836878c9d88ad..ee254bb6354b7 100644
--- a/pkgs/tools/audio/mpdcron/gemset.nix
+++ b/pkgs/tools/audio/mpdcron/gemset.nix
@@ -18,6 +18,19 @@
       sha256 = "02bjydih0j515szfv9mls195cvpyidh6ixm7dwbl3s2sbaxxk5s4";
       type = "gem";
     };
+
+    dontBuild = false;
+    patches = [
+      # Fixes a naming conflict of nokogiri's `canonicalize` function
+      # with one defined in glibc. This has been fixed upstream in 2020
+      # in a much newer version (1.15.5), but through the divergence
+      # of the affected file, the commit isn't directly applicable to
+      # the one packaged here:
+      #
+      # https://github.com/sparklemotion/nokogiri/pull/2106/commits/7a74cdbe4538e964023e5a0fdca58d8af708b91e
+      # https://github.com/sparklemotion/nokogiri/issues/2105
+      ./fix-canonicalize-conflict-with-glibc.patch
+    ];
     version = "1.10.3";
   };
 }