Files
Scott GarrettandClaude Code 72e879e316 Add a slim sup2vob CLI built from the vendored Sup2Vob sources
The extractsubs helper shipped in the Subler app bundle needs sup2vob
on PATH, so the converter gets a CLI build beside the framework target.
Slim by design: this directory holds only upstream's main.swift and a
Makefile that compiles it against ../MP42/Sup2Vob/ — the exact files the
framework builds, so an upstream merge updates app and CLI in one pass
and the two can never silently disagree. The CLI's --full output is the
byte-identical oracle for the framework converter (verified: same
sub/idx bytes for a full movie track).

main.swift is upstream verbatim except for the documented globals seam:
the CLI's debugFrames/fullFramePassthrough declarations belong to the
vendored Convert.swift, so main.swift drops its re-declaration and only
assigns them (--debug/--full). The framework facade
(MP42SupConverter.swift) is deliberately not part of the CLI build.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-28 23:06:27 -05:00

38 lines
1.2 KiB
Makefile

# sup2vob — PGS (.sup) -> VobSub (.sub/.idx) converter CLI
#
# Slim CLI: the conversion sources are NOT vendored a second time here —
# they are the framework's ../MP42/Sup2Vob/ files, so the CLI and the app
# always run identical conversion code (the CLI's byte-identical `--full`
# output is the framework converter's verification oracle). Only
# main.swift lives in this directory; see its header for the single
# upstream adaptation. MP42SupConverter.swift (the framework's ObjC
# facade over the same conversion) is deliberately not compiled in.
#
# Build: make -> ./sup2vob
# Clean: make clean
SWIFTC ?= swiftc
OPTFLAGS ?= -O
TARGET := sup2vob
PREFIX ?= /usr/local
CONV := ../MP42/Sup2Vob
SOURCES := main.swift $(CONV)/PGS.swift $(CONV)/Convert.swift $(CONV)/VobSub.swift
.PHONY: all clean rebuild install
all: $(TARGET)
$(TARGET): $(SOURCES)
$(SWIFTC) $(OPTFLAGS) -o $(TARGET) $(SOURCES)
clean:
rm -f $(TARGET)
rebuild: clean all
# extractsubs (shipped in the Subler app bundle's Resources) resolves
# sup2vob from PATH, so a rebuild only takes effect once installed
# (usually: sudo make install).
install: $(TARGET)
install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)