From 8a76f8cc704a10494f2bf8d73fbeb7223fa901c0 Mon Sep 17 00:00:00 2001 From: Simone Date: Sun, 3 May 2026 02:07:25 +0200 Subject: [PATCH] fix: auto-recreate bundle symlinks on Linux if missing after clone After the previous commit removed symlinks from git (they break Windows clones), a fresh Linux clone or git checkout would leave the bundle directories without the POSIX symlinks that the GNU make build needs. Add _ensure_bundle_symlinks() to build_plugin_linux.py: before the first make invocation for a bundle-based version it checks whether the bundle root symlink (bundle/C -> ../VER/C) exists and, if not, runs setup_bundle_symlinks.py automatically so the developer never has to run the setup script manually. --- tools/linux/build_plugin_linux.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/linux/build_plugin_linux.py b/tools/linux/build_plugin_linux.py index b9682ba..fffa665 100644 --- a/tools/linux/build_plugin_linux.py +++ b/tools/linux/build_plugin_linux.py @@ -107,6 +107,30 @@ def _resolve_jobs(value: str) -> int: return jobs +def _ensure_bundle_symlinks(zip_version: str, bundle_dir: Path, vendor_7zip: Path) -> None: + """Recreate bundle symlinks if they are missing (e.g. after a fresh clone). + + Symlinks are no longer committed to git (they are POSIX-only and break + Windows clones), so they must be created on-the-fly on Linux before make + can resolve the relative source paths inside the bundle directory. + """ + # A sentinel: if the vendor C/ directory is not reachable via the bundle + # root symlink, assume all symlinks need to be (re)created. + sentinel = bundle_dir.parents[3] / "C" # bundle/CPP/7zip/../../../C = bundle/C + if sentinel.exists(): + return # symlinks already in place + + setup_script = ROOT / "tools" / "linux" / "setup_bundle_symlinks.py" + print(f"[linux] Bundle symlinks missing for {zip_version}, recreating via {setup_script.name} ...") + proc = subprocess.run( + [sys.executable, str(setup_script), zip_version], + cwd=ROOT, + ) + if proc.returncode != 0: + print(f"ERROR: setup_bundle_symlinks.py failed for {zip_version}", file=sys.stderr) + sys.exit(proc.returncode) + + def _build_one( zip_version: str, cfg_name: str, @@ -119,6 +143,10 @@ def _build_one( vendor_7zip = layout["vendor_7zip"] 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": + _ensure_bundle_symlinks(zip_version, bundle_dir, vendor_7zip) + cfg = CONFIGS[cfg_name] triplet = cfg["triplet"]