#!/bin/sh # A small static ffmpeg for the TVs: reads a film, keeps its picture and # subtitles as they are, and turns the sound the TV cannot decode (DTS, # TrueHD, E-AC-3) into AC-3 5.1 or PCM. And, for the bar while seeking and # the black bands of a film (service/frames.js), one small JPEG of a key # frame: the video decoders below are only for that, the picture that # plays never goes through here. # ./build.sh arm -> out/arm/ffmpeg (32-bit ARM, every LG/Samsung) # ./build.sh aarch64 -> out/aarch64/ffmpeg # ./build.sh x86_64 -> out/x86_64/ffmpeg (webOS emulator) # # Works in KYEMA_FFMPEG_DIR (default /Volumes/DATA/dev/kyema-ffmpeg), which # holds src/ffmpeg-9.0.2 (the release tarball from ffmpeg.org, unpacked), # build/ and out/. Needs zig (the cross compiler, with musl) and the llvm # tools from Homebrew. FFmpeg is LGPL 2.1 or later: nothing GPL or nonfree # is enabled here, and this script plus that tarball are the complete # source of the binary the LG package carries (webos/ffmpeg/NOTICE.txt). set -e ARCH=${1:-arm} HERE=${KYEMA_FFMPEG_DIR:-/Volumes/DATA/dev/kyema-ffmpeg} SRC=$HERE/src/ffmpeg-9.0.2 LLVM=/opt/homebrew/opt/llvm/bin case $ARCH in arm) T="arm-linux-musleabihf -mcpu=cortex_a7"; FA=arm ;; aarch64) T="aarch64-linux-musl"; FA=aarch64 ;; x86_64) T="x86_64-linux-musl"; FA=x86_64; EXTRA=--disable-x86asm ;; esac B=$HERE/build/$ARCH; O=$HERE/out/$ARCH rm -rf "$B"; mkdir -p "$B" "$O" # zig cc wrappers: configure wants single words for cc. cat > "$B/cc" < "$B/configure.log" 2>&1 || { tail -30 "$B/configure.log"; exit 1; } make -j10 ffmpeg > "$B/make.log" 2>&1 || { grep -E 'error' "$B/make.log" | head -20; exit 1; } "$LLVM/llvm-strip" -o "$O/ffmpeg" ffmpeg ls -la "$O/ffmpeg"