#!/bin/bash # # Singe 3 # Copyright (C) 2006-2026 Scott Duensing # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public Licens # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # # Builds Singe and every vendored library for one platform, or all of them. The work is done # by the CMake superbuild (cmake/Superbuild.cmake, one preset per platform in # CMakePresets.json); this script installs the host packages and calls it: # # ./build-all.sh every supported platform # ./build-all.sh linux x86_64 one platform # # Anything cmake --build accepts can follow the platform, so a single library can be redone: # # ./build-all.sh linux x86_64 --target rebuild-ffmpeg G_BUILDDIR=.builddir function buildAll() { local OS=$1 local ARCH=$2 shift 2 # Linux builds with the host compiler and Windows with the zig the build fetches itself. The Pi # and macOS presets still lean on the toolchains repository beside this one until they move to # zig as well (PLAN.md section 17). if [[ "${OS}" == "pi" || "${OS}" == "macos" ]]; then if [[ ! -x ../toolchains/toolchains.sh ]]; then echo "error: ${OS} still needs ../toolchains/toolchains.sh" >&2 exit 1 fi source <(../toolchains/toolchains.sh use ${ARCH} ${OS}) if [[ "${OS}" == "pi" ]]; then sudo chroot ${SYSROOT} apt-get -y install libasound-dev libxi-dev libvdpau-dev libdrm-dev fi fi cmake --preset ${OS}-${ARCH} cmake --build --preset ${OS}-${ARCH} "$@" } # -e = stop script on errors # -u = stop script on undefined variable # -o pipefail = stop pipeline if any step fails set -euo pipefail mkdir -p ${G_BUILDDIR} # Host packages the build needs on a Debian based system (the same list is in INSTALL). sudo apt-get install -y \ build-essential \ cmake \ pkg-config \ perl \ nasm \ imagemagick \ lua5.4 \ ffmpeg \ asciidoctor \ ruby-asciidoctor-pdf \ autoconf \ automake \ libtool \ libasound-dev \ libxi-dev \ libvdpau-dev \ libva-dev \ libdrm-dev \ libgl-dev \ libx11-dev if [[ $# -ge 2 ]]; then buildAll "$@" 2>&1 | tee ${G_BUILDDIR}/$1-$2.log else buildAll linux x86_64 2>&1 | tee ${G_BUILDDIR}/linux-x86_64.log buildAll macos aarch64 2>&1 | tee ${G_BUILDDIR}/macos-aarch64.log buildAll pi aarch64 2>&1 | tee ${G_BUILDDIR}/pi-aarch64.log buildAll windows x86_64 2>&1 | tee ${G_BUILDDIR}/windows-x86_64.log fi