diff --git a/misc/far2l/Makefile b/misc/far2l/Makefile index 7025d0a89fd4..cc38f6e6025c 100644 --- a/misc/far2l/Makefile +++ b/misc/far2l/Makefile @@ -1,68 +1,70 @@ PORTNAME= far2l PORTVERSION= 2.7.0 +PORTREVISION= 1 DISTVERSIONPREFIX= v_ CATEGORIES= misc MAINTAINER= danfe@FreeBSD.org COMMENT= Port of FAR v2 to Unix-like systems WWW= https://github.com/elfmz/far2l LICENSE= GPLv2 -LIB_DEPENDS= libuchardet.so:textproc/uchardet +LIB_DEPENDS= libsysinfo.so:devel/libsysinfo \ + libuchardet.so:textproc/uchardet RUN_DEPENDS= bash:shells/bash USE_GITHUB= yes GH_ACCOUNT= elfmz 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 CMAKE_OFF= UNRAR # libarchive handles *.rar files just fine OPTIONS_DEFINE= AWS NFS SFTP SMB WEBDAV WXGTK X11 OPTIONS_DEFAULT= NFS SFTP WEBDAV WXGTK X11 OPTIONS_SUB= yes AWS_DESC= AWS S3 protocol support AWS_LIB_DEPENDS= libaws-cpp-sdk-s3.so:devel/aws-sdk-cpp NFS_LIB_DEPENDS= libnfs.so:net/libnfs SFTP_DESC= SFTP file transfer support SFTP_LIB_DEPENDS= libssh.so:security/libssh SMB_USES= samba:lib WEBDAV_DESC= WebDav protocol support via libneon WEBDAV_LIB_DEPENDS= libneon.so:www/neon WXGTK_CMAKE_OFF= -DUSEWX:BOOL=OFF WXGTK_USE= WX=3.0+ WXGTK_VARS= WANT_WXGTK_VER=2 X11_DESC= Build with TTY X11 extensions X11_CMAKE_OFF= -DTTYX:BOOL=OFF X11_USES= xorg X11_USE= XORG=ice,sm,x11,xext,xi post-patch: @${REINPLACE_CMD} -e \ 's,pkg_search_module\(([[:alpha:]]*\)[^)]*,find_package\1,' \ ${WRKSRC}/CMakeLists.txt @${GREP} -Rl --null --include=\*.cpp /bin/bash ${WRKSRC} | ${XARGS} \ -0 ${REINPLACE_CMD} -e 's,/bin/bash,${LOCALBASE}&,' # Show icon in graphical mode (https://github.com/elfmz/far2l/issues/1143) @${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 diff --git a/misc/far2l/files/patch-far2l_CMakeLists.txt b/misc/far2l/files/patch-far2l_CMakeLists.txt new file mode 100644 index 000000000000..81fa1cdd83bf --- /dev/null +++ b/misc/far2l/files/patch-far2l_CMakeLists.txt @@ -0,0 +1,14 @@ +--- far2l/CMakeLists.txt.orig 2025-10-26 08:39:52 UTC ++++ far2l/CMakeLists.txt +@@ -263,9 +263,11 @@ set_target_properties(far2l + ENABLE_EXPORTS TRUE) + + if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") ++ find_library(SYSINFO_LIBRARY NAMES sysinfo) + target_link_libraries(far2l + PRIVATE ${WINPORT} + PRIVATE c ++ PRIVATE ${SYSINFO_LIBRARY} + PRIVATE ${UCHARDET_LIBRARIES}) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Haiku") + target_link_libraries(far2l diff --git a/misc/far2l/files/patch-far2l_src_farwinapi.cpp b/misc/far2l/files/patch-far2l_src_farwinapi.cpp new file mode 100644 index 000000000000..c5bc3cafab73 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_farwinapi.cpp @@ -0,0 +1,54 @@ +--- far2l/src/farwinapi.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/farwinapi.cpp +@@ -38,6 +38,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S + #include + #include + #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) ++#include + #include + #elif !defined(__HAIKU__) + #include +@@ -472,8 +473,8 @@ bool apiExpandEnvironmentStrings(const wchar_t *src, F + } + + BOOL apiGetVolumeInformation(const wchar_t *lpwszRootPathName, FARString *pVolumeName, +- DWORD64 *lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, +- FARString *pFileSystemName, FARString *pFileSystemMountPoint) ++ FARString *pDiskIdent, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, ++ FARString *pFileSystemName, FARString *pDeviceName, FARString *pFileSystemMountPoint) + { + struct statvfs svfs {}; + const std::string &path = Wide2MB(lpwszRootPathName); +@@ -483,8 +484,6 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP + + if (lpMaximumComponentLength) + *lpMaximumComponentLength = svfs.f_namemax; +- if (lpVolumeSerialNumber) +- *lpVolumeSerialNumber = (DWORD)svfs.f_fsid; + if (lpFileSystemFlags) + *lpFileSystemFlags = (DWORD)svfs.f_flag; + +@@ -507,8 +506,22 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP + if (pFileSystemName) { + *pFileSystemName = MountInfo().GetFileSystem(path); + } +- if (*pFileSystemMountPoint) { ++ if (pFileSystemMountPoint) { + *pFileSystemMountPoint = MountInfo().GetFileSystemMountPoint(lpwszRootPathName); ++ } ++ // XXX: can we avoid calling GetFileSystemMountPoint() twice? ++ const std::string devname = MountInfo().GetFileSystemMountPoint(lpwszRootPathName, true); ++ if (pDeviceName) { ++ *pDeviceName = devname; ++ } ++ if (pDiskIdent) { ++ int fd = open(devname.c_str(), O_RDONLY); ++ if (fd != -1) { ++ char ident[DISK_IDENT_SIZE]; ++ if (ioctl(fd, DIOCGIDENT, ident) != -1) ++ *pDiskIdent = ident; ++ close(fd); ++ } + } + + return TRUE; diff --git a/misc/far2l/files/patch-far2l_src_farwinapi.hpp b/misc/far2l/files/patch-far2l_src_farwinapi.hpp new file mode 100644 index 000000000000..4f7eb9510547 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_farwinapi.hpp @@ -0,0 +1,13 @@ +--- far2l/src/farwinapi.hpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/farwinapi.hpp +@@ -180,8 +180,8 @@ void apiGetTempPath(FARString &strBuffer); + bool apiExpandEnvironmentStrings(const wchar_t *src, FARString &strDest); + + BOOL apiGetVolumeInformation(const wchar_t *lpwszRootPathName, FARString *pVolumeName, +- DWORD64 *lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, +- FARString *pFileSystemName, FARString *pFileSystemMountPoint = nullptr); ++ FARString *pDiskIdent, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, ++ FARString *pFileSystemName, FARString *pDeviceName, FARString *pFileSystemMountPoint); + + void apiFindDataToDataEx(const FAR_FIND_DATA *pSrc, FAR_FIND_DATA_EX *pDest); + diff --git a/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp b/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp new file mode 100644 index 000000000000..3fa268388fd4 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp @@ -0,0 +1,20 @@ +--- far2l/src/mix/MountInfo.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/mix/MountInfo.cpp +@@ -384,7 +384,7 @@ std::string MountInfo::GetFileSystem(const std::string + return out; + } + +-std::string MountInfo::GetFileSystemMountPoint(const wchar_t *lpwsz_path) const ++std::string MountInfo::GetFileSystemMountPoint(const wchar_t *lpwsz_path, bool want_device) const + { + std::string out; + size_t longest_match = 0; +@@ -394,7 +394,7 @@ std::string MountInfo::GetFileSystemMountPoint(const w + for (const auto &it : *_mountpoints) { + if (it.path.size() > longest_match && StrStartsFrom(path, it.path.c_str())) { + longest_match = it.path.size(); +- out = it.path; ++ out = want_device ? it.device : it.path; + } + } + return out; diff --git a/misc/far2l/files/patch-far2l_src_mix_MountInfo.h b/misc/far2l/files/patch-far2l_src_mix_MountInfo.h new file mode 100644 index 000000000000..f8dd9beb1695 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_mix_MountInfo.h @@ -0,0 +1,11 @@ +--- far2l/src/mix/MountInfo.h.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/mix/MountInfo.h +@@ -40,7 +40,7 @@ class MountInfo (public) + + std::string GetFileSystem(const std::string &path) const; + +- std::string GetFileSystemMountPoint(const wchar_t *lpwsz_path) const; ++ std::string GetFileSystemMountPoint(const wchar_t *lpwsz_path, bool want_device = false) const; + + /// Returns true if path fine to be used multi-threaded-ly + bool IsMultiThreadFriendly(const std::string &path) const; diff --git a/misc/far2l/files/patch-far2l_src_panels_infolist.cpp b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp new file mode 100644 index 000000000000..f3b70d2fc3bc --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp @@ -0,0 +1,47 @@ +--- far2l/src/panels/infolist.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/panels/infolist.cpp +@@ -62,7 +62,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S + // # include + #include + #include +-#elif !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__HAIKU__) ++#elif !defined(__DragonFly__) && !defined(__HAIKU__) + #include + #endif + #include +@@ -171,8 +171,7 @@ void InfoList::DisplayObject() + // FARString strDriveRoot; + FARString strVolumeName, strFileSystemName, strFileSystemMountPoint; + DWORD MaxNameLength, FileSystemFlags; +- DWORD64 VolumeNumber; +- FARString strDiskNumber; ++ FARString strDeviceName, strDiskNumber; // Serial Number, really. + CloseFile(); + ClearTitles(); + +@@ -223,13 +222,11 @@ void InfoList::DisplayObject() + ConvertNameToReal(strCurDir, strRealDir); + + fprintf(stderr, "apiGetVolumeInformation: %ls\n", strRealDir.CPtr()); +- bool b_info = apiGetVolumeInformation(strRealDir, &strVolumeName, &VolumeNumber, &MaxNameLength, &FileSystemFlags, +- &strFileSystemName, &strFileSystemMountPoint); ++ bool b_info = apiGetVolumeInformation(strRealDir, &strVolumeName, &strDiskNumber, &MaxNameLength, &FileSystemFlags, ++ &strFileSystemName, &strDeviceName, &strFileSystemMountPoint); + if (b_info) { + // strTitle=FARString(L" ")+DiskType+L" "+Msg::InfoDisk+L" "+(strDriveRoot)+L" ("+strFileSystemName+L") "; +- strTitle = L"(" + strFileSystemName + L")"; +- +- strDiskNumber.Format(L"%08X-%08X", (DWORD)(VolumeNumber >> 32), (DWORD)(VolumeNumber & 0xffffffff)); ++ strTitle = strDeviceName + L" (" + strFileSystemName + L")"; + } else // Error! + strTitle = strCurDir; // strDriveRoot; + +@@ -444,7 +441,7 @@ void InfoList::DisplayObject() + PrintInfo(strOutStr); + } + +-#elif !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__HAIKU__) ++#elif !defined(__DragonFly__) && !defined(__HAIKU__) + struct sysinfo si = {}; + if (sysinfo(&si) == 0) { + DWORD dwMemoryLoad = 100 - ToPercent64(si.freeram + si.freeswap, si.totalram + si.totalswap);