git: 27eea3661283 - main - archivers/upx: Update to 4.0.2

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 27 May 2023 04:25:34 UTC
The branch main has been updated by sunpoet:

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

commit 27eea366128326c1b3073a83516c417832621fe6
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-05-27 04:07:10 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-05-27 04:07:10 +0000

    archivers/upx: Update to 4.0.2
    
    - Update WWW
    - Update LICENSE_FILE
    - Add DOCS option
    
    Changes:        https://github.com/upx/upx/releases
---
 archivers/upx/Makefile                             | 28 +++++++---------------
 archivers/upx/distinfo                             |  6 ++---
 archivers/upx/files/patch-src-bele.h               | 22 +++++++++++++++++
 .../{patch-src_miniacc.h => patch-src-miniacc.h}   |  8 +++----
 archivers/upx/files/patch-src-packer.h             | 11 +++++++++
 archivers/upx/files/patch-src_Makefile             | 24 -------------------
 ...c_lzma-sdk_C_7zip_Compress_LZMA_LZMAEncoder.cpp | 11 ---------
 archivers/upx/files/patch-src_p__mach.cpp          | 11 ---------
 archivers/upx/files/patch-src_p__wcle.cpp          | 10 --------
 archivers/upx/files/patch-src_packer.h             | 11 ---------
 archivers/upx/pkg-plist                            |  9 +++++++
 11 files changed, 57 insertions(+), 94 deletions(-)

diff --git a/archivers/upx/Makefile b/archivers/upx/Makefile
index edb0441335ad..09d4e298faf8 100644
--- a/archivers/upx/Makefile
+++ b/archivers/upx/Makefile
@@ -1,37 +1,25 @@
 PORTNAME=	upx
-PORTVERSION=	3.96
+PORTVERSION=	4.0.2
 MASTER_SITES=	https://github.com/upx/upx/releases/download/v${PORTVERSION}/
 CATEGORIES=	archivers
 DISTVERSIONSUFFIX=	-src
 
 MAINTAINER=	sunpoet@FreeBSD.org
 COMMENT=	Ultimate Packer for eXecutables
-WWW=		https://upx.github.io/
+WWW=		https://upx.github.io/ \
+		https://github.com/upx/upx
 
 LICENSE=	GPLv2+
-LICENSE_FILE=	${WRKSRC}/LICENSE
+LICENSE_FILE=	${WRKSRC}/COPYING
 
 LIB_DEPENDS=	libucl.so:archivers/ucl
 
-USES=		cpe gmake perl5 tar:xz
-USE_PERL5=	build
+USES=		cmake compiler:c++17-lang cpe tar:xz
 
-MAKE_ENV=	UPX_UCLDIR=${LOCALBASE} \
-		target=freebsd
-
-PLIST_FILES=	bin/upx \
-		man/man1/upx.1.gz
+CMAKE_ON=	UPX_CONFIG_DISABLE_GITREV UPX_CONFIG_DISABLE_SANITIZE UPX_CONFIG_DISABLE_SELF_PACK_TEST UPX_CONFIG_DISABLE_WERROR
 
 CPE_VENDOR=	upx_project
 
-.include <bsd.port.pre.mk>
-
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
-CFLAGS+=       -Wno-error=unused-but-set-variable
-.endif
-
-do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/src/upx.out ${STAGEDIR}${PREFIX}/bin/upx
-	${INSTALL_MAN} ${WRKSRC}/doc/upx.1 ${STAGEDIR}${PREFIX}/man/man1
+OPTIONS_DEFINE=	DOCS
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/archivers/upx/distinfo b/archivers/upx/distinfo
index 874481cd115e..ce171dad8ab4 100644
--- a/archivers/upx/distinfo
+++ b/archivers/upx/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1643382492
-SHA256 (upx-3.96-src.tar.xz) = 47774df5c958f2868ef550fb258b97c73272cb1f44fe776b798e393465993714
-SIZE (upx-3.96-src.tar.xz) = 792524
+TIMESTAMP = 1684104302
+SHA256 (upx-4.0.2-src.tar.xz) = 1221e725b1a89e06739df27fae394d6bc88aedbe12f137c630ec772522cbc76f
+SIZE (upx-4.0.2-src.tar.xz) = 1191960
diff --git a/archivers/upx/files/patch-src-bele.h b/archivers/upx/files/patch-src-bele.h
new file mode 100644
index 000000000000..782669ce00bb
--- /dev/null
+++ b/archivers/upx/files/patch-src-bele.h
@@ -0,0 +1,22 @@
+--- src/bele.h.orig	2023-01-30 10:18:06 UTC
++++ src/bele.h
+@@ -84,19 +84,6 @@ static forceinline unsigned bswap16(unsigned v) { retu
+ static forceinline unsigned bswap32(unsigned v) { return (unsigned) _byteswap_ulong(v); }
+ static forceinline upx_uint64_t bswap64(upx_uint64_t v) { return _byteswap_uint64(v); }
+ 
+-#else
+-
+-static forceinline constexpr unsigned bswap16(unsigned v) {
+-    // return __builtin_bswap16((upx_uint16_t) (v & 0xffff));
+-    // return (unsigned) __builtin_bswap64((upx_uint64_t) v << 48);
+-    return __builtin_bswap32(v << 16);
+-}
+-static forceinline constexpr unsigned bswap32(unsigned v) {
+-    // return (unsigned) __builtin_bswap64((upx_uint64_t) v << 32);
+-    return __builtin_bswap32(v);
+-}
+-static forceinline constexpr upx_uint64_t bswap64(upx_uint64_t v) { return __builtin_bswap64(v); }
+-
+ #endif
+ 
+ static forceinline constexpr unsigned no_bswap16(unsigned v) {
diff --git a/archivers/upx/files/patch-src_miniacc.h b/archivers/upx/files/patch-src-miniacc.h
similarity index 78%
rename from archivers/upx/files/patch-src_miniacc.h
rename to archivers/upx/files/patch-src-miniacc.h
index 14d017d04880..7fc063df0ac2 100644
--- a/archivers/upx/files/patch-src_miniacc.h
+++ b/archivers/upx/files/patch-src-miniacc.h
@@ -1,8 +1,8 @@
---- src/miniacc.h.orig	2020-01-22 21:29:58 UTC
+--- src/miniacc.h.orig	2023-01-30 10:18:06 UTC
 +++ src/miniacc.h
-@@ -2547,11 +2547,11 @@ ACC_COMPILE_TIME_ASSERT_HEADER(ACC_SIZEOF_PTRDIFF_T ==
- #elif !(ACC_ABI_BIG_ENDIAN) && !(ACC_ABI_LITTLE_ENDIAN)
- #if (ACC_ARCH_ALPHA) && (ACC_ARCH_CRAY_MPP)
+@@ -2563,11 +2563,11 @@ ACC_COMPILE_TIME_ASSERT_HEADER(ACC_SIZEOF_PTRDIFF_T ==
+ #  define ACC_ABI_LITTLE_ENDIAN     1
+ #elif (ACC_ARCH_ALPHA) && (ACC_ARCH_CRAY_MPP)
  #  define ACC_ABI_BIG_ENDIAN        1
 -#elif (ACC_ARCH_IA64) && (ACC_OS_POSIX_LINUX || ACC_OS_WIN64)
 +#elif (ACC_ARCH_IA64) && (ACC_OS_POSIX_LINUX || ACC_OS_POSIX_FREEBSD || ACC_OS_WIN64)
diff --git a/archivers/upx/files/patch-src-packer.h b/archivers/upx/files/patch-src-packer.h
new file mode 100644
index 000000000000..e3b6b2b51240
--- /dev/null
+++ b/archivers/upx/files/patch-src-packer.h
@@ -0,0 +1,11 @@
+--- src/packer.h.orig	2023-01-30 10:18:06 UTC
++++ src/packer.h
+@@ -225,7 +225,7 @@ class Packer { (protected)
+     void addLoader(C, C, C, C, C, C, C, C, C);
+     void addLoader(C, C, C, C, C, C, C, C, C, C);
+ #undef C
+-#if (ACC_CC_CLANG || ACC_CC_GNUC)
++#if 0 && (ACC_CC_CLANG || ACC_CC_GNUC)
+     void addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
+ #else
+     void addLoaderVA(const char *s, ...);
diff --git a/archivers/upx/files/patch-src_Makefile b/archivers/upx/files/patch-src_Makefile
deleted file mode 100644
index 0e8e6d2398ea..000000000000
--- a/archivers/upx/files/patch-src_Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
---- src/Makefile.orig	2017-05-12 11:01:20 UTC
-+++ src/Makefile
-@@ -48,7 +48,7 @@ endif
- # we need UCL and zlib - you can set envvar UPX_UCLDIR
- ifneq ($(wildcard $(UPX_UCLDIR)/include/ucl/ucl.h),)
- INCLUDES += -I$(UPX_UCLDIR)/include
--LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
-+LIBS += -L$(UPX_UCLDIR)/lib
- endif
- LIBS += -lucl -lz
- # LZMA from https://github.com/upx/upx-lzma-sdk
-@@ -62,9 +62,9 @@ CXXFLAGS_OPTIMIZE ?= -O2
- endif
- CXXFLAGS += $(CXXFLAGS_OPTIMIZE)
- # protect against security threats caused by misguided C++ compiler "optimizations"
--ifeq ($(findstring clang,$(CXX)),)
--CXXFLAGS += -fno-delete-null-pointer-checks
--endif
-+# ifeq ($(findstring clang,$(CXX)),)
-+# CXXFLAGS += -fno-delete-null-pointer-checks
-+# endif
- CXXFLAGS += -fno-strict-aliasing -fwrapv
- CXXFLAGS += -funsigned-char
- CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings
diff --git a/archivers/upx/files/patch-src_lzma-sdk_C_7zip_Compress_LZMA_LZMAEncoder.cpp b/archivers/upx/files/patch-src_lzma-sdk_C_7zip_Compress_LZMA_LZMAEncoder.cpp
deleted file mode 100644
index 538ffa48c2c2..000000000000
--- a/archivers/upx/files/patch-src_lzma-sdk_C_7zip_Compress_LZMA_LZMAEncoder.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.cpp.orig	2016-11-20 12:55:06 UTC
-+++ src/lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.cpp
-@@ -968,7 +968,7 @@ HRESULT CEncoder::GetOptimum(UInt32 position, UInt32 &
-         startLen = lenTest + 1;
- 
-       // if (_maxMode)
--        {
-+      {
-           UInt32 lenTest2 = lenTest + 1;
-           UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
-           for (; lenTest2 < limit &&
diff --git a/archivers/upx/files/patch-src_p__mach.cpp b/archivers/upx/files/patch-src_p__mach.cpp
deleted file mode 100644
index 126767d4a562..000000000000
--- a/archivers/upx/files/patch-src_p__mach.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/p_mach.cpp.orig	2020-01-22 21:29:58 UTC
-+++ src/p_mach.cpp
-@@ -467,7 +467,7 @@ PackMachBase<T>::compare_segment_command(void const *c
-     if (a->vmsize)             return -1;  // 'a' is first
-     if (b->vmsize)             return  1;  // 'a' is last
-     // What could remain?
--                               return  0;
-+    return  0;
- }
- 
- #undef PAGE_MASK
diff --git a/archivers/upx/files/patch-src_p__wcle.cpp b/archivers/upx/files/patch-src_p__wcle.cpp
deleted file mode 100644
index 509eda2f9b10..000000000000
--- a/archivers/upx/files/patch-src_p__wcle.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/p_wcle.cpp.orig	2018-08-26 02:58:09 UTC
-+++ src/p_wcle.cpp
-@@ -763,6 +763,7 @@ void PackWcle::decodeEntryTable()
-     }
- 
-     //if (Opt_debug) printf("\n%d entries decoded.\n",n);
-+    UNUSED(n);
- 
-     soentries = ptr_diff(p, ientries) + 1;
-     oentries = ientries;
diff --git a/archivers/upx/files/patch-src_packer.h b/archivers/upx/files/patch-src_packer.h
deleted file mode 100644
index d99e08bd955b..000000000000
--- a/archivers/upx/files/patch-src_packer.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/packer.h.orig	2013-09-30 15:51:00 UTC
-+++ src/packer.h
-@@ -238,7 +238,7 @@ protected:
-     void addLoader(C,C,C,C,C,C,C,C); void addLoader(C,C,C,C,C,C,C,C,C);
-     void addLoader(C,C,C,C,C,C,C,C,C,C);
- #undef C
--#if 1 && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x040100))
-+#if 0 && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x040100))
-     void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
- #else
-     void __acc_cdecl_va addLoaderVA(const char *s, ...);
diff --git a/archivers/upx/pkg-plist b/archivers/upx/pkg-plist
new file mode 100644
index 000000000000..d8edba164677
--- /dev/null
+++ b/archivers/upx/pkg-plist
@@ -0,0 +1,9 @@
+bin/upx
+%%PORTDOCS%%%%DOCSDIR%%/COPYING
+%%PORTDOCS%%%%DOCSDIR%%/LICENSE
+%%PORTDOCS%%%%DOCSDIR%%/NEWS
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/THANKS
+%%PORTDOCS%%%%DOCSDIR%%/upx-doc.html
+%%PORTDOCS%%%%DOCSDIR%%/upx-doc.txt
+share/man/man1/upx.1.gz