569 lines
16 KiB
Bash
Executable file
569 lines
16 KiB
Bash
Executable file
#!/bin/bash -x
|
|
|
|
#
|
|
# Singe 2
|
|
# Copyright (C) 2006-2024 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.
|
|
#
|
|
|
|
|
|
G_BUILDROOT=${PWD}
|
|
G_BUILDDIR=.builddir
|
|
G_TARGET=
|
|
G_GENERATED=
|
|
|
|
|
|
function buildAll() {
|
|
local OS=$1
|
|
local ARCH=$2
|
|
local COMMON=
|
|
local OPT1=
|
|
|
|
# Activate toolchain for this platform.
|
|
source <(../toolchains/toolchains.sh use ${ARCH} ${OS})
|
|
|
|
G_TARGET=${G_BUILDROOT}/${G_BUILDDIR}/${OS}/${ARCH}
|
|
G_GENERATED=${G_TARGET}/generated
|
|
COMMON="-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${G_TARGET} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}"
|
|
|
|
export LDFLAGS="-L${G_TARGET}/lib ${LDFLAGS}"
|
|
export CFLAGS="-I${G_TARGET}/include ${CFLAGS}"
|
|
export CXXFLAGS="-I${G_TARGET}/include ${CXXFLAGS}"
|
|
export LD_LIBRARY_PATH="${G_TARGET}/lib"
|
|
export PKG_CONFIG_LIBDIR="${G_TARGET}/lib/pkgconfig"
|
|
|
|
mkdir -p ${G_GENERATED}
|
|
|
|
# Needed for Pi sysroot.
|
|
if [[ "${OS}" == "pi" ]]; then
|
|
export CFLAGS="--sysroot=${SYSROOT} ${CFLAGS}"
|
|
export CXXFLAGS="--sysroot=${SYSROOT} ${CXXFLAGS}"
|
|
sudo chroot ${SYSROOT} apt-get -y install libasound-dev libxi-dev libvdpau-dev
|
|
fi
|
|
|
|
if [[ 1 == 1 ]]; then
|
|
pushd thirdparty/bzip2
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DENABLE_SHARED_LIB=off \
|
|
-DENABLE_STATIC_LIB=on \
|
|
-DENABLE_LIB_ONLY=on \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/xz
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DBUILD_SHARED_LIBS=off \
|
|
-DBUILD_TESTING=off \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/zlib
|
|
clearAndEnterBuild
|
|
CFLAGS="-I${PWD}" ../configure \
|
|
--prefix=${G_TARGET} \
|
|
--static
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/zstd
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DZSTD_BUILD_SHARED=off \
|
|
-DZSTD_BUILD_STATIC=on \
|
|
-DZSTD_BUILD_PROGRAMS=off \
|
|
../build/cmake
|
|
make install
|
|
popd
|
|
fi
|
|
|
|
pushd thirdparty/SDL2
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DSDL_SHARED=off \
|
|
-DSDL_STATIC=on \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/SDL2_image
|
|
clearAndEnterBuild
|
|
CFLAGS="-Iexternal/libpng ${CFLAGS}" \
|
|
cmake ${COMMON} \
|
|
-DBUILD_SHARED_LIBS=off \
|
|
-DSDL2IMAGE_DEPS_SHARED=off \
|
|
-DSDL2IMAGE_SAMPLES=off \
|
|
-DSDL2IMAGE_TESTS=off \
|
|
-DSDL2IMAGE_VENDORED=on \
|
|
-DSDL2IMAGE_BACKEND_STB=off \
|
|
-DSDL2IMAGE_AVIF=off \
|
|
-DSDL2IMAGE_JXL=off \
|
|
-DSDL2IMAGE_TIF=off \
|
|
-DSDL2IMAGE_WEBP=on \
|
|
-DSDL2_LIBRARY="${G_TARGET}/lib/libSDL2.a" \
|
|
-DSDL2_INCLUDE_DIR="${G_TARGET}/include/SDL2" \
|
|
-DWEBP_BUILD_ANIM_UTILS=off \
|
|
-DWEBP_BUILD_CWEBP=off \
|
|
-DWEBP_BUILD_DWEBP=off \
|
|
-DWEBP_BUILD_GIF2WEBP=off \
|
|
-DWEBP_BUILD_IMG2WEBP=off \
|
|
-DWEBP_BUILD_VWEBP=off \
|
|
-DWEBP_BUILD_WEBPINFO=off \
|
|
-DWEBP_BUILD_WEBPMUX=off \
|
|
-DWEBP_BUILD_EXTRAS=off \
|
|
..
|
|
# 'make install' failes on zlib, which we don't want anyway.
|
|
make
|
|
cp -f ../include/SDL_image.h "${G_TARGET}/include/SDL2/."
|
|
cp -f libSDL2_image.a "${G_TARGET}/lib/."
|
|
cp -f external/libwebp/libwebp.a "${G_TARGET}/lib/."
|
|
cp -f external/libwebp/libwebpdemux.a "${G_TARGET}/lib/."
|
|
if [[ "${OS}" != "macos" ]]; then
|
|
cp -f external/jpeg/libjpeg.a "${G_TARGET}/lib/."
|
|
cp -f external/libpng/libpng.a "${G_TARGET}/lib/."
|
|
fi
|
|
popd
|
|
|
|
pushd thirdparty/SDL2_mixer
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DBUILD_SHARED_LIBS=off \
|
|
-DSDL2MIXER_CMD=off \
|
|
-DSDL2MIXER_DEPS_SHARED=off \
|
|
-DSDL2MIXER_VENDORED=on \
|
|
-DSDL2MIXER_SAMPLES=off \
|
|
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
|
-DWAVPACK_ENABLE_ASM=no \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/SDL2_ttf
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DBUILD_SHARED_LIBS=off \
|
|
-DSDL2TTF_VENDORED=on \
|
|
-DSDL2TTF_HARFBUZZ=off \
|
|
-DSDL2TTF_SAMPLES=off \
|
|
-DSDL2_DIR=${G_TARGET}/lib/cmake/SDL2 \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/libarchive
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} \
|
|
-DBUILD_SHARED_LIBS=off \
|
|
-DBUILD_TESTING=off \
|
|
-DENABLE_CAT=off \
|
|
-DENABLE_CNG=off \
|
|
-DENABLE_CPIO=off \
|
|
-DENABLE_EXPAT=off \
|
|
-DENABLE_ICONV=off \
|
|
-DENABLE_LIBB2=off \
|
|
-DENABLE_LIBGCC=off \
|
|
-DENABLE_LIBXML2=off \
|
|
-DENABLE_LZ4=off \
|
|
-DENABLE_LZO=off \
|
|
-DENABLE_MBEDTLS=off \
|
|
-DENABLE_NETTLE=off \
|
|
-DENABLE_OPENSSL=off \
|
|
-DENABLE_PCREPOSIX=off \
|
|
-DENABLE_TAR=off \
|
|
-DENABLE_TEST=off \
|
|
-DENABLE_UNZIP=off \
|
|
-DPOSIX_REGEX_LIB=libc \
|
|
-DUSE_BZIP2_STATIC=on \
|
|
-DBZIP2_INCLUDE_DIR="${G_TARGET}/include" \
|
|
-DBZIP2_LIBRARIES="${G_TARGET}/lib/libbz2_static.a" \
|
|
-DZLIB_ROOT="${G_TARGET}" \
|
|
-DLIBLZMA_INCLUDE_DIR="${G_TARGET}/include" \
|
|
-DLIBLZMA_LIBRARY="${G_TARGET}/lib/liblzma.a" \
|
|
-DZSTD_INCLUDE_DIR="${G_TARGET}/include" \
|
|
-DZSTD_LIBRARY="${G_TARGET}/lib/libzstd.a" \
|
|
-DWINDOWS_VERSION=VISTA \
|
|
..
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/openssl
|
|
clearAndEnterBuild
|
|
if [[ "${OS}" == "windows" ]]; then
|
|
if [[ "${ARCH}" == "x86" ]]; then
|
|
OPT1="mingw"
|
|
else
|
|
OPT1="mingw64"
|
|
fi
|
|
else
|
|
OPT1=""
|
|
fi
|
|
if [[ "${OS}" == "pi" ]]; then
|
|
if [[ "${ARCH}" == "aarch64" ]]; then
|
|
OPT1="linux-aarch64"
|
|
else
|
|
OPT1="linux-arm4"
|
|
fi
|
|
fi
|
|
if [[ "${OS}" == "macos" ]]; then
|
|
if [[ "${ARCH}" == "aarch64" ]]; then
|
|
OPT1="darwin64-arm64"
|
|
else
|
|
OPT1="darwin64-x86_64"
|
|
fi
|
|
fi
|
|
../Configure ${OPT1} \
|
|
--prefix="${G_TARGET}" \
|
|
--libdir=lib \
|
|
--with-zlib-include="${G_TARGET}/include" \
|
|
--with-zlib-lib="${G_TARGET}/lib" \
|
|
--with-zstd-include="${G_TARGET}/include" \
|
|
--with-zstd-lib="${G_TARGET}/lib" \
|
|
no-apps \
|
|
no-docs \
|
|
no-dso \
|
|
no-dynamic-engine \
|
|
no-module \
|
|
no-shared \
|
|
no-tests \
|
|
zlib \
|
|
enable-zstd
|
|
make install
|
|
popd
|
|
|
|
lua thirdparty/luasec/src/options.lua -g "${G_TARGET}/include/openssl/ssl.h" > "${G_TARGET}/generated/luasec_options.c"
|
|
mkdir -p "${G_TARGET}/include/luasocket"
|
|
cp -f \
|
|
thirdparty/luasocket/src/*.h \
|
|
"${G_TARGET}/include/luasocket/."
|
|
|
|
if [[ "${OS}" == "pi" ]]; then
|
|
# Hack to make ffmpeg compile.
|
|
mkdir -p "${G_TARGET}/include/sys"
|
|
echo "/* File no longer used */" > "${G_TARGET}/include/sys/sysctl.h"
|
|
fi
|
|
pushd thirdparty/ffmpeg
|
|
clearAndEnterBuild
|
|
# https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows
|
|
../configure \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--disable-debug \
|
|
--disable-muxers \
|
|
--disable-hwaccels \
|
|
--disable-encoders \
|
|
--disable-filters \
|
|
--disable-network \
|
|
--disable-devices \
|
|
--disable-doc \
|
|
--disable-programs \
|
|
--enable-gpl \
|
|
--enable-version3 \
|
|
--extra-ldflags="-L${G_TARGET}/lib" \
|
|
--prefix=${G_TARGET} \
|
|
--arch=${ARCH} \
|
|
--target-os=${CROSS_OS} \
|
|
--cross-prefix=${TRIPLE}- \
|
|
--cc="${CC}" \
|
|
--cxx="${CXX}" \
|
|
--ranlib="${RANLIB}"
|
|
make install
|
|
popd
|
|
|
|
pushd thirdparty/ffms2
|
|
#libtoolize --force
|
|
#aclocal
|
|
#autoheader
|
|
#automake --force-missing --add-missing
|
|
#autoupdate
|
|
#autoconf
|
|
#./autogen.sh
|
|
#make distclean || true
|
|
clearAndEnterBuild
|
|
../configure \
|
|
--prefix=${G_TARGET} \
|
|
--with-zlib=${G_TARGET} \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--target=${TRIPLE} \
|
|
--host=${TRIPLE} \
|
|
--build=x86_64-linux
|
|
make install-libLTLIBRARIES # This weird target prevents building the command line tools.
|
|
popd
|
|
|
|
# === Known FFMPEG Types ===
|
|
createExtensionHeader ffmpeg > ${G_GENERATED}/extensions.h
|
|
|
|
# === Overlay Font ===
|
|
createEmbeddedImage font
|
|
|
|
# === Window Icon ===
|
|
createEmbeddedImage icon
|
|
|
|
# === Kangaroo Punch Logo ===
|
|
createEmbeddedImage kangarooPunchLogo
|
|
|
|
# === Singe Logo ===
|
|
createEmbeddedImage singeLogo
|
|
|
|
# === Laser Disc ===
|
|
createEmbeddedImage laserDisc
|
|
|
|
# === Magnifying Glass ===
|
|
createEmbeddedImage magnifyingGlass
|
|
|
|
# === "Indexing" Text ===
|
|
createEmbeddedImage indexing
|
|
|
|
# === Singe Menu Font ===
|
|
createEmbeddedBinary assets/FreeSansBold.ttf ${G_GENERATED}/FreeSansBold_ttf.h FREESANSBOLD_TTF_H
|
|
|
|
# === Singe Menu Background Video ===
|
|
ffmpeg -i "assets/Singe Engine Intro.mpg" -filter:v 'crop=ih/3*4:ih' -vf scale=720:480 -c:v libx264 -c:a aac -f matroska ${G_TARGET}/temp1.mkv
|
|
ffmpeg -i assets/180503_01_PurpleGrid.mp4 -filter:v 'crop=ih/3*4:ih' -vf scale=720:480 -c:v libx264 -c:a aac -f matroska ${G_TARGET}/temp2.mkv
|
|
ffmpeg -f concat -safe 0 -i <(echo -e "file ${G_TARGET}/temp1.mkv\nfile ${G_TARGET}/temp2.mkv\n") -c copy ${G_TARGET}/menuBackground.mkv
|
|
createEmbeddedBinary ${G_TARGET}/menuBackground.mkv ${G_GENERATED}/menuBackground_mkv.h MENUBACKGROUND_MKV_H
|
|
rm ${G_TARGET}/temp1.mkv ${G_TARGET}/temp2.mkv ${G_TARGET}/menuBackground.mkv
|
|
|
|
# === LuaSocket ===
|
|
createEmbeddedBinary thirdparty/luasocket/src/ftp.lua ${G_GENERATED}/ftp_lua.h FTP_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/headers.lua ${G_GENERATED}/headers_lua.h HEADERS_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/http.lua ${G_GENERATED}/http_lua.h HTTP_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/ltn12.lua ${G_GENERATED}/ltn12_lua.h LTN12_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/mbox.lua ${G_GENERATED}/mbox_lua.h MBOX_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/mime.lua ${G_GENERATED}/mime_lua.h MIME_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/smtp.lua ${G_GENERATED}/smtp_lua.h SMTP_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/socket.lua ${G_GENERATED}/socket_lua.h SOCKET_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/tp.lua ${G_GENERATED}/tp_lua.h TP_LUA_H
|
|
createEmbeddedBinary thirdparty/luasocket/src/url.lua ${G_GENERATED}/url_lua.h URL_LUA_H
|
|
|
|
# === LuaSec ===
|
|
createEmbeddedBinary thirdparty/luasec/src/https.lua ${G_GENERATED}/https_lua.h HTTPS_LUA_H
|
|
createEmbeddedBinary thirdparty/luasec/src/ssl.lua ${G_GENERATED}/ssl_lua.h SSL_LUA_H
|
|
|
|
# === LuaRS232 ===
|
|
createEmbeddedBinary thirdparty/librs232/bindings/lua/rs232.lua ${G_GENERATED}/rs232_lua.h RS232_LUA_H
|
|
|
|
# === Copas ===
|
|
createEmbeddedBinary thirdparty/copas/src/copas.lua ${G_GENERATED}/copas_lua.h COPAS_LUA_H
|
|
createEmbeddedBinary thirdparty/copas/src/copas/ftp.lua ${G_GENERATED}/copas_ftp_lua.h COPAS_FTP_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/http.lua ${G_GENERATED}/copas_http_lua.h COPAS_HTTP_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/smtp.lua ${G_GENERATED}/copas_smtp_lua.h COPAS_SMTP_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/lock.lua ${G_GENERATED}/copas_lock_lua.h COPAS_LOCK_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/queue.lua ${G_GENERATED}/copas_queue_lua.h COPAS_QUEUE_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/semaphore.lua ${G_GENERATED}/copas_semaphore_lua.h COPAS_SEMAPHORE_LUA_H copas
|
|
createEmbeddedBinary thirdparty/copas/src/copas/timer.lua ${G_GENERATED}/copas_timer_lua.h COPAS_TIMER_LUA_H copas
|
|
|
|
# === binaryheap.lua ===
|
|
createEmbeddedBinary thirdparty/binaryheap.lua/src/binaryheap.lua ${G_GENERATED}/binaryheap_lua.h BINARYHEAP_LUA_H
|
|
|
|
# === timerwheel.lua ===
|
|
createEmbeddedBinary thirdparty/timerwheel.lua/src/timerwheel/timerwheel.lua ${G_GENERATED}/timerwheel_lua.h TIMERWHEEL_LUA_H
|
|
|
|
# === json.lua ===
|
|
createEmbeddedBinary thirdparty/json.lua/json.lua ${G_GENERATED}/json_lua.h JSON_LUA_H
|
|
|
|
# === Singe Framework ===
|
|
createEmbeddedBinary assets/Framework.singe ${G_GENERATED}/Framework_singe.h FRAMEWORK_SINGE_H
|
|
|
|
# === Default Config ===
|
|
createEmbeddedBinary assets/controls.cfg ${G_GENERATED}/controls_cfg.h CONTROLS_CFG_H
|
|
|
|
# === Singe Menu App ===
|
|
createEmbeddedBinary assets/Menu.singe ${G_GENERATED}/Menu_singe.h MENU_SINGE_H
|
|
|
|
# === Singe Manual ===
|
|
#lyx -batch -f all -E pdf ${G_GENERATED}/Manual.pdf assets/Manual.lyx
|
|
#createEmbeddedBinary ${G_GENERATED}/Manual.pdf ${G_GENERATED}/Manual_pdf.h MANUAL_H
|
|
|
|
pushd ${G_TARGET}
|
|
clearAndEnterBuild
|
|
cmake ${COMMON} ${G_BUILDROOT}
|
|
make
|
|
#upx -9 --force singe2${SUFFIX}
|
|
mv -f singe2${SUFFIX} ${G_BUILDROOT}/${G_BUILDDIR}/Singe-v2.10-${OS^}-${ARCH}${SUFFIX}
|
|
popd
|
|
}
|
|
|
|
|
|
function clearAndEnterBuild() {
|
|
[[ -d ${G_BUILDDIR} ]] && rm -rf ${G_BUILDDIR}
|
|
mkdir -p ${G_BUILDDIR}
|
|
cd ${G_BUILDDIR}
|
|
}
|
|
|
|
|
|
function createEmbeddedBinary() {
|
|
local BINFILE=$1
|
|
local SOURCEFILE=$2 # This is assumed to be an absolute path
|
|
local BLOCKER=$3
|
|
local PREFIX=$4
|
|
local FILENAME=$(basename ${BINFILE})
|
|
local DIRNAME=$(dirname ${BINFILE})
|
|
|
|
outputLicense > ${SOURCEFILE}
|
|
outputHeader ${BLOCKER} >> ${SOURCEFILE}
|
|
printf "\n#ifdef EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
pushd ${DIRNAME}
|
|
xxd -i ${FILENAME} >> ${SOURCEFILE}
|
|
popd
|
|
if [[ ! -z ${PREFIX} ]]; then
|
|
PREFIX=${PREFIX}_
|
|
sed -i "s/unsigned char /unsigned char ${PREFIX}/" ${SOURCEFILE}
|
|
sed -i "s/unsigned int /unsigned int ${PREFIX}/" ${SOURCEFILE}
|
|
fi
|
|
printf "\n#else // EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
printf "extern unsigned char ${PREFIX}${FILENAME/\./_}[];\n" >> ${SOURCEFILE}
|
|
printf "extern unsigned int ${PREFIX}${FILENAME/\./_}_len;\n" >> ${SOURCEFILE}
|
|
printf "\n#endif // EMBED_HERE\n\n" >> ${SOURCEFILE}
|
|
outputFooter ${BLOCKER} >> ${SOURCEFILE}
|
|
}
|
|
|
|
|
|
function createEmbeddedImage() {
|
|
local BASENAME=$1
|
|
|
|
pushd assets
|
|
convert -flatten -background rgba\(0,0,0,0\) ${BASENAME}.xcf ${G_GENERATED}/${BASENAME}.png
|
|
createEmbeddedBinary ${G_GENERATED}/${BASENAME}.png ${G_GENERATED}/${BASENAME}.h ${BASENAME^^}_H
|
|
rm ${G_GENERATED}/${BASENAME}.png
|
|
popd
|
|
}
|
|
|
|
|
|
function createExtensionHeader() {
|
|
local FFMPEG=$1
|
|
local a=
|
|
local c=0
|
|
|
|
outputLicense
|
|
outputHeader FFMPEG_EXTENSIONS_H
|
|
printf "static char *ffmpegExtensions[] = {\n"
|
|
printf "\t"
|
|
getExtensions "${FFMPEG}" | sort | uniq -u | while read a; do
|
|
printf "\"${a}\", "
|
|
c=$((c + 1))
|
|
if [[ ${c} -ge 10 ]]; then
|
|
printf "\n\t"
|
|
c=0
|
|
fi
|
|
done
|
|
printf "0\n};"
|
|
outputFooter FFMPEG_EXTENSIONS_H
|
|
}
|
|
|
|
|
|
function getExtensions() {
|
|
local FFMPEG=$1
|
|
local a=
|
|
local b=
|
|
local c=
|
|
local d=
|
|
local e=
|
|
local f=
|
|
local g=
|
|
|
|
"${FFMPEG}" -demuxers 2> /dev/null | while read a b c; do
|
|
if [[ "${a}x" == "Dx" ]]; then
|
|
"${FFMPEG}" -h demuxer=${b} 2> /dev/null | grep "Common extensions" | while read d e f; do
|
|
g=${f/./}
|
|
echo -e "${g//,/\\n}"
|
|
done
|
|
fi
|
|
done
|
|
}
|
|
|
|
|
|
function outputFooter() {
|
|
local BLOCKER=$1
|
|
|
|
printf "\n#pragma GCC diagnostic pop\n\n\n#endif // ${BLOCKER}\n"
|
|
}
|
|
|
|
|
|
function outputHeader() {
|
|
local BLOCKER=$1
|
|
|
|
printf "\n\n#ifndef ${BLOCKER}\n#define ${BLOCKER}\n\n\n"
|
|
printf "// ===== THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT =====\n\n\n"
|
|
printf "#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n"
|
|
}
|
|
|
|
|
|
function outputLicense() {
|
|
cat <<- LICENSE
|
|
/*
|
|
*
|
|
* Singe 2
|
|
* Copyright (C) 2006-2024 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 License
|
|
* 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.
|
|
*
|
|
*/
|
|
LICENSE
|
|
}
|
|
|
|
|
|
# -e = stop script on errors
|
|
# -u = stop script on undefined variable
|
|
# -o pipefail = stop pipeline if any step fails
|
|
set -e
|
|
|
|
|
|
mkdir -p ${G_BUILDDIR}
|
|
|
|
|
|
# These are required for the build.
|
|
sudo apt-get install -y \
|
|
xxd \
|
|
imagemagick \
|
|
lua5.4 \
|
|
lyx \
|
|
ffmpeg \
|
|
libasound-dev \
|
|
libxi-dev \
|
|
libvdpau-dev \
|
|
upx-ucl
|
|
|
|
|
|
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
|
|
|
|
|
|
# === UNSUPPORTED ===
|
|
|
|
#buildAll macos x86_64 2>&1 | tee ${G_BUILDDIR}/macos-x86_64.log
|
|
#buildAll linux x86
|
|
#buildAll macos x86 #***TODO*** Needs older SDL2
|
|
#buildAll windows x86
|