Some checks failed
Build / Build openSUSE (leap:15.6) (push) Has been cancelled
Build / Build openSUSE (leap:16.0) (push) Has been cancelled
Build / Build openSUSE (tumbleweed) (push) Has been cancelled
Build / Build Fedora (42) (push) Has been cancelled
Build / Build Fedora (43) (push) Has been cancelled
Build / Build Fedora (44) (push) Has been cancelled
Build / Build OpenMandriva (cooker) (push) Has been cancelled
Build / Build Mageia (9) (push) Has been cancelled
Build / Build Debian (bookworm) (push) Has been cancelled
Build / Build Debian (forky) (push) Has been cancelled
Build / Build Debian (trixie) (push) Has been cancelled
Build / Build Ubuntu (noble) (push) Has been cancelled
Build / Build Ubuntu (questing) (push) Has been cancelled
Build / Build Ubuntu (resolute) (push) Has been cancelled
Build / Upload Ubuntu PPA (noble) (push) Has been cancelled
Build / Upload Ubuntu PPA (questing) (push) Has been cancelled
Build / Upload Ubuntu PPA (resolute) (push) Has been cancelled
Build / Build FreeBSD (push) Has been cancelled
Build / Build OpenBSD (push) Has been cancelled
Build / Build macOS Public (release, macos-15) (push) Has been cancelled
Build / Build macOS Public (release, macos-15-intel) (push) Has been cancelled
Build / Build macOS Private (release, macos-arm64) (push) Has been cancelled
Build / Build Windows MinGW (i686, debug) (push) Has been cancelled
Build / Build Windows MinGW (i686, release) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, debug) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, release) (push) Has been cancelled
Build / Build Windows MSVC (arm64, debug, arm64 debug, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (arm64, release, arm64 release, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (x86, debug, x86 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86, release, x86 release, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, debug, x86_64 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, release, x86_64 release, windows-2022) (push) Has been cancelled
Build / Upload (push) Has been cancelled
Build / Attach to release (push) Has been cancelled
156 lines
4.8 KiB
Bash
Executable File
156 lines
4.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ts() { date +"%H:%M:%S"; }
|
|
lower() { echo "$1" | tr '[:upper:]' '[:lower:]'; }
|
|
|
|
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
repo_root="$(cd -- "${script_dir}/../.." && pwd)"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
./build/macos/build_app.sh [--debug|--release] [--deploy] [--dmg] [--clean] [--build-dir <path>]
|
|
|
|
What it does:
|
|
- Configures and builds Strawberry with CMake + Ninja
|
|
- Optional: runs CMake targets 'deploy' (bundle deps) and 'dmg' (create DMG)
|
|
|
|
Options:
|
|
--release Release build (default)
|
|
--debug Debug build
|
|
--deploy Run: cmake --build <builddir> --target deploy
|
|
--dmg Run: cmake --build <builddir> --target dmg (implies --deploy)
|
|
--clean Delete the build dir before configuring
|
|
--build-dir Override build directory (default: <repo>/cmake-build-macos-<config>)
|
|
-h, --help Show help
|
|
EOF
|
|
}
|
|
|
|
config="Release"
|
|
do_deploy=0
|
|
do_dmg=0
|
|
do_clean=0
|
|
build_dir=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--release) config="Release"; shift ;;
|
|
--debug) config="Debug"; shift ;;
|
|
--deploy) do_deploy=1; shift ;;
|
|
--dmg) do_dmg=1; do_deploy=1; shift ;;
|
|
--clean) do_clean=1; shift ;;
|
|
--build-dir) build_dir="${2:-}"; shift 2 ;;
|
|
-h|--help) usage; exit 0 ;;
|
|
*) echo "Unknown arg: $1" >&2; usage; exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$(uname -s)" != "Darwin" ]]; then
|
|
echo "Error: This script is for macOS only." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v xcode-select >/dev/null 2>&1 || ! xcode-select -p >/dev/null 2>&1; then
|
|
echo "Error: Xcode Command Line Tools not found." >&2
|
|
echo "Install them first: xcode-select --install" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
echo "Error: Homebrew ('brew') not found in PATH." >&2
|
|
echo "Install Homebrew first: https://brew.sh/" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v cmake >/dev/null 2>&1; then
|
|
echo "Error: cmake not found. Did you run ./build/macos/install_brew_deps.sh ?" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v ninja >/dev/null 2>&1; then
|
|
echo "Error: ninja not found. Did you run ./build/macos/install_brew_deps.sh ?" >&2
|
|
exit 1
|
|
fi
|
|
|
|
brew_prefix="$(brew --prefix)"
|
|
qt_prefix="$(brew --prefix qt)"
|
|
icu_prefix="$(brew --prefix icu4c || true)"
|
|
|
|
if [[ -z "$build_dir" ]]; then
|
|
build_dir="${repo_root}/cmake-build-macos-$(lower "$config")"
|
|
fi
|
|
|
|
echo "==> [$(ts)] Repo: ${repo_root}"
|
|
echo "==> [$(ts)] Build dir: ${build_dir}"
|
|
echo "==> [$(ts)] Config: ${config}"
|
|
|
|
if [[ "$do_clean" -eq 1 ]]; then
|
|
echo "==> [$(ts)] Cleaning build dir"
|
|
rm -rf "$build_dir"
|
|
fi
|
|
|
|
mkdir -p "$build_dir"
|
|
|
|
# Make pkg-config more reliable with Homebrew.
|
|
export PKG_CONFIG_PATH="${brew_prefix}/lib/pkgconfig:${brew_prefix}/share/pkgconfig:${PKG_CONFIG_PATH:-}"
|
|
|
|
# For dist/CMakeLists.txt Info.plist minimum version logic.
|
|
export MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET:-12.0}"
|
|
|
|
cmake_prefix_path="${qt_prefix};${brew_prefix}"
|
|
|
|
echo "==> [$(ts)] Configuring (CMAKE_PREFIX_PATH=${cmake_prefix_path})"
|
|
cmake_extra_args=()
|
|
|
|
# Optional: override Sparkle update feed / key for your own published builds.
|
|
# Example:
|
|
# export SPARKLE_FEED_URL="https://example.com/appcast.xml"
|
|
# export SPARKLE_PUBLIC_ED25519_KEY="base64=="
|
|
if [[ -n "${SPARKLE_FEED_URL:-}" ]]; then
|
|
cmake_extra_args+=("-DSPARKLE_FEED_URL=${SPARKLE_FEED_URL}")
|
|
fi
|
|
if [[ -n "${SPARKLE_PUBLIC_ED25519_KEY:-}" ]]; then
|
|
cmake_extra_args+=("-DSPARKLE_PUBLIC_ED25519_KEY=${SPARKLE_PUBLIC_ED25519_KEY}")
|
|
fi
|
|
|
|
cmake -S "$repo_root" -B "$build_dir" -G Ninja \
|
|
-DCMAKE_BUILD_TYPE="$config" \
|
|
-DCMAKE_PREFIX_PATH="$cmake_prefix_path" \
|
|
-DCMAKE_FRAMEWORK_PATH="${brew_prefix}/Frameworks;${brew_prefix}/opt/sparkle-framework/Frameworks" \
|
|
-DOPTIONAL_COMPONENTS_MISSING_DEPS_ARE_FATAL=OFF \
|
|
${cmake_extra_args+"${cmake_extra_args[@]}"} \
|
|
${icu_prefix:+-DICU_ROOT="$icu_prefix"}
|
|
|
|
echo "==> [$(ts)] Building"
|
|
cmake --build "$build_dir" --parallel
|
|
|
|
if [[ "$do_deploy" -eq 1 ]]; then
|
|
echo "==> [$(ts)] Preparing env for 'deploy' target (GIO/GStreamer)"
|
|
export GIO_EXTRA_MODULES="${brew_prefix}/lib/gio/modules"
|
|
export GST_PLUGIN_SCANNER="${brew_prefix}/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner"
|
|
export GST_PLUGIN_PATH="${brew_prefix}/lib/gstreamer-1.0"
|
|
|
|
# Optional, but helps dist/macos/macgstcopy.sh bundle libsoup which GStreamer loads dynamically.
|
|
libsoup_prefix="$(brew --prefix libsoup 2>/dev/null || true)"
|
|
if [[ -n "${libsoup_prefix}" ]]; then
|
|
libsoup_dylib="$(ls -1 "${libsoup_prefix}"/lib/libsoup-*.dylib 2>/dev/null | head -n 1 || true)"
|
|
if [[ -n "${libsoup_dylib}" ]]; then
|
|
export LIBSOUP_LIBRARY_PATH="${libsoup_dylib}"
|
|
fi
|
|
fi
|
|
|
|
echo "==> [$(ts)] Running: deploy"
|
|
cmake --build "$build_dir" --target deploy
|
|
fi
|
|
|
|
if [[ "$do_dmg" -eq 1 ]]; then
|
|
echo "==> [$(ts)] Running: dmg"
|
|
cmake --build "$build_dir" --target dmg
|
|
fi
|
|
|
|
echo "==> [$(ts)] Done"
|
|
echo "Built app:"
|
|
echo " ${build_dir}/strawberry.app"
|
|
|