97 lines
2.7 KiB
Bash
Executable file
97 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#
|
|
# Singe 3
|
|
# Copyright (C) 2006-2026 Scott Duensing <scott@kangaroopunch.com>
|
|
#
|
|
# 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
|
|
|
|
# Every platform builds with the zig the build fetches itself; the Pi preset also fetches its
|
|
# platform packages and macOS needs the Apple SDK tarball (see INSTALL).
|
|
# "macos universal" builds both macOS presets and joins them with llvm-lipo.
|
|
if [[ "${OS}" == "macos" && "${ARCH}" == "universal" ]]; then
|
|
buildAll macos aarch64 "$@"
|
|
buildAll macos x86_64 "$@"
|
|
cmake -P cmake/zig/macosUniversal.cmake
|
|
return
|
|
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 \
|
|
llvm \
|
|
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 universal 2>&1 | tee ${G_BUILDDIR}/macos-universal.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
|