Files
Guillaume ASSIERandClaude Opus 5.5 a358aaa262
CI / Formatting, tests and builds (push) Successful in 2m49s
chore(ci): compiler pour Windows sans Nix, avec mingw-w64 et rustup
Le runner n'a pas Nix: l'étape Windows de la CI (#93) était sautée.
Elle prend maintenant aussi le chemin des paquets du système:
`gcc-mingw-w64-x86-64` et la cible rustup `x86_64-pc-windows-gnu`.
`scripts/build-libvpx.sh` sait construire la libvpx statique pour
Windows (LIBVPX_TARGET, CROSS), une fois, dans le cache de la CI.

Sans l'un ni l'autre, l'étape le dit et passe, comme celles de
PipeWire et de GStreamer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 20:45:46 +01:00

65 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
# Builds libvpx locally, without touching the system.
#
# Useful when the `libvpx-dev` package is not available and there are no root
# rights. The `vpx-encode` crate does not build libvpx itself: it has to be
# told where to find it (see the end of the script).
#
# ./scripts/build-libvpx.sh # installs into third_party/libvpx
# ./scripts/build-libvpx.sh /opt/... # another prefix
#
# For Windows, from Linux with mingw-w64 (#93): a static library.
# LIBVPX_TARGET=x86_64-win64-gcc CROSS=x86_64-w64-mingw32- ./scripts/build-libvpx.sh <prefix>
set -eu
# 1.13.0 and nothing newer: the `env-libvpx-sys` crate ships pre-generated
# bindings that stop at this version. Beyond it, the `ffi-generate` feature is
# needed, hence bindgen and libclang on the build machine.
VERSION="${LIBVPX_VERSION:-1.13.0}"
PREFIX="${1:-$(pwd)/third_party/libvpx}"
TARGET="${LIBVPX_TARGET:-}"
WORK="${TMPDIR:-/tmp}/libvpx-build${TARGET:+-$TARGET}"
mkdir -p "$WORK"
cd "$WORK"
if [ ! -f "libvpx-$VERSION.tar.gz" ]; then
curl -sSL -o "libvpx-$VERSION.tar.gz" \
"https://github.com/webmproject/libvpx/archive/refs/tags/v$VERSION.tar.gz"
fi
rm -rf "libvpx-$VERSION"
tar xzf "libvpx-$VERSION.tar.gz"
cd "libvpx-$VERSION"
# `--target=generic-gnu` avoids the assembler (yasm/nasm is often missing) at
# the cost of performance. On a regular build machine, letting libvpx pick its
# x86_64 target gives a much faster encoder.
if [ -n "$TARGET" ]; then
# configure reads the cross compiler from CROSS (exported by the caller).
./configure --prefix="$PREFIX" --target="$TARGET" --as=nasm --disable-examples \
--disable-tools --disable-docs --disable-unit-tests --enable-vp8 \
--disable-shared --enable-static
elif command -v nasm >/dev/null 2>&1; then
./configure --prefix="$PREFIX" --disable-examples --disable-tools \
--disable-docs --disable-unit-tests --enable-vp8
else
echo "nasm missing: building without an assembler, slower encoding" >&2
./configure --prefix="$PREFIX" --target=generic-gnu --disable-examples \
--disable-tools --disable-docs --disable-unit-tests --enable-vp8
fi
make -j"$(nproc 2>/dev/null || echo 1)"
make install
cat <<MSG
libvpx $VERSION installed in $PREFIX
To build rustscreen:
export VPX_LIB_DIR="$PREFIX/lib"
export VPX_INCLUDE_DIR="$PREFIX/include"
export VPX_VERSION="$VERSION"
cargo build
MSG