Files
waozi fb05120cc5 Build the WebP decoder for Android and read the libwebp pin from the manifest
native/Android.cmake links the decoder into an Android app's native
target, and ziran.toml names it under [tool.android.native] for
src/libwebp.zi. native/build.sh checks the fetched libwebp against the
ref in ziran.toml instead of a second copy of the commit.
2026-11-23 04:40:36 -03:00

19 lines
1.0 KiB
Bash

#!/bin/sh
# Invoke via build-queue; all generated output belongs to this package.
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
source=${1:?provide pinned libwebp source package}
pin=$(awk '
/^\[/ { selected = ($0 == "[dependencies.libwebp]") }
selected && /^ref[[:space:]]*=/ { split($0, fields, "\""); print fields[2]; exit }
' "$root/ziran.toml")
test -n "$pin" && test "$(git -C "$source" rev-parse HEAD)" = "$pin" || exit 1
mkdir -p "$root/build/native"
if test "${WEBP_NATIVE_LOCK_HELD:-}" != "$root"; then
exec flock "$root/build/native.lock" env WEBP_NATIVE_LOCK_HELD="$root" sh "$0" "$@"
fi
cmake -S "$root/native" -B "$root/build/native" -DWEBP_DIR="$source" -DCMAKE_BUILD_TYPE=Release
cmake --build "$root/build/native" --target imagewebp --parallel 1
"${CC:-cc}" -shared -Wl,-z,defs -Wl,--whole-archive "$root/build/native/libimagewebp.a" -Wl,--no-whole-archive -lm -o "$root/build/native/libimagewebp.so.pending"
mv "$root/build/native/libimagewebp.so.pending" "$root/build/native/libimagewebp.so"