chore: move build output under build/ and scripts into scripts/

Layout:
- scripts/ holds the four build scripts plus the new clean.sh
- cmake/ holds mingw64-toolchain.cmake
- the scripts default to build/linux, build/macos, build/windows, build/harness
- docs/ holds the audit documents, with the round 1 task list archived

Cleanup:
- scripts/clean.sh removes generated output, with --dry-run, --staging,
  --legacy and --all, and refuses tracked, protected or outside paths
- the Windows VST3 manifest now comes from cmake/moduleinfo.json.in, so its
  version, vendor and class IDs follow cmake/Plugin.cmake instead of a
  hand-written heredoc that could drift
- deleted the unused Source/GUI/Slider, which no code constructed
- fixed the hidden double processBlock overload: three warning lines to zero
- unslopped the build scripts, the two .cjs helpers and the CMake comments
- .gitignore covers the upstream JUCE Projucer and DemoRunner binaries

Verified: five scripts pass bash -n; the harness passes CTest with zero
warning lines; the Linux VST3 and Standalone link; the Windows cross-build
passes its x86-64, runtime-import and entry-point checks; each configure
exposes only its own targets; and a full build leaves Source/ and
third_party/JUCE unchanged. The generated manifest is identical to the
previous hand-written one.
This commit is contained in:
biggy committed 2026-10-06 09:06:53 +02:00
1 parent e4cea300db
commit facd5c5b5e
25 files changed
+438 -313

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Build the headless QA harness. Pass --run to execute it through CTest.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build/harness}"
BUILD_TYPE="${BUILD_TYPE:-Release}"
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
if [[ $# -gt 1 || ( $# -eq 1 && "$1" != --run ) ]]; then
echo "Usage: $0 [--run]" >&2
exit 1
fi
TOOLS=(cmake ninja "${CC:-cc}" "${CXX:-c++}")
case "$(uname -s)" in
Linux) TOOLS+=(pkg-config) ;;
Darwin) TOOLS+=(xcrun) ;;
*) echo "ERROR: scripts/build_harness.sh requires a Linux or macOS host." >&2; exit 1 ;;
esac
if [[ $# -eq 1 ]]; then
TOOLS+=(ctest)
fi
for tool in "${TOOLS[@]}"; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "ERROR: $tool not found. See README.md prerequisites." >&2
exit 1
fi
done
if [[ "$(uname -s)" == Darwin ]]; then
xcrun --sdk macosx --show-sdk-path
fi
echo "Configuring the native QA harness in $BUILD_DIR ($BUILD_TYPE)..."
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DSERUMALT_BUILD_PLUGIN=OFF \
-DSERUMALT_BUILD_TESTS=ON
echo "Building SerumAltTest..."
cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --target SerumAltTest
if [[ $# -eq 1 ]]; then
echo "Running the QA harness with CTest..."
ctest --test-dir "$BUILD_DIR" --build-config "$BUILD_TYPE" --output-on-failure --no-tests=error
fi
echo "Done. QA harness: $BUILD_DIR/SerumAltTest_artefacts/$BUILD_TYPE/SerumAltTest"
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Build the Linux production plugin: VST3 and Standalone.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build/linux}"
BUILD_TYPE="${BUILD_TYPE:-Release}"
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
if [[ "$(uname -s)" != Linux ]]; then
echo "ERROR: scripts/build_linux.sh requires a Linux host." >&2
exit 1
fi
for tool in cmake ninja pkg-config "${CC:-cc}" "${CXX:-c++}"; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "ERROR: $tool not found. See README.md prerequisites." >&2
exit 1
fi
done
echo "Configuring Linux production targets in $BUILD_DIR ($BUILD_TYPE)..."
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DSERUMALT_BUILD_PLUGIN=ON \
-DSERUMALT_BUILD_TESTS=OFF
echo "Building Linux VST3 and standalone..."
cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --target SerumAlt_VST3 SerumAlt_Standalone
echo "Done. Linux artifacts: $BUILD_DIR/SerumAlt_artefacts/$BUILD_TYPE"
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Build the macOS production plugin: VST3, AU and Standalone.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build/macos}"
BUILD_TYPE="${BUILD_TYPE:-Release}"
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
if [[ "$(uname -s)" != Darwin ]]; then
echo "ERROR: scripts/build_macos.sh requires macOS and the Apple SDK." >&2
exit 1
fi
for tool in cmake ninja xcrun "${CC:-clang}" "${CXX:-clang++}"; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "ERROR: $tool not found. See README.md prerequisites." >&2
exit 1
fi
done
xcrun --sdk macosx --show-sdk-path
OSX_OPTIONS=("-DCMAKE_BUILD_TYPE=$BUILD_TYPE")
if [[ -n "${CMAKE_OSX_ARCHITECTURES:-}" ]]; then
OSX_OPTIONS+=("-DCMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES")
fi
if [[ -n "${CMAKE_OSX_DEPLOYMENT_TARGET:-}" ]]; then
OSX_OPTIONS+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET")
fi
echo "Configuring macOS production targets in $BUILD_DIR ($BUILD_TYPE)..."
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" -G Ninja \
"${OSX_OPTIONS[@]}" \
-DSERUMALT_BUILD_PLUGIN=ON \
-DSERUMALT_BUILD_TESTS=OFF
echo "Building macOS VST3, AU, and standalone..."
cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --target SerumAlt_VST3 SerumAlt_AU SerumAlt_Standalone
echo "Done. macOS artifacts: $BUILD_DIR/SerumAlt_artefacts/$BUILD_TYPE"
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
# Cross-compile the Windows x64 VST3 from Linux with MinGW-w64.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
TOOLCHAIN_FILE="$REPO_ROOT/cmake/mingw64-toolchain.cmake"
BUILD_DIR="${BUILD_DIR:-$REPO_ROOT/build/windows}"
BUILD_TYPE="${BUILD_TYPE:-Release}"
OUTPUT_DIR="${OUTPUT_DIR:-$REPO_ROOT/SerumAlt_Windows}"
PLUGIN_NAME="SerumAlt"
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
if [[ "$(uname -s)" != Linux ]]; then
echo "ERROR: scripts/build_windows.sh cross-compiles from Linux with MinGW-w64." >&2
exit 1
fi
for tool in cmake ninja pkg-config "${CC:-cc}" "${CXX:-c++}" \
x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++ \
x86_64-w64-mingw32-windres x86_64-w64-mingw32-ar \
x86_64-w64-mingw32-ranlib x86_64-w64-mingw32-strip \
x86_64-w64-mingw32-objdump; do
if ! command -v "$tool" >/dev/null 2>&1; then
echo "ERROR: $tool not found. See README.md prerequisites." >&2
exit 1
fi
done
if [[ ! -f "$TOOLCHAIN_FILE" ]]; then
echo "ERROR: toolchain file not found: $TOOLCHAIN_FILE" >&2
exit 1
fi
echo "Configuring Windows VST3 in $BUILD_DIR ($BUILD_TYPE)..."
cmake -S "$REPO_ROOT" -B "$BUILD_DIR" -G Ninja \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
-DSERUMALT_BUILD_PLUGIN=ON \
-DSERUMALT_BUILD_TESTS=OFF
echo "Building Windows VST3..."
cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --target SerumAlt_VST3
# A stock Windows host has neither the MinGW C++ runtime nor the MinGW threading
# runtime, so a module that imports one fails to load and the host drops it from
# its plugin list. cmake/Plugin.cmake links both statically; these checks fail the
# build when that link option is missing from a cached or a fresh build tree.
VST3_BUNDLE="$BUILD_DIR/${PLUGIN_NAME}_artefacts/$BUILD_TYPE/VST3/$PLUGIN_NAME.vst3"
VST3_BINARY="$VST3_BUNDLE/Contents/x86_64-win/$PLUGIN_NAME.vst3"
if [[ ! -f "$VST3_BINARY" ]]; then
echo "ERROR: cross-build produced no module at $VST3_BINARY" >&2
exit 1
fi
if ! x86_64-w64-mingw32-objdump -f "$VST3_BINARY" | grep -q 'i386:x86-64'; then
echo "ERROR: $VST3_BINARY is not an x86-64 module" >&2
exit 1
fi
VST3_DUMP="$(x86_64-w64-mingw32-objdump -p "$VST3_BINARY")"
for runtime in libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll; do
if grep -qF "DLL Name: $runtime" <<<"$VST3_DUMP"; then
echo "ERROR: $VST3_BINARY still imports $runtime." >&2
echo " Restore the static-runtime link options in cmake/Plugin.cmake" >&2
echo " and rebuild with a fresh BUILD_DIR." >&2
exit 1
fi
done
# JUCE defines only these entry points on Windows. bundleEntry and bundleExit are
# macOS-only, and the VST3 SDK loader requires GetPluginFactory while treating
# InitDll and ExitDll as optional.
for entry in GetPluginFactory InitDll ExitDll; do
if ! grep -qE "[[:space:]]${entry}\$" <<<"$VST3_DUMP"; then
echo "ERROR: $VST3_BINARY does not export $entry" >&2
exit 1
fi
done
# JUCE's manifest helper is a host tool, so a cross-build disables it and CMake
# writes moduleinfo.json from cmake/moduleinfo.json.in instead.
MANIFEST="$BUILD_DIR/moduleinfo.json"
if [[ ! -f "$MANIFEST" ]]; then
echo "ERROR: CMake wrote no manifest at $MANIFEST" >&2
exit 1
fi
mkdir -p "$VST3_BUNDLE/Contents/Resources"
cmake -E copy "$MANIFEST" "$VST3_BUNDLE/Contents/Resources/moduleinfo.json"
echo "Staging Windows VST3 in $OUTPUT_DIR..."
cmake -E copy_directory "$VST3_BUNDLE" "$OUTPUT_DIR/$PLUGIN_NAME.vst3"
echo
echo "Done. Windows VST3 plugin at: $OUTPUT_DIR/$PLUGIN_NAME.vst3"
+137
View File
@@ -0,0 +1,137 @@
#!/usr/bin/env bash
# Remove generated build output from this checkout.
#
# Targets are limited to directories this project generates. Nothing tracked by
# git is removed, and Source/, third_party/, .git and the other project
# directories are refused even if they are named as a target.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
usage() {
cat <<'EOF'
Usage: scripts/clean.sh [options]
Removes generated build output. With no options it removes the build trees
under build/.
Options:
--staging also remove the staged Windows bundle, SerumAlt_Windows/
--legacy also remove build trees left in the repository root by earlier
versions of the build scripts (build_*, cmake-build-*)
--all --staging and --legacy together
--dry-run print every path and its size, and remove nothing
-h, --help print this text
EOF
}
DRY_RUN=false
STAGING=false
LEGACY=false
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
--staging) STAGING=true ;;
--legacy) LEGACY=true ;;
--all) STAGING=true; LEGACY=true ;;
-h|--help) usage; exit 0 ;;
*) echo "ERROR: unknown option: $arg" >&2; usage >&2; exit 2 ;;
esac
done
if ! command -v git >/dev/null 2>&1; then
echo "ERROR: git is required to confirm that no tracked file is removed." >&2
exit 2
fi
# A build directory outside the repository belongs to some other checkout, and
# this script has no business deciding whether it is disposable.
for var in BUILD_DIR OUTPUT_DIR; do
value="${!var:-}"
[ -n "$value" ] || continue
case "$value" in
/*) abs="$value" ;;
*) abs="$REPO_ROOT/$value" ;;
esac
abs="$(realpath -m -- "$abs" 2>/dev/null || printf '%s' "$abs")"
case "$abs" in
"$REPO_ROOT"/*) ;;
*)
echo "ERROR: $var=$value resolves outside $REPO_ROOT." >&2
echo " Unset $var to clean this repository." >&2
exit 2
;;
esac
done
PROTECTED=(Source third_party .git scripts cmake docs graft)
refused=0
removed=0
remove_target() {
local path="$1"
[ -e "$path" ] || return 0
local abs rel size
abs="$(realpath -m -- "$path")"
rel="${abs#"$REPO_ROOT"/}"
case "$abs" in
"$REPO_ROOT"/*) ;;
*)
echo "refusing, outside the repository: $abs" >&2
refused=$((refused + 1))
return 1
;;
esac
local deny
for deny in "${PROTECTED[@]}"; do
if [ "$rel" = "$deny" ] || [ "${rel#"$deny"/}" != "$rel" ]; then
echo "refusing, protected path: $rel" >&2
refused=$((refused + 1))
return 1
fi
done
if [ -n "$(git ls-files -- "$rel")" ]; then
echo "refusing, tracked by git: $rel" >&2
refused=$((refused + 1))
return 1
fi
size="$(du -sh -- "$rel" 2>/dev/null | cut -f1)"
if [ "$DRY_RUN" = true ]; then
printf 'would remove %6s %s\n' "${size:-?}" "$rel"
else
rm -rf -- "$abs"
printf 'removed %6s %s\n' "${size:-?}" "$rel"
fi
removed=$((removed + 1))
}
TARGETS=("$REPO_ROOT/build")
if [ "$STAGING" = true ]; then
TARGETS+=("$REPO_ROOT/SerumAlt_Windows")
fi
if [ "$LEGACY" = true ]; then
shopt -s nullglob
for dir in "$REPO_ROOT"/build_* "$REPO_ROOT"/cmake-build-*; do
TARGETS+=("$dir")
done
shopt -u nullglob
fi
for target in "${TARGETS[@]}"; do
remove_target "$target" || true
done
if [ "$removed" -eq 0 ] && [ "$refused" -eq 0 ]; then
echo "Nothing to remove."
elif [ "$DRY_RUN" = true ]; then
echo "Dry run: $removed path(s) listed, nothing removed."
fi
[ "$refused" -eq 0 ]