Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade 7zip binaries (breaking/major semver) #27

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 7x.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

sz_program=${SZA_PATH:-7za}
sz_type=${SZA_ARCHIVE_TYPE:-xz}
sz_program=${SZ_PATH:-7zz}
sz_type=${SZ_ARCHIVE_TYPE:-xz}

case $1 in
-d) "$sz_program" e -si -so -t${sz_type} ;;
*) "$sz_program" a f -si -so -t${sz_type} -mx${SZA_COMPRESSION_LEVEL:-9} ;;
*) "$sz_program" a f -si -so -t${sz_type} -mx${SZ_COMPRESSION_LEVEL:-9} ;;
esac 2> /dev/null
79 changes: 78 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
7-Zip precompiled binaries.
7-Zip precompiled binaries.
Current version: 24.08
Downloaded from https://www.7-zip.org/download.html

Use `USE_SYSTEM_7Z` to use system 7za instead of binaries in repo.
Use `SZ_COMPRESSION_LEVEL` for setting compression level in 7x.sh

Flags:
```
mac/arm64/7zz -h update-7zip

7-Zip (z) 24.08 (arm64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-08-11
64-bit arm_v:8.5-A locale=en_US.UTF-8 Threads:12 OPEN_MAX:1048575, ASM

Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]

<Commands>
a : Add files to archive
b : Benchmark
d : Delete files from archive
e : Extract files from archive (without using directory names)
h : Calculate hash values for files
i : Show information about supported formats
l : List contents of archive
rn : Rename files in archive
t : Test integrity of archive
u : Update files to archive
x : eXtract files with full paths

<Switches>
-- : Stop switches and @listfile parsing
-ai[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include archives
-ax[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude archives
-ao{a|s|t|u} : set Overwrite mode
-an : disable archive_name field
-bb[0-3] : set output log level
-bd : disable progress indicator
-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
-bt : show execution time statistics
-i[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include filenames
-m{Parameters} : set compression Method
-mmt[N] : set number of CPU threads
-mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)
-o{Directory} : set Output directory
-p{Password} : set Password
-r[-|0] : Recurse subdirectories for name search
-sa{a|e|s} : set Archive name mode
-scc{UTF-8|WIN|DOS} : set charset for console input/output
-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
-scrc[CRC32|CRC64|SHA256|SHA1|XXH64|BLAKE2SP|*] : set hash function for x, e, h commands
-sdel : delete files after compression
-seml[.] : send archive by email
-sfx[{name}] : Create SFX archive
-si[{name}] : read data from stdin
-slp : set Large Pages mode
-slt : show technical information for l (List) command
-snh : store hard links as links
-snl : store symbolic links as links
-sni : store NT security information
-sns[-] : store NTFS alternate streams
-so : write data to stdout
-spd : disable wildcard matching for file names
-spe : eliminate duplication of root folder for extract command
-spf[2] : use fully qualified file paths
-ssc[-] : set sensitive case mode
-sse : stop archive creating, if it can't open some input file
-ssp : do not change Last Access Time of source files while archiving
-ssw : compress shared files
-stl : set archive timestamp from the most recently modified file
-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
-stx{Type} : exclude archive type
-t{Type} : Set type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
-v{Size}[b|k|m|g] : Create volumes
-w[{path}] : assign Work directory. Empty path means a temporary directory
-x[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude filenames
-y : assume Yes on all queries
```
10 changes: 9 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
export const path7za: string
/**
* Path to 7zz (mac/linux) and 7za.exe (win)
* Env var available: `USE_SYSTEM_7Z` instead of included binaries
*/
export const path7z: string
/**
* Short script for executing 7z
* Env vars available: `SZ_PATH`, `SZ_ARCHIVE_TYPE`, `SZ_COMPRESSION_LEVEL`
*/
export const path7x: string
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
const path = require("path")

function getPath() {
if (process.env.USE_SYSTEM_7ZA === "true") {
if (process.env.USE_SYSTEM_7Z === "true") {
return "7za"
}

if (process.platform === "darwin") {
return path.join(__dirname, "mac", process.arch, "7za")
return path.join(__dirname, "mac", process.arch, "7zz")
}
else if (process.platform === "win32") {
return path.join(__dirname, "win", process.arch, "7za.exe")
}
else {
return path.join(__dirname, "linux", process.arch, "7za")
return path.join(__dirname, "linux", process.arch, "7zz")
}
}

exports.path7za = getPath()
exports.path7z = getPath()
exports.path7x = path.join(__dirname, "7x.sh")
Binary file removed linux/arm/7za
Binary file not shown.
Binary file added linux/arm/7zz
Binary file not shown.
Binary file added linux/arm/7zzs
Binary file not shown.
144 changes: 144 additions & 0 deletions linux/arm/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
7-Zip for Linux and macOS
~~~~~~~~~~~~~~~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7-Zip Copyright (C) 1999-2024 Igor Pavlov.

The licenses for 7zz and 7zzs files are:

- The "GNU LGPL" as main license for most of the code
- The "GNU LGPL" with "unRAR license restriction" for some code
- The "BSD 3-clause License" for some code
- The "BSD 2-clause License" for some code

Redistributions in binary form must reproduce related license information from this file.

Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.


GNU LGPL information
--------------------

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/




BSD 3-clause License in 7-Zip code
----------------------------------

The "BSD 3-clause License" is used for the following code in 7z.dll
1) LZFSE data decompression.
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
that also uses the "BSD 3-clause License".
2) ZSTD data decompression.
that code was developed using original zstd decoder code as reference code.
The original zstd decoder code was developed by Facebook Inc,
that also uses the "BSD 3-clause License".

Copyright (c) 2015-2016, Apple Inc. All rights reserved.
Copyright (c) Facebook, Inc. All rights reserved.
Copyright (c) 2023-2024 Igor Pavlov.

Text of the "BSD 3-clause License"
----------------------------------

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---




BSD 2-clause License in 7-Zip code
----------------------------------

The "BSD 2-clause License" is used for the XXH64 code in 7-Zip.

XXH64 code in 7-Zip was derived from the original XXH64 code developed by Yann Collet.

Copyright (c) 2012-2021 Yann Collet.
Copyright (c) 2023-2024 Igor Pavlov.

Text of the "BSD 2-clause License"
----------------------------------

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---




unRAR license restriction
-------------------------

The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.

The license for original unRAR code has the following restriction:

The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.

--
100 changes: 100 additions & 0 deletions linux/arm/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
7-Zip 24.08 for Linux and macOS
-------------------------------

7-Zip is a file archiver for Windows/Linux/macOS.

7-Zip Copyright (C) 1999-2024 Igor Pavlov.

The main features of 7-Zip:

- High compression ratio in the new 7z format
- Supported formats:
- Packing / unpacking: 7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM.
- Unpacking only: APFS, AR, ARJ, Base64, CAB, CHM, CPIO, CramFS, DMG, EXT, FAT, GPT, HFS,
IHEX, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, QCOW2, RAR,
RPM, SquashFS, UDF, UEFI, VDI, VHD, VHDX, VMDK, XAR, Z and ZSTD.
- Fast compression and decompression
- Strong AES-256 encryption in 7z and ZIP formats

7-Zip is free software distributed under the GNU LGPL (except of some code with another license rules).
Read License.txt for more information about license.

This distribution package contains the following files:

7zz - standalone console version of 7-Zip (version compiled for dynamic system library linking)
7zzs - standalone console version of 7-Zip (version compiled with static system library linking)
readme.txt - this file
License.txt - license information
History.txt - History of 7-Zip
MANUAL - User's Manual in HTML format


7-Zip and p7zip
===============
Now there are two different ports of 7-Zip for Linux/macOS:

1) p7zip - another port of 7-Zip for Linux, made by an independent developer.
The latest version of p7zip now is 16.02, and that p7zip 16.02 is outdated now.

2) 7-Zip for Linux/macOS - this package - it's new code with all changes from latest 7-Zip for Windows.

These two ports are not identical.
Note also that some Linux specific things can be implemented better in p7zip than in new 7-Zip for Linux.


There are several main executables in 7-Zip and p7zip:

7zz (7-Zip) - standalone full version of 7-Zip that supports all formats.

7zzs (7-Zip) - standalone full version of 7-Zip that supports all formats (static library linking).


7z (p7zip) - 7-Zip that requires 7z.so shared library, and it supports all formats via 7z.so.

7zr (p7zip) - standalone reduced version of 7-Zip that supports some 7-Zip's formats:
7z, xz, lzma and split.

7za (p7zip) - standalone version of 7-Zip that supports some main formats:
7z, xz, lzma, zip, bzip2, gzip, tar, cab, ppmd and split.

7zzs is similar to 7zz, but 7zzs was compiled for static library linking,
so 7zzs does not use external shared library (".so") files.
You can use 7zzs, if 7zz does not work due to lack of required shared library (".so") files.

The command line syntax for executables from p7zip is similar to 7zz syntax from this package.

The manual of 7-Zip and p7zip can show `7z` in command examples.
But you can use `7zz`, `7zr`, `7za` instead of `7z` from examples.


Example commands
================

Note: 7-Zip supports filename wildcards in commands.
You must use the quotes for filenames, if you want to use 7-Zip parser for wildcards
instead of the parser of system shell.

To create zip archive from all *.txt files in current directory:
./7zz a archive.zip "*.txt"

To list the contents of archive:
./7zz l archive.zip

To list the contents of archive with detailed technical information for each file:
./7zz l archive.zip -slt

To extract archive to current directory:
./7zz x archive.zip

To test archive and show the log for each file:
./7zz t archive.zip -bb

The benchmark command to test the performance of CPU with 7-Zip's LZMA code:
./7zz b

The benchmark command to test the performance of CPU with different compression, encryption
and hash methods from 7-Zip and with different number of threads:
./7zz b "-mm=*" "-mmt=*"

---
End of document
Binary file removed linux/arm64/7za
Binary file not shown.
Binary file added linux/arm64/7zz
Binary file not shown.
Binary file added linux/arm64/7zzs
Binary file not shown.
Loading