Subject: [bug#72470] [PATCH] gnu: Transmission: Update to 4.0.6.

From: Leo Famulari <[email-masked]>
Date: Sun, 4 Aug 2024 15:08:33 -0400

* gnu/packages/bittorrent.scm (transmission): Update to 4.0.6.
[source]: Use the new patch.
[arguments]: Adjust the custom build phase 'remove-kernel-version' for 4.0.6.
* gnu/packages/patches/transmission-4.0.5-fix-build.patch: Delete file.
* gnu/packages/patches/transmission-4.0.6-fix-build.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.

Change-Id: Id546b8537f48afd50bb00183abf7821ad7601fe9
---
 gnu/local.mk                                  |   2 +-
 gnu/packages/bittorrent.scm                   |  10 +-
 .../transmission-4.0.5-fix-build.patch        |  39 ---
 .../transmission-4.0.6-fix-build.patch        | 275 ++++++++++++++++++
 4 files changed, 281 insertions(+), 45 deletions(-)
 delete mode 100644 gnu/packages/patches/transmission-4.0.5-fix-build.patch
 create mode 100644 gnu/packages/patches/transmission-4.0.6-fix-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6d2b14e72d..fcf621abd8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2153,7 +2153,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/tofi-32bit-compat.patch			\
   %D%/packages/patches/tpetra-remove-duplicate-using.patch	\
   %D%/packages/patches/transcode-ffmpeg.patch	\
-  %D%/packages/patches/transmission-4.0.5-fix-build.patch	\
+  %D%/packages/patches/transmission-4.0.6-fix-build.patch	\
   %D%/packages/patches/trytond-add-egg-modules-to-path.patch	\
   %D%/packages/patches/trytond-add-guix_trytond_path.patch	\
   %D%/packages/patches/ttf2eot-cstddef.patch			\
diff --git a/gnu/packages/bittorrent.scm b/gnu/packages/bittorrent.scm
index a5a772bd5b..195b95a984 100644
--- a/gnu/packages/bittorrent.scm
+++ b/gnu/packages/bittorrent.scm
@@ -87,16 +87,16 @@ (define-module (gnu packages bittorrent)
 (define-public transmission
   (package
     (name "transmission")
-    (version "4.0.5")
+    (version "4.0.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/transmission/transmission"
                                   "/releases/download/" version "/transmission-"
                                   version ".tar.xz"))
-              (patches (search-patches "transmission-4.0.5-fix-build.patch"))
+              (patches (search-patches "transmission-4.0.6-fix-build.patch"))
               (sha256
                (base32
-                "0mv3ds3bbp1fbmdlrjinmzvk46acpafydirh7h2014j7988zys7x"))))
+                "0py4n33wk2srdfrcd5rbrbg5p1zq6nipghlins01d693i9nzwf1a"))))
     (build-system cmake-build-system)
     (outputs '("out"                      ; library and command-line interface
                "gui"))                    ; graphical user interface
@@ -109,10 +109,10 @@ (define-public transmission
                     (guix build utils))
         #:phases
         #~(modify-phases %standard-phases
-         ;; Avoid embedding kernel version for reproducible build
+           ;; Avoid embedding kernel version for reproducible build
            (add-after 'unpack 'remove-kernel-version
              (lambda _
-               (substitute* "third-party/miniupnpc/updateminiupnpcstrings.sh"
+               (substitute* "third-party/miniupnp/miniupnpc/updateminiupnpcstrings.sh"
                  (("OS_VERSION=`uname -r`") "OS_VERSION=Guix"))))
            (replace 'check
              (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
diff --git a/gnu/packages/patches/transmission-4.0.5-fix-build.patch b/gnu/packages/patches/transmission-4.0.5-fix-build.patch
deleted file mode 100644
index 7eeb0f1921..0000000000
--- a/gnu/packages/patches/transmission-4.0.5-fix-build.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Fix the build with gtkmm 4:
-
-https://github.com/transmission/transmission/issues/6392
-
-Patch copied from upstream source repository:
-
-https://github.com/transmission/transmission/commit/e116672b27b314d54514c96b1fa7aef1dee900b1
-
-From e116672b27b314d54514c96b1fa7aef1dee900b1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C5=93ur?= <[email-masked]>
-Date: Sun, 17 Dec 2023 16:37:35 +0100
-Subject: [PATCH] fix: build error on  GTKMM-4 (#6393)
-
----
- gtk/OptionsDialog.cc | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/gtk/OptionsDialog.cc b/gtk/OptionsDialog.cc
-index 08198540c10..8c28fc76f98 100644
---- a/gtk/OptionsDialog.cc
-+++ b/gtk/OptionsDialog.cc
-@@ -338,7 +338,16 @@ void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<S
-         bool const do_prompt = get_choice(std::string(ShowOptionsDialogChoice)) == "true";
-         bool const do_notify = false;
- 
--        auto const files = IF_GTKMM4(get_files2, get_files)();
-+#if GTKMM_CHECK_VERSION(4, 0, 0)
-+        auto files = std::vector<Glib::RefPtr<Gio::File>>();
-+        auto files_model = get_files();
-+        for (auto i = guint{ 0 }; i < files_model->get_n_items(); ++i)
-+        {
-+            files.push_back(gtr_ptr_dynamic_cast<Gio::File>(files_model->get_object(i)));
-+        }
-+#else
-+        auto const files = get_files();
-+#endif
-         g_assert(!files.empty());
- 
-         /* remember this folder the next time we use this dialog */
diff --git a/gnu/packages/patches/transmission-4.0.6-fix-build.patch b/gnu/packages/patches/transmission-4.0.6-fix-build.patch
new file mode 100644
index 0000000000..18ac505459
--- /dev/null
+++ b/gnu/packages/patches/transmission-4.0.6-fix-build.patch
@@ -0,0 +1,275 @@
+The release tarball of Transmission 4.0.6 fails to build:
+
+https://github.com/transmission/transmission/issues/6873
+
+This patch, which is adapted from upstream source repository, fixes that
+problem:
+
+https://github.com/transmission/transmission/commit/a72a93764e556da6b45d086162e8bc941277ab0d
+
+From a72a93764e556da6b45d086162e8bc941277ab0d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?C=C5=93ur?= <[email-masked]>
+Date: Sat, 16 Mar 2024 07:19:51 +0800
+Subject: [PATCH] deps: update miniupnp to 2.3.4 (miniupnpc 2.2.6) (#6459)
+
+* refactor: add miniupnp 2.3.0 as a submodule
+
+* refactor: remove miniupnpc submodule
+
+* deps: specify the 2.3.0 branch
+
+* build: point to miniupnp monorepo subdirectory miniupnpc
+
+* Fix building miniupnp from Xcode
+
+* fixed miniupnp updateminiupnpcstrings.sh usage
+
+* updating to miniupnpc 2.2.6
+
+* fix build for Windows
+
+* code review: removing the header move
+
+---------
+
+Co-authored-by: Charles Kerr <[email-masked]>
+---
+ .gitmodules                            |  7 +-
+ CMakeLists.txt                         | 13 +++-
+ Transmission.xcodeproj/project.pbxproj | 95 ++++++++++++++++----------
+ third-party/miniupnp                   |  1 +
+ third-party/miniupnpc                  |  1 -
+ 5 files changed, 74 insertions(+), 43 deletions(-)
+ create mode 160000 third-party/miniupnp
+ delete mode 160000 third-party/miniupnpc
+
+#diff --git a/.gitmodules b/.gitmodules
+#index 07c4836a7..c81390096 100644
+#--- a/.gitmodules
+#+++ b/.gitmodules
+#@@ -18,10 +18,9 @@
+# 	path = third-party/libutp
+# 	url = https://github.com/transmission/libutp
+# 	branch = post-3.4-transmission
+#-[submodule "third-party/miniupnpc"]
+#-	path = third-party/miniupnpc
+#-	url = https://github.com/transmission/miniupnpc
+#-	branch = post-2.0.20170509-transmission
+#+[submodule "third-party/miniupnp"]
+#+	path = third-party/miniupnp
+#+	url = https://github.com/transmission/miniupnp.git
+# [submodule "third-party/googletest"]
+# 	path = third-party/googletest
+# 	url = https://github.com/google/googletest.git
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d5d667b35..c65fd3dd5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -497,7 +497,13 @@ if(NOT USE_SYSTEM_NATPMP)
+             NATPMP_STATICLIB)
+ endif()
+ 
+-tr_add_external_auto_library(MINIUPNPC miniupnpc miniupnpc
++if(WIN32)
++    # https://github.com/miniupnp/miniupnp/pull/304
++    set(TR_MINIUPNPC_LIBNAME libminiupnpc)
++else()
++    set(TR_MINIUPNPC_LIBNAME miniupnpc)
++endif()
++tr_add_external_auto_library(MINIUPNPC miniupnp/miniupnpc ${TR_MINIUPNPC_LIBNAME}
+     TARGET miniupnpc::libminiupnpc
+     CMAKE_ARGS
+         -DUPNPC_BUILD_STATIC=ON
+@@ -508,9 +514,10 @@ if(NOT USE_SYSTEM_MINIUPNPC)
+         INTERFACE
+             MINIUPNP_STATICLIB)
+ 
+-    set(MINIUPNPC_VERSION 1.9)
+-    set(MINIUPNPC_API_VERSION 12)
++    set(MINIUPNPC_VERSION 2.2)
++    set(MINIUPNPC_API_VERSION 17)
+ endif()
++unset(TR_MINIUPNPC_LIBNAME)
+ 
+ target_compile_definitions(miniupnpc::libminiupnpc
+     INTERFACE
+#diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj
+#index 3282fc02d..0f8f8d85f 100644
+#--- a/Transmission.xcodeproj/project.pbxproj
+#+++ b/Transmission.xcodeproj/project.pbxproj
+#@@ -434,6 +434,8 @@
+# 		C8B27BA328153F6300A22B5D /* create.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC02807FCE900867D3C /* create.cc */; };
+# 		C8B27BA428153F6600A22B5D /* edit.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC22807FCE900867D3C /* edit.cc */; };
+# 		C8B27BA528153F6900A22B5D /* show.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC32807FCE900867D3C /* show.cc */; };
+#+		C8ED0FB1281C10F100B44472 /* addr_is_reserved.c in Sources */ = {isa = PBXBuildFile; fileRef = C8ED0FAF281C10F100B44472 /* addr_is_reserved.c */; };
+#+		C8ED0FB2281C10F100B44472 /* addr_is_reserved.h in Headers */ = {isa = PBXBuildFile; fileRef = C8ED0FB0281C10F100B44472 /* addr_is_reserved.h */; };
+# 		CAB35C64252F6F5E00552A55 /* mime-types.h in Headers */ = {isa = PBXBuildFile; fileRef = CAB35C62252F6F5E00552A55 /* mime-types.h */; };
+# 		CCEBA596277340F6DF9F4480 /* session-alt-speeds.cc in Sources */ = {isa = PBXBuildFile; fileRef = CCEBA596277340F6DF9F4481 /* session-alt-speeds.cc */; };
+# 		CCEBA596277340F6DF9F4482 /* session-alt-speeds.h in Headers */ = {isa = PBXBuildFile; fileRef = CCEBA596277340F6DF9F4483 /* session-alt-speeds.h */; };
+#@@ -1347,6 +1349,8 @@
+# 		C8B27B7F28153F2B00A22B5D /* transmission-create */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-create"; sourceTree = BUILT_PRODUCTS_DIR; };
+# 		C8B27B9028153F3100A22B5D /* transmission-edit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-edit"; sourceTree = BUILT_PRODUCTS_DIR; };
+# 		C8B27BA128153F3400A22B5D /* transmission-show */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-show"; sourceTree = BUILT_PRODUCTS_DIR; };
+#+		C8ED0FAF281C10F100B44472 /* addr_is_reserved.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = addr_is_reserved.c; sourceTree = "<group>"; };
+#+		C8ED0FB0281C10F100B44472 /* addr_is_reserved.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = addr_is_reserved.h; sourceTree = "<group>"; };
+# 		CAB35C62252F6F5E00552A55 /* mime-types.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = "mime-types.h"; sourceTree = "<group>"; };
+# 		CCEBA596277340F6DF9F4481 /* session-alt-speeds.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "session-alt-speeds.cc"; sourceTree = "<group>"; };
+# 		CCEBA596277340F6DF9F4483 /* session-alt-speeds.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = "session-alt-speeds.h"; sourceTree = "<group>"; };
+#@@ -2092,39 +2096,12 @@
+# 		BE1183410CE15DF00002D0F3 /* libminiupnp */ = {
+# 			isa = PBXGroup;
+# 			children = (
+#-				A22B00AE116A9E90003315FC /* connecthostport.c */,
+#-				BE1183610CE160D50002D0F3 /* igd_desc_parse.c */,
+#-				BE1183620CE160D50002D0F3 /* minixml.c */,
+#-				BE1183630CE160D50002D0F3 /* miniwget.c */,
+#-				BE1183640CE160D50002D0F3 /* minissdpc.c */,
+#-				BE1183650CE160D50002D0F3 /* minisoap.c */,
+#-				BE1183660CE160D50002D0F3 /* upnpreplyparse.c */,
+#-				BE1183670CE160D50002D0F3 /* upnpcommands.c */,
+#-				BE1183680CE160D50002D0F3 /* miniupnpc.c */,
+#-				A20162CB13DE497000E15488 /* portlistingparse.c */,
+#-				A20162C713DE48BF00E15488 /* receivedata.c */,
+#-				C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */,
+#-				C12F19771E1AE3C30005E93F /* upnperrors.c */,
+#-				A22B00AF116A9E90003315FC /* connecthostport.h */,
+#-				BE11834E0CE160C50002D0F3 /* miniupnpc_declspec.h */,
+#-				BE11834F0CE160C50002D0F3 /* igd_desc_parse.h */,
+#-				BE1183500CE160C50002D0F3 /* minixml.h */,
+#-				BE1183510CE160C50002D0F3 /* miniwget.h */,
+#-				BE1183520CE160C50002D0F3 /* minisoap.h */,
+# 				A2F8CD420F3D0F4A00DB356A /* miniupnpcstrings.h */,
+#-				A20162CF13DE49E500E15488 /* miniupnpctypes.h */,
+#-				BE1183530CE160C50002D0F3 /* upnpreplyparse.h */,
+#-				BE1183540CE160C50002D0F3 /* upnpcommands.h */,
+#-				BE1183550CE160C50002D0F3 /* miniupnpc.h */,
+#-				BE1183560CE160C50002D0F3 /* minissdpc.h */,
+#-				A25485390EB66CBB004539DA /* codelength.h */,
+#-				A20162CC13DE497000E15488 /* portlistingparse.h */,
+#-				A20162C813DE48BF00E15488 /* receivedata.h */,
+#-				C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */,
+#-				C12F197A1E1AE4460005E93F /* upnperrors.h */,
+#+				C891A007281C02F3002E745F /* include */,
+#+				C8734FB02B9EA39F00EF2AD9 /* src */,
+# 			);
+# 			name = libminiupnp;
+#-			path = "third-party/miniupnpc";
+#+			path = "third-party/miniupnp/miniupnpc";
+# 			sourceTree = "<group>";
+# 		};
+# 		BE75C3570C72A0D600DBEFE0 /* libevent */ = {
+#@@ -2279,6 +2256,51 @@
+# 			name = Compatibility;
+# 			sourceTree = "<group>";
+# 		};
+#+		C8734FB02B9EA39F00EF2AD9 /* src */ = {
+#+			isa = PBXGroup;
+#+			children = (
+#+				C8ED0FAF281C10F100B44472 /* addr_is_reserved.c */,
+#+				A22B00AE116A9E90003315FC /* connecthostport.c */,
+#+				BE1183610CE160D50002D0F3 /* igd_desc_parse.c */,
+#+				BE1183650CE160D50002D0F3 /* minisoap.c */,
+#+				BE1183640CE160D50002D0F3 /* minissdpc.c */,
+#+				BE1183680CE160D50002D0F3 /* miniupnpc.c */,
+#+				BE1183630CE160D50002D0F3 /* miniwget.c */,
+#+				BE1183620CE160D50002D0F3 /* minixml.c */,
+#+				A20162CB13DE497000E15488 /* portlistingparse.c */,
+#+				A20162C713DE48BF00E15488 /* receivedata.c */,
+#+				BE1183670CE160D50002D0F3 /* upnpcommands.c */,
+#+				C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */,
+#+				C12F19771E1AE3C30005E93F /* upnperrors.c */,
+#+				BE1183660CE160D50002D0F3 /* upnpreplyparse.c */,
+#+				C8ED0FB0281C10F100B44472 /* addr_is_reserved.h */,
+#+				A25485390EB66CBB004539DA /* codelength.h */,
+#+				A22B00AF116A9E90003315FC /* connecthostport.h */,
+#+				BE1183520CE160C50002D0F3 /* minisoap.h */,
+#+				BE1183560CE160C50002D0F3 /* minissdpc.h */,
+#+				BE1183500CE160C50002D0F3 /* minixml.h */,
+#+				A20162C813DE48BF00E15488 /* receivedata.h */,
+#+			);
+#+			path = src;
+#+			sourceTree = "<group>";
+#+		};
+#+		C891A007281C02F3002E745F /* include */ = {
+#+			isa = PBXGroup;
+#+			children = (
+#+				BE11834F0CE160C50002D0F3 /* igd_desc_parse.h */,
+#+				BE11834E0CE160C50002D0F3 /* miniupnpc_declspec.h */,
+#+				BE1183550CE160C50002D0F3 /* miniupnpc.h */,
+#+				A20162CF13DE49E500E15488 /* miniupnpctypes.h */,
+#+				BE1183510CE160C50002D0F3 /* miniwget.h */,
+#+				A20162CC13DE497000E15488 /* portlistingparse.h */,
+#+				BE1183540CE160C50002D0F3 /* upnpcommands.h */,
+#+				C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */,
+#+				C12F197A1E1AE4460005E93F /* upnperrors.h */,
+#+				BE1183530CE160C50002D0F3 /* upnpreplyparse.h */,
+#+			);
+#+			path = include;
+#+			sourceTree = "<group>";
+#+		};
+# 		E1B6FBF80C0D719B0015FE4D /* Info Window */ = {
+# 			isa = PBXGroup;
+# 			children = (
+#@@ -2470,6 +2492,7 @@
+# 				BE11835D0CE160C50002D0F3 /* upnpreplyparse.h in Headers */,
+# 				C1BF7BAA1F2A3CCE008E88A7 /* upnpdev.h in Headers */,
+# 				BE1183600CE160C50002D0F3 /* minissdpc.h in Headers */,
+#+				C8ED0FB2281C10F100B44472 /* addr_is_reserved.h in Headers */,
+# 				A254853C0EB66CD4004539DA /* codelength.h in Headers */,
+# 				A2F8CD430F3D0F4A00DB356A /* miniupnpcstrings.h in Headers */,
+# 				A22B00B2116A9E9F003315FC /* connecthostport.h in Headers */,
+#@@ -3027,15 +3050,16 @@
+# 			files = (
+# 			);
+# 			inputPaths = (
+#-				"third-party/miniupnpc/VERSION",
+#-				"third-party/miniupnpc/miniupnpcstrings.h.in",
+#+				"third-party/miniupnp/miniupnpc/VERSION",
+#+				"third-party/miniupnp/miniupnpc/miniupnpcstrings.h.in",
+#+				"third-party/miniupnp/miniupnpc/updateminiupnpcstrings.sh",
+# 			);
+# 			outputPaths = (
+#-				"third-party/miniupnpc/miniupnpcstrings.h",
+#+				"third-party/miniupnp/miniupnpc/miniupnpcstrings.h",
+# 			);
+# 			runOnlyForDeploymentPostprocessing = 0;
+# 			shellPath = /bin/sh;
+#-			shellScript = "cd third-party/miniupnpc\nsh updateminiupnpcstrings.sh \"$SCRIPT_INPUT_FILE_0\" \"$SCRIPT_INPUT_FILE_1\" \"$SCRIPT_OUTPUT_FILE_0\"\n";
+#+			shellScript = "cd third-party/miniupnp/miniupnpc\nsh updateminiupnpcstrings.sh\n";
+# 		};
+# 		BE75C3510C729EE100DBEFE0 /* Copy libevent headers */ = {
+# 			isa = PBXShellScriptBuildPhase;
+#@@ -3067,7 +3091,7 @@
+# 			);
+# 			runOnlyForDeploymentPostprocessing = 0;
+# 			shellPath = /bin/sh;
+#-			shellScript = "cd third-party/miniupnpc && rm -f miniupnp && ln -s . miniupnp\n";
+#+			shellScript = "cd third-party/miniupnp && rm -f miniupnp && ln -s . miniupnp\n";
+# 		};
+# 		C12F197E1E1AE6D50005E93F /* ShellScript */ = {
+# 			isa = PBXShellScriptBuildPhase;
+#@@ -3340,6 +3364,7 @@
+# 				C12F19791E1AE3C30005E93F /* upnperrors.c in Sources */,
+# 				BE11836E0CE160D50002D0F3 /* upnpreplyparse.c in Sources */,
+# 				C1BF7BA81F2A3CB7008E88A7 /* upnpdev.c in Sources */,
+#+				C8ED0FB1281C10F100B44472 /* addr_is_reserved.c in Sources */,
+# 				BE11836F0CE160D50002D0F3 /* upnpcommands.c in Sources */,
+# 				BE1183700CE160D50002D0F3 /* miniupnpc.c in Sources */,
+# 				A22B00B3116A9EA4003315FC /* connecthostport.c in Sources */,
+#diff --git a/third-party/miniupnp b/third-party/miniupnp
+#new file mode 160000
+#index 000000000..faad29d73
+#--- /dev/null
+#+++ b/third-party/miniupnp
+#@@ -0,0 +1 @@
+#+Subproject commit faad29d7300f1bfa9dc7795031993c04c5191f59
+#diff --git a/third-party/miniupnpc b/third-party/miniupnpc
+#deleted file mode 160000
+#index e37cde82e..000000000
+#--- a/third-party/miniupnpc
+#+++ /dev/null
+#@@ -1 +0,0 @@
+#-Subproject commit e37cde82e8673a5e71bae43086828704fd5eeac1
+-- 
+2.45.2
+

base-commit: efb3e63a2293f92f4790f1e3b498113e1128d8d4
-- 
2.45.2