Merge pull request #312441 from eclairevoyant/7zz-update

_7zz: fix update script; 23.01 -> 24.05
This commit is contained in:
Aleksana 2024-05-20 11:18:19 +08:00 committed by GitHub
commit 9c58fc7fb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 80 additions and 240 deletions

View File

@ -11,7 +11,6 @@
, enableUnfree ? false
# For tests
, _7zz
, testers
}:
@ -26,13 +25,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "7zz";
version = "23.01";
version = "24.05";
src = fetchurl {
url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] finalAttrs.version}-src.tar.xz";
hash = {
free = "sha256-F1ybQsyReF2NBR/3eMZySvxVEntpwq2VUlRCHp/5nZs=";
unfree = "sha256-NWBxAHNg5aGCTZkEmT6LJIC1G1cOjJ+vfA9Y6+S/n3Q=";
free = "sha256-yYq3IEV2GeDWwW6KrdpgK2/QOsmDcBpIZvbk6VKZETY=";
unfree = "sha256-Y/NBz4C40ofG6UVRmz2g+nVVPIVXKkcbf6bmj5qQt5A=";
}.${if enableUnfree then "unfree" else "free"};
downloadToTemp = (!enableUnfree);
# remove the unRAR related code from the src drv
@ -55,8 +54,6 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
./fix-cross-mingw-build.patch
# remove unneeded semicolons related to -Wextra-semi-stmt, caused by upstream
./fix-empty-expr-stmt.patch
];
postPatch = lib.optionalString stdenv.hostPlatform.isMinGW ''
@ -117,23 +114,23 @@ stdenv.mkDerivation (finalAttrs: {
passthru = {
updateScript = ./update.sh;
tests.version = testers.testVersion {
package = _7zz;
package = finalAttrs.finalPackage;
command = "7zz --help";
};
};
meta = with lib; {
meta = {
description = "Command line archiver utility";
homepage = "https://7-zip.org";
license = with licenses;
license = with lib.licenses;
# 7zip code is largely lgpl2Plus
# CPP/7zip/Compress/LzfseDecoder.cpp is bsd3
[ lgpl2Plus /* and */ bsd3 ] ++
# and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction
# the unRAR compression code is disabled by default
lib.optionals enableUnfree [ unfree ];
maintainers = with maintainers; [ anna328p eclairevoyant jk peterhoeg ];
platforms = platforms.unix ++ platforms.windows;
maintainers = with lib.maintainers; [ anna328p eclairevoyant jk peterhoeg ];
platforms = with lib.platforms; unix ++ windows;
mainProgram = "7zz";
};
})

View File

@ -1,14 +1,3 @@
--- a/C/7zVersion.rc
+++ b/C/7zVersion.rc
@@ -5,7 +5,7 @@
#define MY_VFT_APP 0x00000001L
#define MY_VFT_DLL 0x00000002L
-// #include <WinVer.h>
+// #include <winver.h>
#ifndef MY_VERSION
#include "7zVersion.h"
--- a/C/7zip_gcc_c.mak
+++ b/C/7zip_gcc_c.mak
@@ -106,7 +106,7 @@
@ -20,9 +9,68 @@
CFLAGS_EXTRA = -DUNICODE -D_UNICODE
# -Wno-delete-non-virtual-dtor
--- a/C/7zVersion.rc
+++ b/C/7zVersion.rc
@@ -5,7 +5,7 @@
#define MY_VFT_APP 0x00000001L
#define MY_VFT_DLL 0x00000002L
-// #include <WinVer.h>
+// #include <winver.h>
#ifndef MY_VERSION
#include "7zVersion.h"
--- a/C/Util/7zipInstall/resource.rc
+++ b/C/Util/7zipInstall/resource.rc
@@ -1,7 +1,7 @@
#include <windows.h>
// #include <winnt.h>
// #include <WinUser.h>
-#include <CommCtrl.h>
+#include <commctrl.h>
#define USE_COPYRIGHT_CR
#include "../../7zVersion.rc"
--- a/C/Util/7zipInstall/resource.rc.rej
+++ b/C/Util/7zipInstall/resource.rc.rej
@@ -0,0 +1,10 @@
+--- C/Util/7zipInstall/resource.rc
++++ C/Util/7zipInstall/resource.rc
+@@ -1,6 +1,6 @@
+ #include <winnt.h>
+ #include <WinUser.h>
+-#include <CommCtrl.h>
++#include <commctrl.h>
+
+ #define USE_COPYRIGHT_CR
+ #include "../../7zVersion.rc"
--- a/C/Util/7zipUninstall/resource.rc
+++ b/C/Util/7zipUninstall/resource.rc
@@ -1,7 +1,7 @@
#include <windows.h>
// #include <winnt.h>
// #include <WinUser.h>
-#include <CommCtrl.h>
+#include <commctrl.h>
#define USE_COPYRIGHT_CR
#include "../../7zVersion.rc"
--- a/C/Util/7zipUninstall/resource.rc.rej
+++ b/C/Util/7zipUninstall/resource.rc.rej
@@ -0,0 +1,10 @@
+--- C/Util/7zipUninstall/resource.rc
++++ C/Util/7zipUninstall/resource.rc
+@@ -1,6 +1,6 @@
+ #include <winnt.h>
+ #include <WinUser.h>
+-#include <CommCtrl.h>
++#include <commctrl.h>
+
+ #define USE_COPYRIGHT_CR
+ #include "../../7zVersion.rc"
--- a/CPP/7zip/7zip_gcc.mak
+++ b/CPP/7zip/7zip_gcc.mak
@@ -124,8 +124,8 @@
@@ -142,8 +142,8 @@
DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
endif
@ -31,28 +79,8 @@
+LIB2_GUI = -lole32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 $(LIB_HTMLHELP)
+LIB2 = -loleaut32 -luuid -ladvapi32 -luser32 $(LIB2_GUI)
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
# -Wno-delete-non-virtual-dtor
--- a/C/Util/7zipInstall/resource.rc
+++ b/C/Util/7zipInstall/resource.rc
@@ -1,6 +1,6 @@
#include <winnt.h>
#include <WinUser.h>
-#include <CommCtrl.h>
+#include <commctrl.h>
#define USE_COPYRIGHT_CR
#include "../../7zVersion.rc"
--- a/C/Util/7zipUninstall/resource.rc
+++ b/C/Util/7zipUninstall/resource.rc
@@ -1,6 +1,6 @@
#include <winnt.h>
#include <WinUser.h>
-#include <CommCtrl.h>
+#include <commctrl.h>
#define USE_COPYRIGHT_CR
#include "../../7zVersion.rc"
# v24.00: -DUNICODE and -D_UNICODE are defined in precompilation header files
# CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
--- a/CPP/7zip/Crypto/RandGen.cpp
+++ b/CPP/7zip/Crypto/RandGen.cpp
@@ -19,7 +19,7 @@
@ -111,8 +139,8 @@
--- a/CPP/Windows/Control/ImageList.h
+++ b/CPP/Windows/Control/ImageList.h
@@ -3,7 +3,7 @@
#ifndef __WINDOWS_CONTROL_IMAGE_LIST_H
#define __WINDOWS_CONTROL_IMAGE_LIST_H
#ifndef ZIP7_INC_WINDOWS_CONTROL_IMAGE_LIST_H
#define ZIP7_INC_WINDOWS_CONTROL_IMAGE_LIST_H
-#include <CommCtrl.h>
+#include <commctrl.h>
@ -144,8 +172,8 @@
--- a/CPP/Windows/SecurityUtils.h
+++ b/CPP/Windows/SecurityUtils.h
@@ -3,7 +3,7 @@
#ifndef __WINDOWS_SECURITY_UTILS_H
#define __WINDOWS_SECURITY_UTILS_H
#ifndef ZIP7_INC_WINDOWS_SECURITY_UTILS_H
#define ZIP7_INC_WINDOWS_SECURITY_UTILS_H
-#include <NTSecAPI.h>
+#include <ntsecapi.h>

View File

@ -1,184 +0,0 @@
diff -Naur a/C/7zCrc.c b/C/7zCrc.c
--- a/C/7zCrc.c
+++ b/C/7zCrc.c
@@ -174,7 +174,7 @@
UInt32 Z7_FASTCALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
- UNUSED_VAR(table);
+ UNUSED_VAR(table)
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_32_UNROLL_BYTES - 1)) != 0; size--)
v = __crc32b(v, *p++);
@@ -206,7 +206,7 @@
UInt32 Z7_FASTCALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
const Byte *p = (const Byte *)data;
- UNUSED_VAR(table);
+ UNUSED_VAR(table)
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_64_UNROLL_BYTES - 1)) != 0; size--)
v = __crc32b(v, *p++);
diff -Naur a/C/AesOpt.c b/C/AesOpt.c
--- a/C/AesOpt.c
+++ b/C/AesOpt.c
@@ -639,7 +639,7 @@
const v128 k_z0 = w[2];
for (; numBlocks != 0; numBlocks--, data++)
{
- MM_XOR_m (*data);
+ MM_XOR_m (*data)
AES_E_MC_m (k0)
AES_E_MC_m (k1)
AES_E_MC_m (k2)
@@ -660,7 +660,7 @@
}
}
AES_E_m (k_z1)
- MM_XOR_m (k_z0);
+ MM_XOR_m (k_z0)
*data = m;
}
*p = m;
@@ -745,7 +745,7 @@
while (w != p);
WOP_KEY (AES_D, 1)
WOP_KEY (AES_XOR, 0)
- MM_XOR (m0, iv);
+ MM_XOR (m0, iv)
WOP_M1 (XOR_data_M1)
iv = data[NUM_WAYS - 1];
WOP (STORE_data)
@@ -759,14 +759,14 @@
AES_D_IMC_m (w[2])
do
{
- AES_D_IMC_m (w[1]);
- AES_D_IMC_m (w[0]);
+ AES_D_IMC_m (w[1])
+ AES_D_IMC_m (w[0])
w -= 2;
}
while (w != p);
- AES_D_m (w[1]);
- MM_XOR_m (w[0]);
- MM_XOR_m (iv);
+ AES_D_m (w[1])
+ MM_XOR_m (w[0])
+ MM_XOR_m (iv)
iv = *data;
*data = m;
}
@@ -809,11 +809,11 @@
{
const v128 *w = p;
v128 m;
- CTR_START (m, 0);
+ CTR_START (m, 0)
do
{
- AES_E_MC_m (w[0]);
- AES_E_MC_m (w[1]);
+ AES_E_MC_m (w[0])
+ AES_E_MC_m (w[1])
w += 2;
}
while (w != wEnd);
diff -Naur a/C/LzmaEnc.c b/C/LzmaEnc.c
--- a/C/LzmaEnc.c
+++ b/C/LzmaEnc.c
@@ -195,11 +195,11 @@
unsigned GetPosSlot1(UInt32 pos)
{
unsigned res;
- BSR2_RET(pos, res);
+ BSR2_RET(pos, res)
return res;
}
-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res) }
+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res) }
#else // ! LZMA_LOG_BSR
diff -Naur a/C/Sha1Opt.c b/C/Sha1Opt.c
--- a/C/Sha1Opt.c
+++ b/C/Sha1Opt.c
@@ -300,26 +300,26 @@
LOAD_SHUFFLE (m2, 2)
LOAD_SHUFFLE (m3, 3)
- T(m0, c0); H(e1); C(e0);
- T(m1, c0); SU0(m0, m1, m2); H(e0); C(e1);
- T(m2, c0); SU0(m1, m2, m3); SU1(m0, m3); H(e1); C(e0);
- T(m3, c0); SU0(m2, m3, m0); SU1(m1, m0); H(e0); C(e1);
- T(m0, c0); SU0(m3, m0, m1); SU1(m2, m1); H(e1); C(e0);
- T(m1, c1); SU0(m0, m1, m2); SU1(m3, m2); H(e0); P(e1);
- T(m2, c1); SU0(m1, m2, m3); SU1(m0, m3); H(e1); P(e0);
- T(m3, c1); SU0(m2, m3, m0); SU1(m1, m0); H(e0); P(e1);
- T(m0, c1); SU0(m3, m0, m1); SU1(m2, m1); H(e1); P(e0);
- T(m1, c1); SU0(m0, m1, m2); SU1(m3, m2); H(e0); P(e1);
- T(m2, c2); SU0(m1, m2, m3); SU1(m0, m3); H(e1); M(e0);
- T(m3, c2); SU0(m2, m3, m0); SU1(m1, m0); H(e0); M(e1);
- T(m0, c2); SU0(m3, m0, m1); SU1(m2, m1); H(e1); M(e0);
- T(m1, c2); SU0(m0, m1, m2); SU1(m3, m2); H(e0); M(e1);
- T(m2, c2); SU0(m1, m2, m3); SU1(m0, m3); H(e1); M(e0);
- T(m3, c3); SU0(m2, m3, m0); SU1(m1, m0); H(e0); P(e1);
- T(m0, c3); SU0(m3, m0, m1); SU1(m2, m1); H(e1); P(e0);
- T(m1, c3); SU1(m3, m2); H(e0); P(e1);
- T(m2, c3); H(e1); P(e0);
- T(m3, c3); H(e0); P(e1);
+ T(m0, c0); H(e1); C(e0)
+ T(m1, c0); SU0(m0, m1, m2) H(e0); C(e1)
+ T(m2, c0); SU0(m1, m2, m3) SU1(m0, m3) H(e1); C(e0)
+ T(m3, c0); SU0(m2, m3, m0) SU1(m1, m0) H(e0); C(e1)
+ T(m0, c0); SU0(m3, m0, m1) SU1(m2, m1) H(e1); C(e0)
+ T(m1, c1); SU0(m0, m1, m2) SU1(m3, m2) H(e0); P(e1)
+ T(m2, c1); SU0(m1, m2, m3) SU1(m0, m3) H(e1); P(e0)
+ T(m3, c1); SU0(m2, m3, m0) SU1(m1, m0) H(e0); P(e1)
+ T(m0, c1); SU0(m3, m0, m1) SU1(m2, m1) H(e1); P(e0)
+ T(m1, c1); SU0(m0, m1, m2) SU1(m3, m2) H(e0); P(e1)
+ T(m2, c2); SU0(m1, m2, m3) SU1(m0, m3) H(e1); M(e0)
+ T(m3, c2); SU0(m2, m3, m0) SU1(m1, m0) H(e0); M(e1)
+ T(m0, c2); SU0(m3, m0, m1) SU1(m2, m1) H(e1); M(e0)
+ T(m1, c2); SU0(m0, m1, m2) SU1(m3, m2) H(e0); M(e1)
+ T(m2, c2); SU0(m1, m2, m3) SU1(m0, m3) H(e1); M(e0)
+ T(m3, c3); SU0(m2, m3, m0) SU1(m1, m0) H(e0); P(e1)
+ T(m0, c3); SU0(m3, m0, m1) SU1(m2, m1) H(e1); P(e0)
+ T(m1, c3); SU1(m3, m2) H(e0); P(e1)
+ T(m2, c3); H(e1); P(e0)
+ T(m3, c3); H(e0); P(e1)
abcd = vaddq_u32(abcd, abcd_save);
e0 += e0_save;
diff -Naur a/C/Sha256Opt.c b/C/Sha256Opt.c
--- a/C/Sha256Opt.c
+++ b/C/Sha256Opt.c
@@ -316,10 +316,10 @@
LOAD_SHUFFLE (m2, 2)
LOAD_SHUFFLE (m3, 3)
- R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 );
- R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
- R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
- R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN );
+ R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 )
+ R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
+ R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
+ R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN )
state0 = vaddq_u32(state0, state0_save);
state1 = vaddq_u32(state1, state1_save);
diff -Naur a/CPP/Windows/System.h b/CPP/Windows/System.h
--- a/CPP/Windows/System.h
+++ b/CPP/Windows/System.h
@@ -105,7 +105,7 @@
}
void CpuZero() { }
- void CpuSet(unsigned cpuIndex) { UNUSED_VAR(cpuIndex); }
+ void CpuSet(unsigned cpuIndex) { UNUSED_VAR(cpuIndex) }
int IsCpuSet(unsigned cpuIndex) const { return (cpuIndex < numSysThreads) ? 1 : 0; }
BOOL SetProcAffinity() const

View File

@ -1,14 +1,12 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils gnused curl jq nix-prefetch
#! nix-shell -i bash -p curl xq-xml nix-prefetch
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
DRV_DIR="$PWD"
OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
# The best_release.json is not always up-to-date
# In those cases you can force the version by calling `./update.sh <newer_version>`
NEW_VERSION="${1:-$(curl -H "Accept: application/json" 'https://sourceforge.net/projects/sevenzip/best_release.json' | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)}"
NEW_VERSION="$(curl -H 'Accept: application/rss+xml' 'https://sourceforge.net/projects/sevenzip/rss?path=/7-Zip' | xq -x "substring((/rss/channel/item[link[contains(., 'src.tar.xz')]])[1]/title, 8, 5)")"
echo "comparing versions $OLD_VERSION => $NEW_VERSION"
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
@ -26,10 +24,11 @@ OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT
NEW_VERSION_FORMATTED="$(echo "$NEW_VERSION" | tr -d '.')"
URL="https://7-zip.org/a/7z${NEW_VERSION_FORMATTED}-src.tar.xz"
# `nix-prefetch` is broken without flakes
# see https://github.com/msteen/nix-prefetch/issues/51
NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL" --option extra-experimental-features flakes)
NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL")
NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path)
NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path --option extra-experimental-features flakes)
# first line of raw output is the hash
NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)"
# second line of raw output is the src path