From nobody Sat Mar 09 14:18:53 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TsQBk4h8hz5DJC7; Sat, 9 Mar 2024 14:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TsQBk1hDJz48xD; Sat, 9 Mar 2024 14:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709993934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IBi8EsKDgcKz8KrV+ilMeWmX0S0hLMXDCJJrbIR6n48=; b=oXU/ySC3bcYK+7NYHm1W1yPWqV3FdszK9DVu4yxP52YyP2ge17bxb6ze63jBhkv9mFFmHd XYftO2/bE3XgI2ScY/7Xp2z6MpLXICwAScatcfb0ISv697afKjrrqTOQ06Azeyv97PPGU1 X+gO292oaFRwZqCdTOt/SdpRfynoKhfBzA2040xIYcjy4A0Z4R1kJ5mHw/AkK0cUU5UNoc cwVyjcONm9Gn6U4h5KCQnJyWXm1smSR8O129JzNYpbEnviLL412z87kcnp2KiQXP3qqb1b VYx0fySR57o+MYiDEXXfyjT/BjcVovyJJF0JlX1a9D9tEbI88toenBK4cpqruQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709993934; a=rsa-sha256; cv=none; b=No3Gp/fbDIN5ftAqxaz08NAmjar+fEhyXfQq+65LlBSVlUIp6XP42eEC9A3hiwFU4MxLzy o3e/D0pY7o7Wfpwk3gqPwlW9g+JfUxFNb4oebuI+DQWDaEIk+1X+FI0UYd7z2/1nUAcq7a r7s5/ylsRjn2LaCfADMUefoHPLKV8Gd/yIy4Jz9w8nvjx/2xSv8KGveKaVfQ2ZMjP2bO+5 NLL9yKl4FOPYML33s+MOQNOFsxvgn7dCyhxVr0itqIbe/wAfKVynxvaUf95MheJ2PkfiZv FaqRjjYrkHCClJHM//eIkihAvvBcVj4t5XgDSSDd5aEX4hnNS4S5NZOPP25WXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709993934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IBi8EsKDgcKz8KrV+ilMeWmX0S0hLMXDCJJrbIR6n48=; b=waKMElC5Cev8MQ6FQEjcBDbZ3UptfGvMEm/ad69Yy/j9T5EHT84SZqpsoGiFi4K3TEyT0q 5RGf8pFJo+ycbQiLAFpgNiC9sbGcZqM6BtlA4WenLCtH9HViwgyg1xt+ieNOppss7w7lCx 1aSyxbqnmQZ6Jx1PKYVoV0Uck+5umm9o/N3RShhQvzkiegNbXYclfDVxGxsU6RNeoiKltA w50OHw1tsO7+fZ3cA2IoFjDjBjNL/1NzS0wczwNxnotYnk13FlRHDUqTpz+ujDCFbJNvsu NyjEeZNst6oWnKsL+b0B8u+dPmDLXKvSu/kT5Urqa/cCJhyAg4Bk/NYiLqdDQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TsQBk0jQcz15J0; Sat, 9 Mar 2024 14:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 429EIrDv028589; Sat, 9 Mar 2024 14:18:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 429EIrvc028586; Sat, 9 Mar 2024 14:18:53 GMT (envelope-from git) Date: Sat, 9 Mar 2024 14:18:53 GMT Message-Id: <202403091418.429EIrvc028586@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: bc7eae1ab8bd - main - archivers/unrar-iconv: Convert to a normal port List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc7eae1ab8bd1ee08bf850f8ea33955fd8f83cc8 Auto-Submitted: auto-generated The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=bc7eae1ab8bd1ee08bf850f8ea33955fd8f83cc8 commit bc7eae1ab8bd1ee08bf850f8ea33955fd8f83cc8 Author: Po-Chuan Hsieh AuthorDate: 2024-03-09 13:57:19 +0000 Commit: Po-Chuan Hsieh CommitDate: 2024-03-09 14:07:21 +0000 archivers/unrar-iconv: Convert to a normal port Maintainer could refresh the patch and update to newer unrar later. --- archivers/unrar-iconv/Makefile | 38 +++++-- archivers/unrar-iconv/distinfo | 3 + archivers/unrar-iconv/files/patch-os.hpp | 13 +++ archivers/unrar-iconv/files/patch-rijndael.cpp | 136 +++++++++++++++++++++++++ archivers/unrar-iconv/files/patch-rijndael.hpp | 24 +++++ archivers/unrar-iconv/pkg-descr | 6 ++ 6 files changed, 214 insertions(+), 6 deletions(-) diff --git a/archivers/unrar-iconv/Makefile b/archivers/unrar-iconv/Makefile index e7ddb4e6b725..20cecca66e6d 100644 --- a/archivers/unrar-iconv/Makefile +++ b/archivers/unrar-iconv/Makefile @@ -1,21 +1,47 @@ +PORTNAME= unrar +PORTVERSION= 6.24 +PORTEPOCH= 6 +CATEGORIES= archivers +MASTER_SITES= https://www.rarlab.com/rar/ PKGNAMESUFFIX= -iconv +DISTNAME= unrarsrc-6.2.12 MAINTAINER= yarodin@gmail.com +COMMENT= Extract, view & test RAR archives +WWW= https://www.rarlab.com/ -MASTERDIR= ${.CURDIR}/../unrar +LICENSE= UNRAR +LICENSE_NAME= UnRAR license +LICENSE_FILE= ${WRKSRC}/license.txt +LICENSE_PERMS= auto-accept dist-mirror pkg-mirror -EXTRA_PATCHES= ${.CURDIR}/files/patch-iconv +USES= compiler:c++11-lang cpe iconv CPPFLAGS+= -DWITH_ICONV -I${LOCALBASE}/include -LDFLAGS+= -L${LOCALBASE}/lib ${ICONV_LIB} -USES= iconv +LDFLAGS+= -L${LOCALBASE}/lib ${ICONV_LIB} -lpthread +MAKE_ARGS= CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" STRIP="${STRIP_CMD}" +MAKEFILE= makefile +WRKSRC= ${WRKDIR}/unrar + +PLIST_FILES= bin/unrar CONFLICTS_INSTALL= unrar -post-install: +CPE_VENDOR= rarlab + +OPTIONS_DEFINE= OPENSSL_AES +OPTIONS_DEFAULT=OPENSSL_AES +OPENSSL_AES_DESC= Use OpenSSL implementation of AES + +OPENSSL_AES_CPPFLAGS= -DOPENSSL_AES -I${OPENSSLINC} +OPENSSL_AES_LDFLAGS= ${${OPENSSLLIB} == /usr/lib :? :-L${OPENSSLLIB}} -lcrypto +OPENSSL_AES_USES= ssl + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/unrar ${STAGEDIR}${PREFIX}/bin/ @${ECHO_MSG} "===> Added iconv support, see new switches:" @${ECHO_MSG} " la, ll and lo at \"unrar -?\"" @${ECHO_MSG} "===> REMEMBER!!!: Windows rar archives using old DOS encodings as internal encoding." @${ECHO_MSG} " CP866 for russian lang for example." -.include "${MASTERDIR}/Makefile" +.include diff --git a/archivers/unrar-iconv/distinfo b/archivers/unrar-iconv/distinfo new file mode 100644 index 000000000000..34b058ff6cf0 --- /dev/null +++ b/archivers/unrar-iconv/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1703227796 +SHA256 (unrarsrc-6.2.12.tar.gz) = a008b5f949bca9bb4ffa1bebbfc8b3c14b89df10a10354809b845232d5f582e5 +SIZE (unrarsrc-6.2.12.tar.gz) = 246918 diff --git a/archivers/unrar-iconv/files/patch-os.hpp b/archivers/unrar-iconv/files/patch-os.hpp new file mode 100644 index 000000000000..ef633fb42257 --- /dev/null +++ b/archivers/unrar-iconv/files/patch-os.hpp @@ -0,0 +1,13 @@ +--- os.hpp.orig 2023-01-17 16:25:54 UTC ++++ os.hpp +@@ -173,6 +173,10 @@ + #include + + ++#ifdef OPENSSL_AES ++#include ++#endif // OPENSSL_AES ++ + #ifdef S_IFLNK + #define SAVE_LINKS + #endif diff --git a/archivers/unrar-iconv/files/patch-rijndael.cpp b/archivers/unrar-iconv/files/patch-rijndael.cpp new file mode 100644 index 000000000000..92b411d99b5c --- /dev/null +++ b/archivers/unrar-iconv/files/patch-rijndael.cpp @@ -0,0 +1,136 @@ +--- rijndael.cpp.orig 2023-01-17 16:25:54 UTC ++++ rijndael.cpp +@@ -3,6 +3,8 @@ + **************************************************************************/ + #include "rar.hpp" + ++#ifndef OPENSSL_AES ++ + #ifdef USE_SSE + #include + #endif +@@ -75,6 +77,7 @@ inline void Copy128(byte *dest,const byte *src) + #endif + } + ++#endif // OPENSSL_AES + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // API +@@ -82,14 +85,41 @@ inline void Copy128(byte *dest,const byte *src) + + Rijndael::Rijndael() + { ++#ifndef OPENSSL_AES + if (S5[0]==0) + GenerateTables(); ++#endif // OPENSSL_AES + CBCMode = true; // Always true for RAR. + } + + + void Rijndael::Init(bool Encrypt,const byte *key,uint keyLen,const byte * initVector) + { ++#ifdef OPENSSL_AES ++ const EVP_CIPHER *cipher; ++ switch(keyLen) ++ { ++ case 128: ++ cipher = EVP_aes_128_cbc(); ++ break; ++ case 192: ++ cipher = EVP_aes_192_cbc(); ++ break; ++ case 256: ++ cipher = EVP_aes_256_cbc(); ++ break; ++ } ++ ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ EVP_CIPHER_CTX_init(&ctx); ++ EVP_CipherInit_ex(&ctx, cipher, NULL, key, initVector, Encrypt); ++ EVP_CIPHER_CTX_set_padding(&ctx, 0); ++#else ++ EVP_CIPHER_CTX_init(ctx); ++ EVP_CipherInit_ex(ctx, cipher, NULL, key, initVector, Encrypt); ++ EVP_CIPHER_CTX_set_padding(ctx, 0); ++#endif ++#else // OPENSSL_AES + // Check SIMD here instead of constructor, so if object is a part of some + // structure memset'ed before use, these variables are not lost. + #if defined(USE_SSE) +@@ -141,6 +171,7 @@ void Rijndael::Init(bool Encrypt,const byte *key,uint + + if(!Encrypt) + keyEncToDec(); ++#endif // OPENSSL_AES + } + + +@@ -149,6 +180,15 @@ void Rijndael::blockEncrypt(const byte *input,size_t i + if (inputLen <= 0) + return; + ++#ifdef OPENSSL_AES ++ int outLen; ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ EVP_CipherUpdate(&ctx, outBuffer, &outLen, input, inputLen); ++#else ++ EVP_CipherUpdate(ctx, outBuffer, &outLen, input, inputLen); ++#endif ++ return; ++#else // OPENSSL_AES + size_t numBlocks = inputLen/16; + #if defined(USE_SSE) + if (AES_NI) +@@ -213,6 +253,7 @@ void Rijndael::blockEncrypt(const byte *input,size_t i + input += 16; + } + Copy128(m_initVector,prevBlock); ++#endif // OPENSSL_AES + } + + +@@ -288,6 +329,15 @@ void Rijndael::blockDecrypt(const byte *input, size_t + if (inputLen <= 0) + return; + ++#ifdef OPENSSL_AES ++ int outLen; ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ EVP_CipherUpdate(&ctx, outBuffer, &outLen, input, inputLen); ++#else ++ EVP_CipherUpdate(ctx, outBuffer, &outLen, input, inputLen); ++#endif ++ return; ++#else // OPENSSL_AES + size_t numBlocks=inputLen/16; + #if defined(USE_SSE) + if (AES_NI) +@@ -356,6 +406,8 @@ void Rijndael::blockDecrypt(const byte *input, size_t + } + + memcpy(m_initVector,iv,16); ++ ++#endif // OPENSSL_AES + } + + +@@ -426,7 +478,7 @@ void Rijndael::blockDecryptNeon(const byte *input, siz + } + #endif + +- ++#ifndef OPENSSL_AES + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // ALGORITHM + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -555,7 +607,7 @@ void Rijndael::GenerateTables() + U1[b][0]=U2[b][1]=U3[b][2]=U4[b][3]=T5[I][0]=T6[I][1]=T7[I][2]=T8[I][3]=gmul(b,0xe); + } + } +- ++#endif // OPENSSL_AES + + #if 0 + static void TestRijndael(); diff --git a/archivers/unrar-iconv/files/patch-rijndael.hpp b/archivers/unrar-iconv/files/patch-rijndael.hpp new file mode 100644 index 000000000000..0e1ccbfbd379 --- /dev/null +++ b/archivers/unrar-iconv/files/patch-rijndael.hpp @@ -0,0 +1,24 @@ +--- rijndael.hpp.orig 2023-01-17 16:25:54 UTC ++++ rijndael.hpp +@@ -12,6 +12,13 @@ + class Rijndael + { + private: ++#ifdef OPENSSL_AES ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ EVP_CIPHER_CTX ctx; ++#else ++ EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); ++#endif ++#else // OPENSSL_AES + #ifdef USE_SSE + void blockEncryptSSE(const byte *input,size_t numBlocks,byte *outBuffer); + void blockDecryptSSE(const byte *input, size_t numBlocks, byte *outBuffer); +@@ -31,6 +38,7 @@ class Rijndael + void keySched(byte key[_MAX_KEY_COLUMNS][4]); + void keyEncToDec(); + void GenerateTables(); ++#endif // OPENSSL_AES + + // RAR always uses CBC, but we may need to turn it off when calling + // this code from other archive formats with CTR and other modes. diff --git a/archivers/unrar-iconv/pkg-descr b/archivers/unrar-iconv/pkg-descr new file mode 100644 index 000000000000..b69b27a9adbf --- /dev/null +++ b/archivers/unrar-iconv/pkg-descr @@ -0,0 +1,6 @@ +The UnRAR utility is a freeware program, distributed with source code and +developed for extracting, testing and viewing the contents of archives created +with the RAR archiver, version 1.50 and above. + +The UnRAR utility is a minor part of the RAR archiver and contains RAR +uncompression algorithm. UnRAR requires very small volume of memory to operate.