git: 96f4c70e705d - 2021Q4 - mail/thunderbird: use libc for res_* functions

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Sun, 12 Dec 2021 22:21:00 UTC
The branch 2021Q4 has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=96f4c70e705daa1fcb81b1dfc7bff9e70cd19088

commit 96f4c70e705daa1fcb81b1dfc7bff9e70cd19088
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2021-12-12 22:04:13 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2021-12-12 22:20:46 +0000

    mail/thunderbird: use libc for res_* functions
    
    thunderbird's javascript code needs more than basic DNS resolution
    (e.g. SRV, TXT, MX lookups) - more than javascript natively has
    (welcome to the web) and builds it's own bindings for libc to use
    the resolver(3) interface. Unlike linux, where the resolver routines
    live in libresolv, FreeBSD has these routines in libc.
    I'm referencing libc.so.7 directly, as this is enough to make this
    code work on 13/amd64 (others should work too) - the official way
    of using libc.so would be much more work (and reimplementing parts
    of the dynamic linker in javascript takes the cake, or something).
    
    This is enough to make adding and using new CalDAV calendars possible;
    other problems might linger and possibly require a better solution.
    
    (cherry picked from commit 9a2174d4e02e859881d336167e1509840e5f2d82)
---
 mail/thunderbird/Makefile                          |  2 +-
 .../files/patch-comm_mail_modules_DNS.jsm          | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/mail/thunderbird/Makefile b/mail/thunderbird/Makefile
index bf13dec6b0b0..85594400250f 100644
--- a/mail/thunderbird/Makefile
+++ b/mail/thunderbird/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	thunderbird
 DISTVERSION=	91.4.0
-PORTREVISION=	1
+PORTREVISION=	3
 CATEGORIES=	mail news net-im
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
 		MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build2/source
diff --git a/mail/thunderbird/files/patch-comm_mail_modules_DNS.jsm b/mail/thunderbird/files/patch-comm_mail_modules_DNS.jsm
new file mode 100644
index 000000000000..e54a883a82f9
--- /dev/null
+++ b/mail/thunderbird/files/patch-comm_mail_modules_DNS.jsm
@@ -0,0 +1,25 @@
+--- comm/mail/modules/DNS.jsm.orig	2021-12-12 21:21:31.875731000 +0100
++++ comm/mail/modules/DNS.jsm	2021-12-12 22:31:04.895700000 +0100
+@@ -38,11 +38,17 @@
+   _open() {
+     function findLibrary() {
+       let lastException = null;
+-      let candidates = [
+-        { name: "resolv.9", suffix: "" },
+-        { name: "resolv", suffix: ".2" },
+-        { name: "resolv", suffix: "" },
+-      ];
++      if(Services.appinfo.OS.toLowerCase() == "freebsd") {
++        let candidates = [
++          { name: "c", suffix: ".7" },
++        ]
++      } else {
++        let candidates = [
++          { name: "resolv.9", suffix: "" },
++          { name: "resolv", suffix: ".2" },
++          { name: "resolv", suffix: "" },
++        ];
++      }
+       let tried = [];
+       for (let candidate of candidates) {
+         try {