add p7zip

This commit is contained in:
joborun linux 2023-10-26 22:03:22 +03:00
parent dd5a7ac77e
commit 9fb42be836
9 changed files with 328 additions and 0 deletions

71
p7zip/PKGBUILD Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=p7zip
pkgver=17.05
pkgrel=02
epoch=1
pkgdesc="Command-line file archiver with high compression ratio"
url="https://github.com/p7zip-project/p7zip"
depends=('gcc-libs' 'sh')
source=(https://github.com/p7zip-project/p7zip/archive/v$pkgver/$pkgname-v$pkgver.tar.gz
oemcp-iconv.patch::https://github.com/p7zip-project/p7zip/commit/c104127e6a93.patch
oemcp-cygwin.patch::https://github.com/p7zip-project/p7zip/commit/0e0a1a8316b6.patch
oemcp-apple.patch::https://github.com/p7zip-project/p7zip/commit/334a01e3f8bc.patch
do-not-gzip-man-pages.patch)
prepare() {
cd $pkgname-$pkgver
# Leave man page compression to makepkg to maintain reproducibility
patch -Np1 -i ../do-not-gzip-man-pages.patch
# https://github.com/p7zip-project/p7zip/issues/112
patch -Rp1 -i ../oemcp-apple.patch
patch -Rp1 -i ../oemcp-cygwin.patch
patch -Rp1 -i ../oemcp-iconv.patch
}
build() {
cd $pkgname-$pkgver
make OPTFLAGS="$CPPFLAGS $CFLAGS" 7z 7zr 7za
}
package() {
cd $pkgname-$pkgver
make install \
DEST_DIR="$pkgdir" \
DEST_HOME=/usr \
DEST_MAN=/usr/share/man
# Remove documentation for the GUI file manager
rm -r "$pkgdir/usr/share/doc/p7zip/DOC/MANUAL/fm"
install -d "${pkgdir}"/usr/share/licenses/p7zip
ln -s -t "$pkgdir/usr/share/licenses/p7zip/" \
/usr/share/doc/p7zip/DOC/License.txt \
/usr/share/doc/p7zip/DOC/unRarLicense.txt
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('LGPL' 'custom:unRAR')
sha256sums=(d2788f892571058c08d27095c22154579dfefb807ebe357d145ab2ddddefb1a6 # p7zip-v17.05.tar.gz
## 9473e324de6a87d89cb7ff65b0fec4ae3f147f03ffc138189c336a4650d74804 # p7zip-v17.05.tar.gz
50f2068124c1c6adc2d9ccf455e9816eccd39d31920b953ab8fcb853232d452c # oemcp-iconv.patch
789789216ca46e5ea9b6780e353f964a1f46e9a2bcaa6b16413adcf9a89eb374 # oemcp-cygwin.patch
dfe1a625f80078c3ec68038f0aae8ba3a82ea96d0aeb97cb3586dc7fb3ef9650 # oemcp-apple.patch
2179e67764eb46cb414ce9b5c978a532a6499617a6a685deb323b6da122aba00) # do-not-gzip-man-pages.patch
## NOTE Rename 1:17 .. 1_17 for sourceforge compatibility
## b9aea8a0e51cd04b58a8313dc6d29968452194ee4b3c23173610e81f1f9bdc0d p7zip-1_17.05-02-x86_64.pkg.tar.lz

62
p7zip/PKGBUILD-arch Normal file
View File

@ -0,0 +1,62 @@
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Thayer Williams <thayer@archlinux.org>
# Contributor: Hugo Doria <hugo@archlinux.org>
# Contributor: TuxSpirit<tuxspirit@archlinux.fr>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
pkgname=p7zip
pkgver=17.05
pkgrel=2
epoch=1
pkgdesc="Command-line file archiver with high compression ratio"
arch=('x86_64')
url="https://github.com/p7zip-project/p7zip"
license=('LGPL' 'custom:unRAR')
depends=('gcc-libs' 'sh')
source=(https://github.com/p7zip-project/p7zip/archive/v$pkgver/$pkgname-v$pkgver.tar.gz
oemcp-iconv.patch::https://github.com/p7zip-project/p7zip/commit/c104127e6a93.patch
oemcp-cygwin.patch::https://github.com/p7zip-project/p7zip/commit/0e0a1a8316b6.patch
oemcp-apple.patch::https://github.com/p7zip-project/p7zip/commit/334a01e3f8bc.patch
do-not-gzip-man-pages.patch)
sha256sums=('d2788f892571058c08d27095c22154579dfefb807ebe357d145ab2ddddefb1a6'
'50f2068124c1c6adc2d9ccf455e9816eccd39d31920b953ab8fcb853232d452c'
'789789216ca46e5ea9b6780e353f964a1f46e9a2bcaa6b16413adcf9a89eb374'
'dfe1a625f80078c3ec68038f0aae8ba3a82ea96d0aeb97cb3586dc7fb3ef9650'
'2179e67764eb46cb414ce9b5c978a532a6499617a6a685deb323b6da122aba00')
prepare() {
cd $pkgname-$pkgver
# Leave man page compression to makepkg to maintain reproducibility
patch -Np1 -i ../do-not-gzip-man-pages.patch
# https://github.com/p7zip-project/p7zip/issues/112
patch -Rp1 -i ../oemcp-apple.patch
patch -Rp1 -i ../oemcp-cygwin.patch
patch -Rp1 -i ../oemcp-iconv.patch
}
build() {
cd $pkgname-$pkgver
make OPTFLAGS="$CPPFLAGS $CFLAGS" 7z 7zr 7za
}
package() {
cd $pkgname-$pkgver
make install \
DEST_DIR="$pkgdir" \
DEST_HOME=/usr \
DEST_MAN=/usr/share/man
# Remove documentation for the GUI file manager
rm -r "$pkgdir/usr/share/doc/p7zip/DOC/MANUAL/fm"
install -d "${pkgdir}"/usr/share/licenses/p7zip
ln -s -t "$pkgdir/usr/share/licenses/p7zip/" \
/usr/share/doc/p7zip/DOC/License.txt \
/usr/share/doc/p7zip/DOC/unRarLicense.txt
}
# vim:set ts=2 sw=2 et:

1
p7zip/clean Normal file
View File

@ -0,0 +1 @@
rm -rf {src,pkg,p7zip*tar.gz}

2
p7zip/deps Normal file
View File

@ -0,0 +1,2 @@

View File

@ -0,0 +1,14 @@
diff -upr p7zip-17.04.orig/install.sh p7zip-17.04/install.sh
--- p7zip-17.04.orig/install.sh 2021-04-04 06:11:06.000000000 +0300
+++ p7zip-17.04/install.sh 2021-09-08 06:08:22.977304060 +0300
@@ -159,10 +159,6 @@ else
chmod 644 "${DEST_DIR}${DEST_MAN}/man1/7zr.1"
fi
-gzip "${DEST_DIR}${DEST_MAN}/man1/7z.1"
-gzip "${DEST_DIR}${DEST_MAN}/man1/7za.1"
-gzip "${DEST_DIR}${DEST_MAN}/man1/7zr.1"
-
if [ -f README ]
then
echo "- installing ${DEST_DIR}${DEST_SHARE_DOC}/README"

30
p7zip/oemcp-apple.patch Normal file
View File

@ -0,0 +1,30 @@
From 334a01e3f8bcfb6da15352b5a067098ee78709d8 Mon Sep 17 00:00:00 2001
From: jinfeihan57 <38484902+jinfeihan57@users.noreply.github.com>
Date: Wed, 21 Oct 2020 16:36:31 +0800
Subject: [PATCH] fix issue #78
---
CPP/7zip/Archive/Zip/ZipItem.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp
index 37b69933..353e8955 100644
--- a/CPP/7zip/Archive/Zip/ZipItem.cpp
+++ b/CPP/7zip/Archive/Zip/ZipItem.cpp
@@ -1,6 +1,6 @@
// Archive/ZipItem.cpp
-#if (!defined _WIN32) && (!defined __CYGWIN__)
+#if (!defined _WIN32) && (!defined __CYGWIN__) && (!defined __APPLE__)
#include <iconv.h>
#include <locale.h>
#endif
@@ -355,7 +355,7 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo
#endif
}
- #if (!defined _WIN32) && (!defined __CYGWIN__)
+ #if (!defined _WIN32) && (!defined __CYGWIN__) && (!defined __APPLE__)
// Convert OEM char set to UTF-8 if needed
// Use system locale to select code page

30
p7zip/oemcp-cygwin.patch Normal file
View File

@ -0,0 +1,30 @@
From 0e0a1a8316b691de8f1eca8e9520274e00205884 Mon Sep 17 00:00:00 2001
From: hanjinfei <hWX701289@china.huawei.com>
Date: Wed, 22 Jul 2020 03:05:53 +0100
Subject: [PATCH] fix Compilation error on cygwin.
---
CPP/7zip/Archive/Zip/ZipItem.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp
index 7e11b197..37b69933 100644
--- a/CPP/7zip/Archive/Zip/ZipItem.cpp
+++ b/CPP/7zip/Archive/Zip/ZipItem.cpp
@@ -1,6 +1,6 @@
// Archive/ZipItem.cpp
-#ifndef _WIN32
+#if (!defined _WIN32) && (!defined __CYGWIN__)
#include <iconv.h>
#include <locale.h>
#endif
@@ -355,7 +355,7 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo
#endif
}
- #ifndef _WIN32
+ #if (!defined _WIN32) && (!defined __CYGWIN__)
// Convert OEM char set to UTF-8 if needed
// Use system locale to select code page

112
p7zip/oemcp-iconv.patch Normal file
View File

@ -0,0 +1,112 @@
From c104127e6a9364b8d6a1d79012e5249a129c3857 Mon Sep 17 00:00:00 2001
From: unxed <unxed@mail.ru>
Date: Fri, 17 Jul 2020 12:15:53 +0300
Subject: [PATCH] Use system locale to select OEM code page for zip archives
made on dos/windows. Can be overriden with OEMCP environment variable.
---
CPP/7zip/Archive/Zip/ZipItem.cpp | 85 ++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp
index 885a43cd..7e11b197 100644
--- a/CPP/7zip/Archive/Zip/ZipItem.cpp
+++ b/CPP/7zip/Archive/Zip/ZipItem.cpp
@@ -1,5 +1,10 @@
// Archive/ZipItem.cpp
+#ifndef _WIN32
+#include <iconv.h>
+#include <locale.h>
+#endif
+
#include "StdAfx.h"
#include "../../../../C/CpuArch.h"
@@ -350,6 +355,86 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo
#endif
}
+ #ifndef _WIN32
+ // Convert OEM char set to UTF-8 if needed
+ // Use system locale to select code page
+
+ Byte hostOS = GetHostOS();
+ if (!isUtf8 && ((hostOS == NFileHeader::NHostOS::kFAT) || (hostOS == NFileHeader::NHostOS::kNTFS))) {
+
+ const char *oemcp;
+ oemcp = getenv("OEMCP");
+ if (!oemcp) {
+ oemcp = "CP437\0"; // CP name is 6 chars max
+
+ const char *lc_to_cp_table[] = {
+ "af_ZA", "CP850", "ar_SA", "CP720", "ar_LB", "CP720", "ar_EG", "CP720",
+ "ar_DZ", "CP720", "ar_BH", "CP720", "ar_IQ", "CP720", "ar_JO", "CP720",
+ "ar_KW", "CP720", "ar_LY", "CP720", "ar_MA", "CP720", "ar_OM", "CP720",
+ "ar_QA", "CP720", "ar_SY", "CP720", "ar_TN", "CP720", "ar_AE", "CP720",
+ "ar_YE", "CP720","ast_ES", "CP850", "az_AZ", "CP866", "az_AZ", "CP857",
+ "be_BY", "CP866", "bg_BG", "CP866", "br_FR", "CP850", "ca_ES", "CP850",
+ "zh_CN", "CP936", "zh_TW", "CP950", "kw_GB", "CP850", "cs_CZ", "CP852",
+ "cy_GB", "CP850", "da_DK", "CP850", "de_AT", "CP850", "de_LI", "CP850",
+ "de_LU", "CP850", "de_CH", "CP850", "de_DE", "CP850", "el_GR", "CP737",
+ "en_AU", "CP850", "en_CA", "CP850", "en_GB", "CP850", "en_IE", "CP850",
+ "en_JM", "CP850", "en_BZ", "CP850", "en_PH", "CP437", "en_ZA", "CP437",
+ "en_TT", "CP850", "en_US", "CP437", "en_ZW", "CP437", "en_NZ", "CP850",
+ "es_PA", "CP850", "es_BO", "CP850", "es_CR", "CP850", "es_DO", "CP850",
+ "es_SV", "CP850", "es_EC", "CP850", "es_GT", "CP850", "es_HN", "CP850",
+ "es_NI", "CP850", "es_CL", "CP850", "es_MX", "CP850", "es_ES", "CP850",
+ "es_CO", "CP850", "es_ES", "CP850", "es_PE", "CP850", "es_AR", "CP850",
+ "es_PR", "CP850", "es_VE", "CP850", "es_UY", "CP850", "es_PY", "CP850",
+ "et_EE", "CP775", "eu_ES", "CP850", "fa_IR", "CP720", "fi_FI", "CP850",
+ "fo_FO", "CP850", "fr_FR", "CP850", "fr_BE", "CP850", "fr_CA", "CP850",
+ "fr_LU", "CP850", "fr_MC", "CP850", "fr_CH", "CP850", "ga_IE", "CP437",
+ "gd_GB", "CP850", "gv_IM", "CP850", "gl_ES", "CP850", "he_IL", "CP862",
+ "hr_HR", "CP852", "hu_HU", "CP852", "id_ID", "CP850", "is_IS", "CP850",
+ "it_IT", "CP850", "it_CH", "CP850", "iv_IV", "CP437", "ja_JP", "CP932",
+ "kk_KZ", "CP866", "ko_KR", "CP949", "ky_KG", "CP866", "lt_LT", "CP775",
+ "lv_LV", "CP775", "mk_MK", "CP866", "mn_MN", "CP866", "ms_BN", "CP850",
+ "ms_MY", "CP850", "nl_BE", "CP850", "nl_NL", "CP850", "nl_SR", "CP850",
+ "nn_NO", "CP850", "nb_NO", "CP850", "pl_PL", "CP852", "pt_BR", "CP850",
+ "pt_PT", "CP850", "rm_CH", "CP850", "ro_RO", "CP852", "ru_RU", "CP866",
+ "sk_SK", "CP852", "sl_SI", "CP852", "sq_AL", "CP852", "sr_RS", "CP855",
+ "sr_RS", "CP852", "sv_SE", "CP850", "sv_FI", "CP850", "sw_KE", "CP437",
+ "th_TH", "CP874", "tr_TR", "CP857", "tt_RU", "CP866", "uk_UA", "CP866",
+ "ur_PK", "CP720", "uz_UZ", "CP866", "uz_UZ", "CP857", "vi_VN", "CP1258",
+ "wa_BE", "CP850", "zh_HK", "CP950", "zh_SG", "CP936"};
+ int table_len = sizeof(lc_to_cp_table) / sizeof(char *);
+ int lc_len, i;
+
+ char *lc = setlocale(LC_CTYPE, "");
+
+ if (lc && lc[0]) {
+ // Compare up to the dot, if it exists, e.g. en_US.UTF-8
+ for (lc_len = 0; lc[lc_len] != '.' && lc[lc_len] != '\0'; ++lc_len)
+ ;
+ for (i = 0; i < table_len; i += 2)
+ if (strncmp(lc, lc_to_cp_table[i], lc_len) == 0)
+ oemcp = lc_to_cp_table[i + 1];
+ }
+ }
+
+ iconv_t cd;
+ if ((cd = iconv_open("UTF-8", oemcp)) != (iconv_t)-1) {
+
+ AString s_utf8;
+ const char* src = s.Ptr();
+ size_t slen = s.Len();
+ size_t dlen = slen * 4;
+ const char* dest = s_utf8.GetBuf_SetEnd(dlen + 1); // (source length * 4) + null termination
+
+ size_t done = iconv(cd, (char**)&src, &slen, (char**)&dest, &dlen);
+ bzero((size_t*)dest + done, 1);
+
+ iconv_close(cd);
+
+ if (ConvertUTF8ToUnicode(s_utf8, res) || ignore_Utf8_Errors)
+ return;
+ }
+ }
+ #endif
if (isUtf8)
if (ConvertUTF8ToUnicode(s, res) || ignore_Utf8_Errors)

6
p7zip/time Normal file
View File

@ -0,0 +1,6 @@
real 8m6.505s
user 7m41.858s
sys 0m29.190s