From 7fca01c67a9f794f4b6338deae2d0c17ae419c9d Mon Sep 17 00:00:00 2001 From: Alexandr Reshetnikov Date: Mon, 7 Aug 2023 02:15:20 +0700 Subject: [PATCH] 7zz 7-zip 23.01 (#83) --- .github/workflows/7-Zip.yml | 66 +++++++++++++++++++++ .github/workflows/build-windows-msbuild.yml | 33 +++++++++++ 7-Zip/build_mingw.sh | 56 +++++++++++++++++ 7-Zip/build_musl.sh | 63 ++++++++++++++++++++ 7-Zip/release/0001-static.patch | 38 ++++++++++++ 7-Zip/test_linux.sh | 9 +++ 7-Zip/test_windows.sh | 9 +++ README.md | 1 + 8 files changed, 275 insertions(+) create mode 100644 .github/workflows/7-Zip.yml create mode 100644 .github/workflows/build-windows-msbuild.yml create mode 100755 7-Zip/build_mingw.sh create mode 100755 7-Zip/build_musl.sh create mode 100644 7-Zip/release/0001-static.patch create mode 100755 7-Zip/test_linux.sh create mode 100755 7-Zip/test_windows.sh diff --git a/.github/workflows/7-Zip.yml b/.github/workflows/7-Zip.yml new file mode 100644 index 000000000..bab0f6a61 --- /dev/null +++ b/.github/workflows/7-Zip.yml @@ -0,0 +1,66 @@ +name: 7-Zip + +on: [pull_request, workflow_dispatch] + +jobs: + alpine-musl: + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/build-alpine.yml + with: + workflow: ${{ github.workflow }} + toolset: musl + version: 3.16 + + alpine-musl-test: + needs: alpine-musl + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/test-alpine.yml + with: + workflow: ${{ github.workflow }} + artifact: build-musl + + ubuntu-musl-test: + needs: alpine-musl + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/test-ubuntu.yml + with: + workflow: ${{ github.workflow }} + artifact: build-musl + + windows-mingw: + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/build-windows-msbuild.yml + with: + workflow: ${{ github.workflow }} + + test-windows: + needs: windows-mingw + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/test-windows.yml + with: + workflow: ${{ github.workflow }} + artifact: build-mingw + + test-nanoserver: + needs: windows-mingw + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/test-nanoserver.yml + with: + workflow: ${{ github.workflow }} + artifact: build-mingw + + release: + needs: [alpine-musl-test, + ubuntu-musl-test, + test-windows, + test-nanoserver] + uses: ./.github/workflows/release.yml + with: + workflow: ${{ github.workflow }} + tool_version: '23.01' + prepare_body: | + bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md + bsdtar -Oxf ./build-mingw/build-mingw.tar.gz build-mingw.md >> body.md + artifacts: ./build-musl/build-musl.tar.gz,./build-mingw/build-mingw.tar.gz + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-windows-msbuild.yml b/.github/workflows/build-windows-msbuild.yml new file mode 100644 index 000000000..9fb3ac7e5 --- /dev/null +++ b/.github/workflows/build-windows-msbuild.yml @@ -0,0 +1,33 @@ +on: + workflow_call: + inputs: + workflow: + required: true + type: string + toolset: + required: false + type: string + default: 'mingw' + +jobs: + build-windows: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v3 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.3 + + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + + - name: build ${{ inputs.workflow }}-windows-${{ inputs.toolset }} + run: | + .tools\busybox64.exe sh ${{ inputs.workflow }}\build_${{ inputs.toolset }}.sh + + - uses: actions/upload-artifact@v3 + with: + name: build-${{ inputs.toolset }} + path: ./${{ inputs.workflow }}/release/build-${{ inputs.toolset }}.tar.gz diff --git a/7-Zip/build_mingw.sh b/7-Zip/build_mingw.sh new file mode 100755 index 000000000..cf4b181e5 --- /dev/null +++ b/7-Zip/build_mingw.sh @@ -0,0 +1,56 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + +tool_name="7-Zip" +tool_version="23.01" +self_toolset_name="build-mingw" +release_version_dirpath="$dp0/release/build" + +mkdir -p "$release_version_dirpath" && cd "$dp0/release" + +download_url="https://www.7-zip.org/a/7z2301-src.tar.xz" +echo "::group::prepare sources $download_url" + +"$dp0/../.tools/download_bsdtar.sh" +bsdtar="$dp0/release/bsdtar" + +# wget failed: ssl_client: TLS error from peer (alert code 80): 80 +curl --location "$download_url" --output "tool-$tool_version.tar.xz" +"$bsdtar" -xf "tool-$tool_version.tar.xz" + +echo "::endgroup::" + +echo "::group::build" + +cd "$dp0/release/CPP/7zip/Bundles/Alone2" +nmake +cp -f "./x64/7zz.exe" "$release_version_dirpath/" + +echo "::endgroup::" + +cd "$release_version_dirpath" + +strip 7zz.exe + +{ printf '### %s +%s + +SHA-256: %s + +
+ 7zz i + +``` +%s +``` +
+ +%s + +' "$self_toolset_name.tar.gz" "$(./7zz.exe | head -2)" "$(sha256sum 7zz.exe)" "$(./7zz.exe i)" "$download_url" +} > "$self_toolset_name.md" + +cat "$self_toolset_name.md" + +"$bsdtar" -czvf "../$self_toolset_name.tar.gz" . diff --git a/7-Zip/build_musl.sh b/7-Zip/build_musl.sh new file mode 100755 index 000000000..60396ca22 --- /dev/null +++ b/7-Zip/build_musl.sh @@ -0,0 +1,63 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + +echo "::group::install deps" + +apk update +apk add --no-cache alpine-sdk make linux-headers + +echo "::endgroup::" + +tool_name="7-Zip" +tool_version="23.01" +self_toolset_name="build-musl" +release_version_dirpath="$dp0/release/build" + +mkdir -p "$release_version_dirpath" && cd "$dp0/release" + +download_url="https://www.7-zip.org/a/7z2301-src.tar.xz" +echo "::group::prepare sources $download_url" + +"$dp0/../.tools/download_bsdtar.sh" +bsdtar="$dp0/release/bsdtar" + +# wget failed: ssl_client: TLS error from peer (alert code 80): 80 +curl --location "$download_url" --output "tool-$tool_version.tar.xz" +"$bsdtar" -xf "tool-$tool_version.tar.xz" + +git apply "$dp0/release/0001-static.patch" + +echo "::endgroup::" + +echo "::group::build" + +cd "$dp0/release/CPP/7zip/Bundles/Alone2" +make -j -f makefile.gcc +cp -f "./_o/7zz" "$release_version_dirpath/" + +echo "::endgroup::" + +cd "$release_version_dirpath" + +strip 7zz + +{ printf '### %s +%s + +SHA-256: %s + +
+ 7zz i + +``` +%s +``` +
+ +' "$self_toolset_name.tar.gz" "$(./7zz | head -2)" "$(sha256sum 7zz)" "$(./7zz i)" +} > "$self_toolset_name.md" + +cat "$self_toolset_name.md" + +"$bsdtar" -czvf "../$self_toolset_name.tar.gz" . diff --git a/7-Zip/release/0001-static.patch b/7-Zip/release/0001-static.patch new file mode 100644 index 000000000..d1b8de76b --- /dev/null +++ b/7-Zip/release/0001-static.patch @@ -0,0 +1,38 @@ +From 1d9a48d5589fd888d63f363ed654f81c1693bec7 Mon Sep 17 00:00:00 2001 +From: Reshetnikov Alexandr +Date: Sun, 6 Aug 2023 22:01:23 +0400 +Subject: [PATCH] + static - affinity + +--- + C/Threads.h | 1 - + CPP/7zip/7zip_gcc.mak | 2 ++ + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/C/Threads.h b/C/Threads.h +index c6aa6a8..7abb2ab 100644 +--- a/C/Threads.h ++++ b/C/Threads.h +@@ -12,7 +12,6 @@ + #if defined(__linux__) + #if !defined(__APPLE__) && !defined(_AIX) && !defined(__ANDROID__) + #ifndef Z7_AFFINITY_DISABLE +-#define Z7_AFFINITY_SUPPORTED + // #pragma message(" ==== Z7_AFFINITY_SUPPORTED") + // #define _GNU_SOURCE + #endif +diff --git a/CPP/7zip/7zip_gcc.mak b/CPP/7zip/7zip_gcc.mak +index a8eb6e3..bf3e671 100644 +--- a/CPP/7zip/7zip_gcc.mak ++++ b/CPP/7zip/7zip_gcc.mak +@@ -68,6 +68,8 @@ endif + endif + endif + ++LDFLAGS_STATIC_2 = -static ++ + LDFLAGS_STATIC = -DNDEBUG $(LDFLAGS_STATIC_2) + + ifndef O +-- +2.37.2.windows.2 + diff --git a/7-Zip/test_linux.sh b/7-Zip/test_linux.sh new file mode 100755 index 000000000..d6d0a1efe --- /dev/null +++ b/7-Zip/test_linux.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +testVersion() { + assertEquals " +7-Zip (z) 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20" "$(../bin/7zz | head -2)" +} + +# Load and run shUnit2. +source "../.tests/shunit2/shunit2" diff --git a/7-Zip/test_windows.sh b/7-Zip/test_windows.sh new file mode 100755 index 000000000..06e59fc1b --- /dev/null +++ b/7-Zip/test_windows.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +testVersion() { + assertEquals " +7-Zip (z) 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20" "$(../bin/7zz.exe | dos2unix | head -2)" +} + +# Load and run shUnit2. +source "../.tests/shunit2/shunit2" diff --git a/README.md b/README.md index 5712e23c6..af79a2ca6 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/mypy-1.4.1/total?label=⭳%20mypy-1.4.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/mypy-1.4.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/python/mypy?style=social&label=mypy)](https://github.com/python/mypy) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/python/mypy)](https://mypy.readthedocs.io/en/latest/) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/ansible-8.1.0/total?label=⭳%20ansible-8.1.0-core-2.15.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/ansible-8.1.0) | [![GitHub Repo stars](https://img.shields.io/github/stars/ansible/ansible?style=social&label=ansible)](https://github.com/ansible/ansible) [![PyPI](https://img.shields.io/pypi/v/ansible)](https://pypi.org/project/ansible/) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/ansible/ansible)](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/bsdtar-3.6.2/total?label=⭳%20bsdtar-3.6.2)](https://github.com/hemnstill/StandaloneTools/releases/tag/bsdtar-3.6.2) | [![GitHub Repo stars](https://img.shields.io/github/stars/libarchive/libarchive?style=social&label=libarchive)](https://github.com/libarchive/libarchive) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/libarchive/libarchive)](https://github.com/libarchive/libarchive/releases/latest) | +| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/7-Zip-23.01/total?label=⭳%207-Zip-23.01)](https://github.com/hemnstill/StandaloneTools/releases/tag/7-Zip-23.01) | [![SourceForge Downloads](https://img.shields.io/sourceforge/dm/sevenzip?style=social&label=7-Zip)](https://sourceforge.net/projects/sevenzip/) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/pg_dump-15.1/total?label=⭳%20pg_dump-15.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/pg_dump-15.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/postgres/postgres?style=social&label=postgres)](https://github.com/postgres/postgres) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/postgres/postgres)](https://www.postgresql.org/docs/current/index.html) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/busybox-1.35.0-FRP-4784/total?label=⭳%20busybox-1.35.0-FRP-4784)](https://github.com/hemnstill/StandaloneTools/releases/tag/busybox-1.35.0-FRP-4784) | [![GitHub Repo stars](https://img.shields.io/github/stars/rmyorston/busybox-w32?style=social&label=busybox-w32)](https://github.com/rmyorston/busybox-w32) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/rmyorston/busybox-w32)](https://frippery.org/busybox/release-notes/current.html) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/far2l-2.5.1/total?label=⭳%20far2l-2.5.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/far2l-2.5.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/elfmz/far2l?style=social&label=far2l)](https://github.com/elfmz/far2l) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/elfmz/far2l)](https://github.com/elfmz/far2l/releases/latest) |