Our port is quite outdated, I don't use it directly, but there are a bunch of
ports
doing so and the last 17.06 from october 2024 fixed a CVE, so here's a big
update
and switch from sourceforge to https://github.com/p7zip-project/p7zip/tags
I had an intermediate update in my tree, for some time, but then forgot about
it...
Anyone who uses this wants to give it a try?
Index: Makefile
===================================================================
RCS file: /cvs/ports/archivers/p7zip/Makefile,v
diff -u -p -r1.51 Makefile
--- Makefile 7 Nov 2023 14:19:18 -0000 1.51
+++ Makefile 12 Jan 2025 17:52:08 -0000
@@ -1,39 +1,32 @@
COMMENT-main= file archiver with high compression ratio
COMMENT-rar= rar modules for p7zip
-V= 16.02
-REVISION-main= 7
-REVISION-rar= 4
-DISTNAME= p7zip_${V}_src_all
-PKGNAME= p7zip-${V}
+DIST_TUPLE= github p7zip-project p7zip v17.06 .
CATEGORIES= archivers
-FIX_EXTRACT_PERMISSIONS = Yes
-
-HOMEPAGE= https://sourceforge.net/projects/p7zip/
# LGPL, except unRar plugin which is licensed as Freeware
PERMIT_PACKAGE= Yes
# uses pledge()
-WANTLIB= m pthread ${COMPILER_LIBCXX}
+WANTLIB= ${COMPILER_LIBCXX} m pthread iconv
WANTLIB-main= ${WANTLIB} c
WANTLIB-rar= ${WANTLIB}
-COMPILER = base-clang ports-gcc base-gcc
-
-SITES= ${SITE_SOURCEFORGE:=p7zip/}
-EXTRACT_SUFX= .tar.bz2
+COMPILER = base-clang ports-gcc
MULTI_PACKAGES= -main -rar
+LIB_DEPENDS= converters/libiconv
RUN_DEPENDS-rar= ${BASE_PKGPATH},-main
-WRKDIST= ${WRKDIR}/p7zip_${V}
+CXXFLAGS+= -I/usr/local/include
+LDFLAGS+= -L/usr/local/lib -liconv
USE_GMAKE= Yes
MAKE_FILE= makefile
MAKE_FLAGS= MYCC="${CC}" MYCXX="${CXX}" \
- MYCFLAGS="${CFLAGS}" MYCXXFLAGS="${CXXFLAGS}"
+ MYCFLAGS="${CFLAGS}" MYCXXFLAGS="${CXXFLAGS}" \
+ LDFLAGS="${LDFLAGS}"
ALL_TARGET= all3
TEST_TARGET= all_test
@@ -45,5 +38,7 @@ do-install:
@cd ${WRKBUILD} && ${SETENV} ${MAKE_ENV} PREFIX=${TRUEPREFIX} \
DESTDIR=${DESTDIR} /bin/sh install.sh
@chmod -R u=rwX,g=rX ${PREFIX}/share/doc/p7zip
+ ${INSTALL_DATA_DIR} ${PREFIX}/man/man1/
+ ${INSTALL_DATA} ${WRKSRC}/man1/*.1 ${PREFIX}/man/man1/
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/archivers/p7zip/distinfo,v
diff -u -p -r1.17 distinfo
--- distinfo 14 Aug 2016 16:29:20 -0000 1.17
+++ distinfo 12 Jan 2025 17:42:02 -0000
@@ -1,2 +1,2 @@
-SHA256 (p7zip_16.02_src_all.tar.bz2) =
XrIKwOKUT2y5wtUd1sRRiUHBhTR9QInqiQh//dbiNB8=
-SIZE (p7zip_16.02_src_all.tar.bz2) = 4239909
+SHA256 (p7zip-project-p7zip-v17.06.tar.gz) =
w1ZAAg6PBEtCXZwY4YCP+SBtx8r3fJcg9X6whJ1xTNE=
+SIZE (p7zip-project-p7zip-v17.06.tar.gz) = 6722070
Index: patches/patch-CPP_7zip_Archive_7z_7zIn_cpp
===================================================================
RCS file: patches/patch-CPP_7zip_Archive_7z_7zIn_cpp
diff -N patches/patch-CPP_7zip_Archive_7z_7zIn_cpp
--- patches/patch-CPP_7zip_Archive_7z_7zIn_cpp 11 Mar 2022 18:16:22 -0000
1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-For CVE-2016-9296, from 7zip's developer Igor Pavlov
-
---- CPP/7zip/Archive/7z/7zIn.cpp.orig Sun Nov 20 09:29:41 2016
-+++ CPP/7zip/Archive/7z/7zIn.cpp Sun Nov 20 09:31:22 2016
-@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
- if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
- ThrowIncorrect();
- }
-- HeadersSize += folders.PackPositions[folders.NumPackStreams];
-+ if (folders.PackPositions)
-+ HeadersSize += folders.PackPositions[folders.NumPackStreams];
- return S_OK;
- }
-
Index: patches/patch-CPP_7zip_Archive_Wim_WimHandler_cpp
===================================================================
RCS file: patches/patch-CPP_7zip_Archive_Wim_WimHandler_cpp
diff -N patches/patch-CPP_7zip_Archive_Wim_WimHandler_cpp
--- patches/patch-CPP_7zip_Archive_Wim_WimHandler_cpp 6 Sep 2023 19:48:45
-0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-error: ISO C++17 does not allow incrementing expression of type bool
[-Wincrement-bool]
-
-Index: CPP/7zip/Archive/Wim/WimHandler.cpp
---- CPP/7zip/Archive/Wim/WimHandler.cpp.orig
-+++ CPP/7zip/Archive/Wim/WimHandler.cpp
-@@ -298,7 +298,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propI
-
- AString res;
-
-- bool numMethods = 0;
-+ unsigned numMethods = 0;
- for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++)
- {
- if (methodMask & ((UInt32)1 << i))
Index: patches/patch-CPP_7zip_UI_Console_Main_cpp
===================================================================
RCS file:
/cvs/ports/archivers/p7zip/patches/patch-CPP_7zip_UI_Console_Main_cpp,v
diff -u -p -r1.6 patch-CPP_7zip_UI_Console_Main_cpp
--- patches/patch-CPP_7zip_UI_Console_Main_cpp 11 Mar 2022 18:16:22 -0000
1.6
+++ patches/patch-CPP_7zip_UI_Console_Main_cpp 19 Feb 2024 20:34:25 -0000
@@ -1,8 +1,9 @@
Pledge archivers/p7zip main executables
---- CPP/7zip/UI/Console/Main.cpp.orig Sat Oct 17 11:20:22 2015
-+++ CPP/7zip/UI/Console/Main.cpp Sun Jan 24 21:51:01 2016
-@@ -484,6 +484,20 @@ int Main2(
+Index: CPP/7zip/UI/Console/Main.cpp
+--- CPP/7zip/UI/Console/Main.cpp.orig
++++ CPP/7zip/UI/Console/Main.cpp
+@@ -485,6 +485,20 @@ int Main2(
#endif
)
{
@@ -23,7 +24,7 @@ Pledge archivers/p7zip main executables
#if defined(_WIN32) && !defined(UNDER_CE)
SetFileApisToOEM();
#endif
-@@ -580,6 +594,19 @@ int Main2(
+@@ -581,6 +595,19 @@ int Main2(
codecs->CaseSensitive = options.CaseSensitive;
ThrowException_if_Error(codecs->Load());
@@ -43,7 +44,7 @@ Pledge archivers/p7zip main executables
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
if (codecs->Formats.Size() == 0 &&
-@@ -636,6 +663,16 @@ int Main2(
+@@ -637,6 +664,16 @@ int Main2(
if (options.Command.CommandType == NCommandType::kInfo)
{
@@ -60,7 +61,7 @@ Pledge archivers/p7zip main executables
CStdOutStream &so = (g_StdStream ? *g_StdStream : g_StdOut);
unsigned i;
-@@ -802,6 +839,16 @@ int Main2(
+@@ -803,6 +840,16 @@ int Main2(
}
else if (options.Command.CommandType == NCommandType::kBenchmark)
{
@@ -77,7 +78,7 @@ Pledge archivers/p7zip main executables
CStdOutStream &so = (g_StdStream ? *g_StdStream : g_StdOut);
hresultMain = BenchCon(EXTERNAL_CODECS_VARS_L
options.Properties, options.NumIterations, (FILE *)so);
-@@ -869,6 +916,17 @@ int Main2(
+@@ -870,6 +917,17 @@ int Main2(
if (hresultMain == S_OK)
if (isExtractGroupCommand)
{
@@ -95,7 +96,7 @@ Pledge archivers/p7zip main executables
CExtractCallbackConsole *ecs = new CExtractCallbackConsole;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
-@@ -1029,6 +1087,16 @@ int Main2(
+@@ -1030,6 +1088,16 @@ int Main2(
}
else
{
@@ -112,7 +113,7 @@ Pledge archivers/p7zip main executables
UInt64 numErrors = 0;
UInt64 numWarnings = 0;
-@@ -1139,6 +1207,16 @@ int Main2(
+@@ -1140,6 +1208,16 @@ int Main2(
}
else if (options.Command.CommandType == NCommandType::kHash)
{
Index: patches/patch-CPP_Windows_ErrorMsg_cpp
===================================================================
RCS file: patches/patch-CPP_Windows_ErrorMsg_cpp
diff -N patches/patch-CPP_Windows_ErrorMsg_cpp
--- patches/patch-CPP_Windows_ErrorMsg_cpp 11 Mar 2022 18:16:22 -0000
1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-Index: CPP/Windows/ErrorMsg.cpp
---- CPP/Windows/ErrorMsg.cpp.orig
-+++ CPP/Windows/ErrorMsg.cpp
-@@ -13,7 +13,7 @@ UString MyFormatMessage(DWORD errorCode)
- const char * txt = 0;
- AString msg;
-
-- switch(errorCode) {
-+ switch(static_cast<int>(errorCode)) {
- case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
Index: patches/patch-install_sh
===================================================================
RCS file: /cvs/ports/archivers/p7zip/patches/patch-install_sh,v
diff -u -p -r1.5 patch-install_sh
--- patches/patch-install_sh 11 Mar 2022 18:16:22 -0000 1.5
+++ patches/patch-install_sh 19 Feb 2024 20:34:25 -0000
@@ -1,5 +1,6 @@
---- install.sh.orig Tue Oct 20 17:17:32 2015
-+++ install.sh Tue Oct 20 17:19:39 2015
+Index: install.sh
+--- install.sh.orig
++++ install.sh
@@ -16,14 +16,14 @@ installShared()
}
@@ -17,7 +18,7 @@
[ "$1" ] && DEST_BIN="$1"
[ "$2" ] && DEST_SHARE="$2"
[ "$3" ] && DEST_MAN="$3"
-@@ -177,11 +177,14 @@ fi
+@@ -181,11 +181,14 @@ fi
if [ -d DOC ]
then
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/archivers/p7zip/pkg/PLIST-main,v
diff -u -p -r1.12 PLIST-main
--- pkg/PLIST-main 11 Mar 2022 18:16:22 -0000 1.12
+++ pkg/PLIST-main 12 Jan 2025 17:49:16 -0000
@@ -3,7 +3,7 @@ bin/7za
bin/7zr
lib/p7zip/
@bin lib/p7zip/7z
-lib/p7zip/7z.so
+@so lib/p7zip/7z.so
@bin lib/p7zip/7zCon.sfx
@bin lib/p7zip/7za
@bin lib/p7zip/7zr
@@ -17,6 +17,7 @@ share/doc/p7zip/DOC/7zC.txt
share/doc/p7zip/DOC/7zFormat.txt
share/doc/p7zip/DOC/License.txt
share/doc/p7zip/DOC/MANUAL/
+share/doc/p7zip/DOC/MANUAL/7-zip.chm
share/doc/p7zip/DOC/MANUAL/cmdline/
share/doc/p7zip/DOC/MANUAL/cmdline/commands/
share/doc/p7zip/DOC/MANUAL/cmdline/commands/add.htm
@@ -100,6 +101,8 @@ share/doc/p7zip/DOC/MANUAL/general/thank
share/doc/p7zip/DOC/MANUAL/start.htm
share/doc/p7zip/DOC/MANUAL/style.css
share/doc/p7zip/DOC/Methods.txt
+share/doc/p7zip/DOC/Struct.EAP
+share/doc/p7zip/DOC/Struct.ldb
share/doc/p7zip/DOC/copying.txt
share/doc/p7zip/DOC/lzma.txt
share/doc/p7zip/DOC/readme.txt
Index: pkg/PLIST-rar
===================================================================
RCS file: /cvs/ports/archivers/p7zip/pkg/PLIST-rar,v
diff -u -p -r1.5 PLIST-rar
--- pkg/PLIST-rar 11 Mar 2022 18:16:22 -0000 1.5
+++ pkg/PLIST-rar 19 Feb 2024 21:06:25 -0000
@@ -1,2 +1,2 @@
lib/p7zip/Codecs/
-lib/p7zip/Codecs/Rar.so
+@so lib/p7zip/Codecs/Rar.so