Files
nsis-plugin-ns7zip/tools/linux/setup_bundle_symlinks.py
T
Simone 6f37d34920 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)
2026-05-03 02:25:50 +02:00

79 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Creates symlinks in versions/<VERSION>-bundle to mirror vendor directory structure.
Usage:
python3 setup_bundle_symlinks.py <version>
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
from pathlib import Path
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <version>", file=sys.stderr)
sys.exit(1)
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 / "versions" / VENDOR_DIR.get(version, version)
if not vendor_root.exists():
print(f"Error: vendor directory not found: {vendor_root}", file=sys.stderr)
sys.exit(1)
if not bundle_root.exists():
print(f"Error: bundle directory not found: {bundle_root}", file=sys.stderr)
sys.exit(1)
bundle_7zip = bundle_root / "CPP/7zip"
vendor_7zip = vendor_root / "CPP/7zip"
bundle_cpp = bundle_root / "CPP"
vendor_cpp = vendor_root / "CPP"
# Root-level symlinks: C and Asm
for name in ("C", "Asm"):
target = bundle_root / name
if not target.exists() and not target.is_symlink():
rel = os.path.relpath(vendor_root / name, bundle_root)
os.symlink(rel, target)
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
for item in vendor_7zip.iterdir():
target = bundle_7zip / item.name
if not target.exists() and not target.is_symlink():
rel = os.path.relpath(item, bundle_7zip)
os.symlink(rel, target)
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
bundle_ui = bundle_7zip / "UI"
vendor_ui = vendor_7zip / "UI"
bundle_ui.mkdir(exist_ok=True)
for item in vendor_ui.iterdir():
target = bundle_ui / item.name
if not target.exists() and not target.is_symlink():
rel = os.path.relpath(item, bundle_ui)
os.symlink(rel, target)
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
for item in vendor_cpp.iterdir():
if item.name == "7zip":
continue
target = bundle_cpp / item.name
if not target.exists() and not target.is_symlink():
rel = os.path.relpath(item, bundle_cpp)
os.symlink(rel, target)
print(f" symlink: {target.relative_to(ROOT)} -> {rel}")
print("Done")