#!/bin/bash # # Singe 2 # Copyright (C) 2006-2024 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 only prepares the toolchain environment 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 # Activate the toolchain for this platform (PATH, compilers, sysroot, osxcross variables). source <(../toolchains/toolchains.sh use ${ARCH} ${OS}) # The Pi sysroot needs the development packages the build links against. if [[ "${OS}" == "pi" ]]; then sudo chroot ${SYSROOT} apt-get -y install libasound-dev libxi-dev libvdpau-dev libdrm-dev 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 if [[ ! -x ../toolchains/toolchains.sh ]]; then echo "error: ../toolchains/toolchains.sh not found (see INSTALL)" >&2 exit 1 fi mkdir -p ${G_BUILDDIR} # These are required for the build. sudo apt-get install -y \ imagemagick \ lua5.4 \ ffmpeg \ asciidoctor \ ruby-asciidoctor-pdf \ autoconf \ automake \ libtool \ libasound-dev \ libxi-dev \ libvdpau-dev \ libva-dev \ libdrm-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