feat: add resonance compressor and Windows CI
This commit is contained in:
1 parent
3281535a04
commit
3c5b05fdec
31 files changed
+6340
-57
No files matched your search
+18
-5
@@ -1,12 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build and package CLAP without modifying a DAW's plugin directories."""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--plugin", choices=["motif-storyboard", "resonance-compressor"], default="motif-storyboard", help="Plugin to package")
|
||||
parser.add_argument("--target", help="Rust target triple; defaults to rustc's host")
|
||||
parser.add_argument("--standalone", action="store_true", help="Also build the standalone preview app")
|
||||
args = parser.parse_args()
|
||||
@@ -16,19 +18,30 @@ if target is None:
|
||||
target = next(line.removeprefix("host: ") for line in info.splitlines() if line.startswith("host: "))
|
||||
if "windows" not in target and "linux" not in target:
|
||||
parser.error("This milestone packages Windows and Linux only.")
|
||||
manifest = root / "plugins/motif-storyboard/Cargo.toml"
|
||||
if args.standalone and args.plugin != "motif-storyboard":
|
||||
parser.error("Standalone is available only for Motif Storyboard.")
|
||||
manifest = root / "plugins" / args.plugin / "Cargo.toml"
|
||||
cmd = ["cargo", "build", "--manifest-path", str(manifest), "--release", "--locked", "--target", target, "--lib"]
|
||||
if args.standalone:
|
||||
cmd += ["--features", "standalone", "--bin", "motif-storyboard"]
|
||||
subprocess.run(cmd, cwd=root, check=True)
|
||||
build = root / "plugins/motif-storyboard/target" / target / "release"
|
||||
target_root = Path(os.environ.get("CARGO_TARGET_DIR", root / "plugins" / args.plugin / "target"))
|
||||
if not target_root.is_absolute():
|
||||
target_root = root / target_root
|
||||
build = target_root / target / "release"
|
||||
destination = root / "dist" / target
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
library = build / ("motif_storyboard.dll" if "windows" in target else "libmotif_storyboard.so")
|
||||
plugin = destination / "Motif Storyboard.clap"
|
||||
stem = args.plugin.replace("-", "_")
|
||||
library = build / (f"{stem}.dll" if "windows" in target else f"lib{stem}.so")
|
||||
display = "Motif Storyboard" if args.plugin == "motif-storyboard" else "Resonance Compressor"
|
||||
plugin = destination / f"{display}.clap"
|
||||
shutil.copy2(library, plugin)
|
||||
shutil.copy2(root / "LICENSE", destination)
|
||||
shutil.copy2(root / "docs/fl-studio.md", destination / "FL-Studio-setup.md")
|
||||
guide = "fl-studio.md" if args.plugin == "motif-storyboard" else "resonance-compressor.md"
|
||||
shutil.copy2(root / "docs" / guide, destination / f"{args.plugin}-setup.md")
|
||||
if args.plugin == "resonance-compressor":
|
||||
shutil.copy2(root / "crates/resonance-ui/assets/OFL.txt", destination / "Roboto-OFL.txt")
|
||||
shutil.copy2(root / "docs/resonance-editor.png", destination / "resonance-editor.png")
|
||||
if args.standalone:
|
||||
exe = "motif-storyboard.exe" if "windows" in target else "motif-storyboard"
|
||||
shutil.copy2(build / exe, destination)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Validate and archive the two Windows CLAP deliverables; no Linux output."""
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
import struct
|
||||
import zipfile
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
folder = root / "dist/x86_64-pc-windows-gnu"
|
||||
names = [
|
||||
"Motif Storyboard.clap", "Resonance Compressor.clap", "LICENSE",
|
||||
"motif-storyboard-setup.md", "resonance-compressor-setup.md", "Roboto-OFL.txt", "resonance-editor.png",
|
||||
]
|
||||
for name in names[:2]:
|
||||
data = (folder / name).read_bytes()
|
||||
if data[:2] != b"MZ":
|
||||
raise SystemExit(f"{name}: expected Windows PE binary")
|
||||
offset = struct.unpack_from("<I", data, 0x3C)[0]
|
||||
if data[offset:offset + 4] != b"PE\0\0" or struct.unpack_from("<H", data, offset + 4)[0] != 0x8664:
|
||||
raise SystemExit(f"{name}: expected x86-64 Windows DLL")
|
||||
if b"clap_entry\0" not in data:
|
||||
raise SystemExit(f"{name}: CLAP entry export missing")
|
||||
checksums = "".join(f"{hashlib.sha256((folder / name).read_bytes()).hexdigest()} {name}\n" for name in names)
|
||||
(folder / "SHA256SUMS").write_text(checksums, encoding="utf-8")
|
||||
archive = root / "dist/fl-plugins-windows-x86_64.zip"
|
||||
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as output:
|
||||
for name in names + ["SHA256SUMS"]:
|
||||
output.write(folder / name, arcname=name)
|
||||
print(f"Packaged {archive}")
|
||||
Reference in new issue
Block a user