Bundling Ardour for use outside MSYS2

After building Ardour in MSYS2 using this recipe https://discourse.ardour.org/t/building-ardour-on-windows-using-msys2 I tried to gather all the necessary files (including system libraries etc) to run Ardour outside of MSYS2.

I can start the binary so I think the required executables are in place, but the directory that Ardour looks for files like the Jack and MIDI libraries seem to be off, as well as the directories for fonts?

I’m calling this script from the main ardour directory (where the waf executable is):

#!/usr/bin/env bash
set -e

# ----------------------------
# Configurable paths
# ----------------------------
builddir="${1:-$(pwd)/build/gtk2_ardour}"
distdir="${2:-$(pwd)/ardour9-dist}"
mingwroot="/mingw64"

echo "Packaging Ardour from: $builddir"
echo "Output: $distdir"

# Create necessary directories
mkdir -p "$distdir/bin" "$distdir/lib" "$distdir/share/ardour9"

# ----------------------------
# [1] Copy the main Ardour binary
# ----------------------------
echo "[1/7] Copying Ardour executable..."
find "$builddir" -maxdepth 1 -type f -iname "ardour-*.exe" -exec cp -u {} "$distdir/bin/" \;

# ----------------------------
# [2] Find and copy DLLs from build/libs
# ----------------------------
echo "[2/7] Copying all DLLs from build/libs..."

# Search for DLLs under build/libs, flattening the directory structure
find "$builddir/../libs" -type f -iname "*.dll" | while read dll; do
    # Copy DLLs to distdir/bin or distdir/lib depending on the type of DLL
    if [[ "$dll" == *"ardour"* ]]; then
        cp -u "$dll" "$distdir/bin/" 2>/dev/null || true
    else
        cp -u "$dll" "$distdir/lib/" 2>/dev/null || true
    fi
done

# ----------------------------
# [3] Copy runtime DLLs from MinGW (core dependencies)
# ----------------------------
echo "[3/7] Copying MinGW runtime DLLs..."
ldd "$distdir/bin/ardour-"*.exe | grep "=>" | awk '{print $3}' | grep "$mingwroot/bin" | while read -r dll; do
    [ -f "$dll" ] && cp -u "$dll" "$distdir/bin/" 2>/dev/null || true
done

# ----------------------------
# [4] Copy plugin libraries
# ----------------------------
echo "[4/7] Copying plugin libraries..."
for dir in ladspa lv2 vamp; do
    mkdir -p "$distdir/lib/$dir"
    find "$mingwroot/lib/$dir" -maxdepth 1 -type f -exec cp -u {} "$distdir/lib/$dir/" \; 2>/dev/null || true
done

# ----------------------------
# [5] Copy fonts, themes, resources, examples, and share directories
# ----------------------------
echo "[5/7] Copying Ardour runtime data..."

# Fonts
fontdir="$distdir/share/ardour9/fonts"
mkdir -p "$fontdir"
find "$(pwd)/gtk2_ardour" -type f \( -iname "ArdourSans.ttf" -o -iname "ArdourMono.ttf" \) -exec cp -u {} "$fontdir/" \; 2>/dev/null || true

# Themes
if [ -d "$builddir/themes" ]; then
    cp -r "$builddir/themes" "$distdir/share/ardour9/" 2>/dev/null || true
fi

# Resources
if [ -d "$builddir/resources" ]; then
    cp -r "$builddir/resources" "$distdir/share/ardour9/" 2>/dev/null || true
fi

# Additional share content (examples, web_surfaces, etc.)
if [ -d "$builddir/share" ]; then
    cp -r "$builddir/share"/* "$distdir/share/ardour9/" 2>/dev/null || true
fi

# ----------------------------
# [6] Create launcher
# ----------------------------
echo "[6/7] Creating launcher script..."
launcher="$distdir/ardour9.cmd"
cat > "$launcher" << EOF
@echo off
setlocal
# Set ARDOUR_DATA_PATH to the share directory
set ARDOUR_DATA_PATH=%~dp0share
echo ARDOUR_DATA_PATH is set to %ARDOUR_DATA_PATH%
start "" "%~dp0bin\ardour-9.0.pre0.1903.exe" %*
endlocal
EOF
chmod +x "$launcher"

# ----------------------------
# [7] Summary
# ----------------------------
echo "Packaging complete."
echo "Output folder: $distdir"

But when I call the executable from the “distribution” directory, the directories seem to be somewhere different than expected:

$ ARDOUR_DATA_PATH=$PWD/share bin/ardour-9.0.pre0.1903
Cannot find ArdourMono TrueType font
Cannot find ArdourSans TrueType font
Ardour9.0.pre0.1903 (built using 9.0-pre0-1903-g3098c70fcf and GCC version 15.2.0)
Ardour: [INFO]: MMCSS Initialized
Ardour: [INFO]: Your system is configured to limit Ardour to 2048 open files
ARDOUR_CONFIG_PATH not set in environment
Ardour: [INFO]: Loading user configuration file C:\Users\amwin\AppData\Local\Ardour9\config
Ardour: [INFO]: CPU vendor: GenuineIntel
Ardour: [INFO]: AVX capable processor
Ardour: [INFO]: AVX with FMA capable processor
Ardour: [INFO]: CPU brand: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Ardour: [INFO]: No H/W specific optimizations in use
Ardour: [WARNING]: VST scanner app (ardour-vst-scanner) not found in path D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\lib\ardour9\fst;D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\bin
Ardour: [WARNING]: VST3 scanner app (ardour-vst3-scanner) not found in path D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\lib\ardour9\fst;D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\bin
Ardour: [INFO]: Loading user ui configuration file C:\Users\amwin\AppData\Local\Ardour9\ui_config
Ardour: [ERROR]: no theme file was found; colors will be odd
Ardour: [WARNING]: Unable to find UI style file clearlooks.rc in search path C:\Users\amwin\AppData\Local\Ardour9;C:\ProgramData\Ardour\.config\win64;D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\share\ardour9. Ardour will look strange
Color transport clock: background not found
Color transport clock: text not found
Color transport clock: edited text not found
Color transport clock: cursor not found
Color secondary clock: background not found
Color secondary clock: text not found
Color secondary clock: edited text not found
Color secondary clock: cursor not found
Color big clock: background not found
Color big clock: text not found
Color big clock: edited text not found
Color big clock: cursor not found
Ardour: [ERROR]: Default keybindings not found - Ardour will be hard to use!
Ardour: [ERROR]: Global keybindings are missing
Color gtk_background not found
Color gtk_foreground not found
Color theme:contrasting clock not found
couldn't load font "ArdourSans Not-Rotated 7", falling back to "Sans Not-Rotated 7", expect ugly output.Ardour: [WARNING]: Unable to find UI style file clearlooks.rc in search path C:\Users\amwin\AppData\Local\Ardour9;C:\ProgramData\Ardour\.config\win64;D:\usr\local\msys2\home\amwin\ardour\ardour9-dist\share\ardour9. Ardour will look strange
audio-midi engine setup failed.

and I get a dialog that says: “No audio/MIDI backends detected. Ardour cannot run (This is a build/packaging system error. It should never happen)”

When I look in the bin/ directory and all the DLL files that I have copied there from the build tree, I can see:

$ ls bin/*midi* bin/*jack*
bin/ardour_generic_midi.dll  bin/ardour_midisurface.dll  bin/jack_audiobackend.dll  bin/midipp.dll

which are all in the same directory next to the Ardour executable. Should than not make all the DLLs findable? And the 2 fonts are definitely in share/ardour9/fonts.

I was trying to compile Ardour for someone who does not use MSYS2, but I’m not 100% sure it will work. Maybe MSYS2 is not the route? Happy to hear how others did this!