refactor: rename versions/zstd to versions/zstd-bundle for consistency

Aligns the zstd NSIS wrapper directory with the naming convention used by
all other bundle directories (versions/25.01-bundle, 26.00-bundle, etc.).

Changes:
- git mv versions/zstd -> versions/zstd-bundle (20 project-owned files)
- Fix UI/NSIS/StdAfx.h: use relative include ../../Bundles/Nsis7z/pluginapi.h
  instead of absolute-style 7zip/Bundles/Nsis7z/pluginapi.h (portable across
  both Linux and Windows builds without extra include path)

Build tool updates:
- tools/legacy/build_plugin_zstd_vs2026.py: updated project_dir path
- tools/linux/build_plugin_linux.py:
  * VERSION_LAYOUT zstd: zstd -> zstd-bundle
  * VERSION_EXTRA_FLAGS zstd: -Wno-sign-compare -Wno-cast-function-type
    (fast-lzma2 C vendor code)
  * VERSION_EXTRA_CXXFLAGS zstd: -Wno-unused-parameter (NSIS wrapper)
  * EXTRA_SYS_OBJS: inject MyWindows.o for zstd (LocalFileTimeToFileTime2)
  * Remove 'zip_version != zstd' exception; auto-recreate symlinks for all
    bundle versions including zstd
- tools/linux/setup_bundle_symlinks.py: add VENDOR_DIR mapping so 'zstd'
  points to versions/7-zip-zstd (not versions/zstd which no longer exists)
- tools/linux/overlay/makefile.gcc: add EXTRA_SYS_OBJS ?= variable so
  callers can inject additional objects without modifying the file

Linux build status after this commit:
  python3 build_plugin.py --7zip-version zstd  -> Build completed (all 3 configs)
This commit is contained in:
2026-05-03 02:25:50 +02:00
parent 8a76f8cc70
commit 6f37d34920
25 changed files with 55 additions and 17 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ Supports multiple build configurations with flexible parameters.
Uses PlatformToolset v145 (Visual Studio 2026 Build Tools).
The 7-Zip ZS source is pulled from the git submodule at versions/7-zip-zstd/.
The NSIS plugin wrapper (nsis7z.cpp, vcxproj, …) lives in versions/zstd/.
The NSIS plugin wrapper (nsis7z.cpp, vcxproj, …) lives in versions/zstd-bundle/.
NOTE: VS2026 Build Tools use v145 toolset (version 18.x)
"""
@@ -201,7 +201,7 @@ def find_msbuild(vs_version: str = 'auto') -> 'Optional[Tuple[Path, str, str]]':
def get_project_paths(toolset: str = 'v145') -> Tuple[Path, Path, Path]:
"""Get project directory, project file, and plugins directory"""
script_dir = Path(__file__).parent.absolute()
project_dir = script_dir.parent.parent / 'versions' / 'zstd'
project_dir = script_dir.parent.parent / 'versions' / 'zstd-bundle'
vcxproj = 'Nsis7z_vs2026.vcxproj'
project_file = project_dir / 'CPP' / '7zip' / 'Bundles' / 'Nsis7z' / vcxproj
plugins_dir = script_dir.parent.parent / 'plugins'
+25 -5
View File
@@ -29,7 +29,7 @@ SUPPORTED = {"25.01", "26.00", "26.01", "zstd"}
# project-owned sources (NSIS UI, wrapper cpp files, vcxproj).
#
# For zstd the 7-zip C++ sources live in the 7-zip-zstd submodule while our
# NSIS wrapper sits in versions/zstd/. make is run with -C pointing to the
# NSIS wrapper sits in versions/zstd-bundle/. make is run with -C pointing to the
# wrapper dir and VENDOR_7ZIP overridden to the submodule tree so that
# include/source rules resolve correctly without touching the submodule.
VERSION_LAYOUT = {
@@ -48,10 +48,19 @@ VERSION_LAYOUT = {
# zstd: make runs in our wrapper dir; vendor_7zip points to submodule tree.
"zstd": {
"vendor_7zip": ROOT / "versions" / "7-zip-zstd" / "CPP" / "7zip",
"bundle_dir": ROOT / "versions" / "zstd" / "CPP" / "7zip" / "Bundles" / "Nsis7z",
"bundle_dir": ROOT / "versions" / "zstd-bundle" / "CPP" / "7zip" / "Bundles" / "Nsis7z",
},
}
# Per-version extra flags for GCC/MinGW cross-compilation that apply to both
# C and C++ compilations. Passed via LOCAL_FLAGS_EXTRA → merged into CFLAGS
# and CXXFLAGS alike.
VERSION_EXTRA_FLAGS: dict[str, str] = {
# fast-lzma2 (part of the 7-zip-zstd vendor) triggers -Wsign-compare and
# -Wcast-function-type on C code that was never compiled with GCC -Werror.
"zstd": "-Wno-sign-compare -Wno-cast-function-type",
}
# Per-version C++-only extra flags for GCC/MinGW cross-compilation.
# These compensate for vendor code written exclusively for MSVC.
# Passed via LOCAL_CXXFLAGS_EXTRA → appended to CXXFLAGS only (not CFLAGS).
@@ -67,6 +76,10 @@ VERSION_EXTRA_CXXFLAGS: dict[str, str] = {
# in the specific makefile rule for NsisExtractCallbackConsole.o.
# - Several unused parameters and sign-compare on UInt64 vs. literal -1.
"25.01": "-Wno-sign-compare -Wno-unused-parameter",
# 7-zip-zstd NSIS UI code has the same unused-parameter issues as 25.01.
# sign-compare is in C code (fast-lzma2) and already in VERSION_EXTRA_FLAGS;
# unused-parameter warnings are C++-only (NSIS wrapper and nsis7z.cpp).
"zstd": "-Wno-unused-parameter",
}
CONFIGS = {
@@ -144,7 +157,7 @@ def _build_one(
bundle_dir = layout["bundle_dir"]
# Symlinks are not committed to git; recreate them on Linux if missing.
if zip_version in VERSION_LAYOUT and zip_version != "zstd":
if zip_version in VERSION_LAYOUT:
_ensure_bundle_symlinks(zip_version, bundle_dir, vendor_7zip)
cfg = CONFIGS[cfg_name]
@@ -166,7 +179,8 @@ def _build_one(
# Version-specific workarounds for vendor code that was MSVC-only.
# Flags that are C++-only (e.g. -fpermissive) must go into LOCAL_CXXFLAGS_EXTRA
# which the makefile appends only to CXXFLAGS, not to CFLAGS.
extra_cxx = VERSION_EXTRA_CXXFLAGS.get(zip_version, "")
extra_flags = VERSION_EXTRA_FLAGS.get(zip_version, "")
extra_cxx = VERSION_EXTRA_CXXFLAGS.get(zip_version, "")
# CXX_INCLUDE_FLAGS:
# 1. overlay/include case-sensitivity shims (Windows.h → windows.h, …)
@@ -179,6 +193,11 @@ def _build_one(
# our bundle dir, not in the vendor tree. Override NSIS_DIR accordingly.
bundle_nsis = bundle_dir.parent.parent / "UI" / "NSIS"
# The 7-zip-zstd vendor calls LocalFileTimeToFileTime2() which is defined
# in MyWindows.cpp. That TU is normally excluded from SYS_OBJS when
# IS_MINGW=1, so we must inject it back via EXTRA_SYS_OBJS.
extra_sys_objs = f"{out_dir}/MyWindows.o" if zip_version == "zstd" else ""
base_cmd = [
"make",
"-C", str(bundle_dir),
@@ -194,8 +213,9 @@ def _build_one(
f"CC={triplet}-gcc",
f"CXX={triplet}-g++",
f"RC={triplet}-windres",
f"LOCAL_FLAGS_EXTRA={local_flags} -Wno-unknown-pragmas",
f"LOCAL_FLAGS_EXTRA={local_flags} -Wno-unknown-pragmas {extra_flags}".rstrip(),
f"LOCAL_CXXFLAGS_EXTRA={extra_cxx}",
*([ f"EXTRA_SYS_OBJS={extra_sys_objs}" ] if extra_sys_objs else []),
# Linux ld is case-sensitive; vendor makefile uses mixed-case lib names
# (lUser32, lOle32, …) that don't exist on disk. Override LIB2 with
# fully-expanded lowercase equivalents.
+6
View File
@@ -73,9 +73,15 @@ CURRENT_OBJS = \
$O/pluginapi.o \
$O/nsis7z.o \
# Optional extra system objects pass from the command line when the vendor
# requires additional translation units that are normally excluded for mingw
# (e.g. MyWindows.o for the 7-zip-zstd variant).
EXTRA_SYS_OBJS ?=
OBJS = \
$(ARC_OBJS) \
$(SYS_OBJS) \
$(EXTRA_SYS_OBJS) \
$(NSIS_UI_OBJS) \
$(CURRENT_OBJS) \
+7 -1
View File
@@ -8,6 +8,7 @@ Example:
python3 setup_bundle_symlinks.py 25.01
python3 setup_bundle_symlinks.py 26.00
python3 setup_bundle_symlinks.py 26.01
python3 setup_bundle_symlinks.py zstd
"""
import os
import sys
@@ -19,9 +20,14 @@ if len(sys.argv) != 2:
version = sys.argv[1]
# For versions where the vendor directory name differs from the bundle version key.
VENDOR_DIR = {
"zstd": "7-zip-zstd",
}
ROOT = Path(__file__).resolve().parents[2]
bundle_root = ROOT / f"versions/{version}-bundle"
vendor_root = ROOT / f"versions/{version}"
vendor_root = ROOT / "versions" / VENDOR_DIR.get(version, version)
if not vendor_root.exists():
print(f"Error: vendor directory not found: {vendor_root}", file=sys.stderr)