git: dd18cfad31d3 - main - misc/far2l: update the port to version 2.6.4 (aka second chance)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Fri, 22 Nov 2024 10:58:12 UTC
The branch main has been updated by danfe:

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

commit dd18cfad31d3e9c7eb8037389de6f97064f2fa73
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2024-11-22 10:55:22 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2024-11-22 10:55:22 +0000

    misc/far2l: update the port to version 2.6.4 (aka second chance)
    
    - Drop no longer applicable and hopefully no longer needed ARM64
      intrinsic patches as __attribute__((__target__("+crypto"))) now
      apparently works as intended
    - Add somewhat hackish SetIcon() call to the GUI initialization
      routine so users can see the icon in the window title and while
      alt-tabbing through running programs
    - Disable WSL-specific clipboard support code and do not install
      related Windows-only scripts
    - Colorer had been rewritten to use libxml2 instead of Xerces-C
    
    Reported by:    portscout
    Tested on:      ref1{3,4}-aarch64.freebsd.org (clang 18.1.6)
---
 misc/far2l/Makefile                                | 18 +++++++------
 misc/far2l/distinfo                                |  6 ++---
 .../patch-WinPort_src_Backend_WinPortMain.cpp      | 30 ++++++++++++++++++++++
 .../files/patch-multiarc_src_formats_7z_C_AesOpt.c | 12 ---------
 .../patch-multiarc_src_formats_7z_C_CpuArch.c      | 19 --------------
 .../patch-multiarc_src_formats_7z_C_Sha1Opt.c      | 12 ---------
 .../patch-multiarc_src_formats_7z_C_Sha256Opt.c    | 12 ---------
 misc/far2l/pkg-plist                               | 18 +++++++++++--
 8 files changed, 59 insertions(+), 68 deletions(-)

diff --git a/misc/far2l/Makefile b/misc/far2l/Makefile
index 3a6fd9530455..85a7b26d37db 100644
--- a/misc/far2l/Makefile
+++ b/misc/far2l/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	far2l
-PORTVERSION=	2.6.3
+PORTVERSION=	2.6.4
 DISTVERSIONPREFIX=	v_
-PORTREVISION=	1
 CATEGORIES=	misc
 
 MAINTAINER=	danfe@FreeBSD.org
@@ -11,15 +10,15 @@ WWW=		https://github.com/elfmz/far2l
 LICENSE=	GPLv2
 
 LIB_DEPENDS=	libpcre.so:devel/pcre \
-		libuchardet.so:textproc/uchardet \
-		libxerces-c.so:textproc/xerces-c3
+		libuchardet.so:textproc/uchardet
 RUN_DEPENDS=	bash:shells/bash
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	elfmz
 
-USES=		cmake compiler:c++11-lang libarchive perl5 pkgconfig \
-		shebangfix ssl
+USES=		cmake compiler:c++11-lang desktop-file-utils gnome \
+		libarchive perl5 pkgconfig shebangfix ssl
+USE_GNOME=	libxml2
 USE_PERL5=	build
 SHEBANG_FILES=	far2l/bootstrap/view.sh
 
@@ -52,12 +51,15 @@ post-patch:
 	@${REINPLACE_CMD} -e \
 		's,pkg_search_module\(([[:alpha:]]*\)[^)]*,find_package\1,' \
 			${WRKSRC}/CMakeLists.txt
-	@${REINPLACE_CMD} -e 's,^if (fmt_FOUND,& AND FALSE,' \
-		${WRKSRC}/colorer/CMakeLists.txt
 	@${GREP} -Rl --null --include=\*.cpp /bin/bash ${WRKSRC} | ${XARGS} \
 		-0 ${REINPLACE_CMD} -e 's,/bin/bash,${LOCALBASE}&,'
+	@${REINPLACE_CMD} -e '/SetBackgroundColour/ { x; \
+		s|^|SetIcon(wxIcon(wxStandardPaths::Get().GetInstallPrefix()\
+		+ "/share/icons/far2l.svg", wxBITMAP_TYPE_ICO));|; H; x; }' \
+			${WRKSRC}/WinPort/src/Backend/WX/wxMain.cpp
 
 post-stage:
 	${RMDIR} ${STAGEDIR}${PREFIX}/lib/far2l/Plugins/NetRocks/plug/SHELL
+	${RM} ${STAGEDIR}${DATADIR}/wslgclip.*
 
 .include <bsd.port.mk>
diff --git a/misc/far2l/distinfo b/misc/far2l/distinfo
index 8d36dc67ad6d..9ad4179dea8d 100644
--- a/misc/far2l/distinfo
+++ b/misc/far2l/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1721934377
-SHA256 (elfmz-far2l-v_2.6.3_GH0.tar.gz) = ffb216a4f9b24bb45a2194d5e833c60334a4f4e9150c1ce0fc8eddffa6a9e173
-SIZE (elfmz-far2l-v_2.6.3_GH0.tar.gz) = 6730071
+TIMESTAMP = 1731913079
+SHA256 (elfmz-far2l-v_2.6.4_GH0.tar.gz) = 49bf67dd5cb2069b1212ff3256d85123ceaee74470bedeef9ef1836582e4a5bc
+SIZE (elfmz-far2l-v_2.6.4_GH0.tar.gz) = 6854330
diff --git a/misc/far2l/files/patch-WinPort_src_Backend_WinPortMain.cpp b/misc/far2l/files/patch-WinPort_src_Backend_WinPortMain.cpp
new file mode 100644
index 000000000000..3d2eb56e0951
--- /dev/null
+++ b/misc/far2l/files/patch-WinPort_src_Backend_WinPortMain.cpp
@@ -0,0 +1,30 @@
+--- WinPort/src/Backend/WinPortMain.cpp.orig	2024-11-18 06:57:59 UTC
++++ WinPort/src/Backend/WinPortMain.cpp
+@@ -480,6 +480,7 @@ extern "C" int WinPortMain(const char *full_exe_path, 
+ #endif
+ 	}
+ 
++#ifdef __linux__
+ 	bool wsl_clipboard_workaround = (arg_opts.ext_clipboard.empty()
+ 		&& getenv("WSL_DISTRO_NAME")
+ 		&& !getenv("FAR2L_WSL_NATIVE"));
+@@ -498,6 +499,7 @@ extern "C" int WinPortMain(const char *full_exe_path, 
+ 			arg_opts.ext_clipboard.clear();
+ 		}
+ 	}
++#endif
+ 
+ 	int result = -1;
+ 	if (!arg_opts.tty) {
+@@ -518,9 +520,11 @@ extern "C" int WinPortMain(const char *full_exe_path, 
+ 				if (!WinPortMainBackend_p(&a) ) {
+ 					fprintf(stderr, "Cannot use GUI backend\n");
+ 					arg_opts.tty = !arg_opts.notty;
++#ifdef __linux__
+ 					if (wsl_clipboard_workaround) {
+ 						//arg_opts.ext_clipboard.clear();
+ 					}
++#endif
+ 				}
+ 			} else {
+ 				fprintf(stderr, "Cannot find backend entry point, error %s\n", dlerror());
diff --git a/misc/far2l/files/patch-multiarc_src_formats_7z_C_AesOpt.c b/misc/far2l/files/patch-multiarc_src_formats_7z_C_AesOpt.c
deleted file mode 100644
index e2f318f57b1c..000000000000
--- a/misc/far2l/files/patch-multiarc_src_formats_7z_C_AesOpt.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- multiarc/src/formats/7z/C/AesOpt.c.orig	2023-01-14 23:53:02 UTC
-+++ multiarc/src/formats/7z/C/AesOpt.c
-@@ -537,7 +537,8 @@ VAES_COMPAT_STUB (AesCtr_Code_HW)
- 
- #if defined(__clang__) || defined(__GNUC__)
-   #ifdef MY_CPU_ARM64
--    #define ATTRIB_AES __attribute__((__target__("+crypto")))
-+    #define __ARM_FEATURE_AES
-+    #define ATTRIB_AES __attribute__((__target__("aes")))
-   #else
-     #define ATTRIB_AES __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
-   #endif
diff --git a/misc/far2l/files/patch-multiarc_src_formats_7z_C_CpuArch.c b/misc/far2l/files/patch-multiarc_src_formats_7z_C_CpuArch.c
deleted file mode 100644
index c8af49af90ff..000000000000
--- a/misc/far2l/files/patch-multiarc_src_formats_7z_C_CpuArch.c
+++ /dev/null
@@ -1,19 +0,0 @@
---- multiarc/src/formats/7z/C/CpuArch.c.orig	2023-01-14 23:53:02 UTC
-+++ multiarc/src/formats/7z/C/CpuArch.c
-@@ -422,7 +422,16 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
- 
- #ifdef USE_HWCAP
- 
-+#ifdef __FreeBSD__
-+static unsigned long getauxval(int aux)
-+{
-+  unsigned long auxval = 0;
-+  elf_aux_info(aux, &auxval, sizeof(auxval));
-+  return auxval;
-+}
-+#else
- #include <asm/hwcap.h>
-+#endif
- 
-   #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
-   BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP)  & (HWCAP_  ## name2)) ? 1 : 0; }
diff --git a/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha1Opt.c b/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha1Opt.c
deleted file mode 100644
index 39bb0317e2d6..000000000000
--- a/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha1Opt.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- multiarc/src/formats/7z/C/Sha1Opt.c.orig	2023-01-14 23:53:02 UTC
-+++ multiarc/src/formats/7z/C/Sha1Opt.c
-@@ -234,7 +234,8 @@ void MY_FAST_CALL Sha1_UpdateBlocks_HW(UInt32 state[5]
- 
- #if defined(__clang__) || defined(__GNUC__)
-   #ifdef MY_CPU_ARM64
--    #define ATTRIB_SHA __attribute__((__target__("+crypto")))
-+    #define __ARM_FEATURE_SHA2
-+    #define ATTRIB_SHA __attribute__((__target__("sha2")))
-   #else
-     #define ATTRIB_SHA __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
-   #endif
diff --git a/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha256Opt.c b/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha256Opt.c
deleted file mode 100644
index c36041a3e2cf..000000000000
--- a/misc/far2l/files/patch-multiarc_src_formats_7z_C_Sha256Opt.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- multiarc/src/formats/7z/C/Sha256Opt.c.orig	2023-01-14 23:53:02 UTC
-+++ multiarc/src/formats/7z/C/Sha256Opt.c
-@@ -234,7 +234,8 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[
- 
- #if defined(__clang__) || defined(__GNUC__)
-   #ifdef MY_CPU_ARM64
--    #define ATTRIB_SHA __attribute__((__target__("+crypto")))
-+    #define __ARM_FEATURE_SHA2
-+    #define ATTRIB_SHA __attribute__((__target__("sha2")))
-   #else
-     #define ATTRIB_SHA __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
-   #endif
diff --git a/misc/far2l/pkg-plist b/misc/far2l/pkg-plist
index 12f363a5c123..0231550995ae 100644
--- a/misc/far2l/pkg-plist
+++ b/misc/far2l/pkg-plist
@@ -27,6 +27,8 @@ lib/far2l/far2l_askpass
 lib/far2l/far2l_sudoapp
 %%X11%%lib/far2l/far2l_ttyx.broker
 share/applications/far2l.desktop
+share/applications/far2ledit.desktop
+share/bash-completion/completions/far2l
 %%DATADIR%%/FarBel.lng
 %%DATADIR%%/FarCze.lng
 %%DATADIR%%/FarEng.hlf
@@ -498,6 +500,7 @@ share/applications/far2l.desktop
 %%DATADIR%%/Plugins/filecase/plug/CaseRus.lng
 %%DATADIR%%/Plugins/incsrch/plug/incsrche.hlf
 %%DATADIR%%/Plugins/incsrch/plug/incsrchr.hlf
+%%DATADIR%%/Plugins/incsrch/plug/isrcbel.lng
 %%DATADIR%%/Plugins/incsrch/plug/isrceng.lng
 %%DATADIR%%/Plugins/incsrch/plug/isrcrus.lng
 %%DATADIR%%/Plugins/inside/plug/bel.lng
@@ -523,22 +526,33 @@ share/applications/far2l.desktop
 %%DATADIR%%/trash.sh
 %%DATADIR%%/unmount.sh
 %%DATADIR%%/view.sh
-%%DATADIR%%/wslgclip.sh
-%%DATADIR%%/wslgclip.vbs
 %%DATADIR%%/xlats.ini
 share/icons/far2l.svg
+share/icons/far2ledit.svg
 share/icons/hicolor/1024x1024/apps/far2l.svg
+share/icons/hicolor/1024x1024/apps/far2ledit.svg
 share/icons/hicolor/128x128/apps/far2l.svg
+share/icons/hicolor/128x128/apps/far2ledit.svg
 share/icons/hicolor/16x16/apps/far2l.svg
+share/icons/hicolor/16x16/apps/far2ledit.svg
 share/icons/hicolor/192x192/apps/far2l.svg
+share/icons/hicolor/192x192/apps/far2ledit.svg
 share/icons/hicolor/24x24/apps/far2l.svg
+share/icons/hicolor/24x24/apps/far2ledit.svg
 share/icons/hicolor/256x256/apps/far2l.svg
+share/icons/hicolor/256x256/apps/far2ledit.svg
 share/icons/hicolor/32x32/apps/far2l.svg
+share/icons/hicolor/32x32/apps/far2ledit.svg
 share/icons/hicolor/48x48/apps/far2l.svg
+share/icons/hicolor/48x48/apps/far2ledit.svg
 share/icons/hicolor/512x512/apps/far2l.svg
+share/icons/hicolor/512x512/apps/far2ledit.svg
 share/icons/hicolor/64x64/apps/far2l.svg
+share/icons/hicolor/64x64/apps/far2ledit.svg
 share/icons/hicolor/72x72/apps/far2l.svg
+share/icons/hicolor/72x72/apps/far2ledit.svg
 share/icons/hicolor/96x96/apps/far2l.svg
+share/icons/hicolor/96x96/apps/far2ledit.svg
 share/man/man1/far2l.1.gz
 share/man/ru/man1/far2l.1.gz
 @dir lib/far2l/Plugins/calc/plug/units