Rebuild local Blender WASM environment and recovery evidence
This commit is contained in:
59
tools/web/build-blender-native.sh
Executable file
59
tools/web/build-blender-native.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
"${repo_root}/tools/web/configure-blender-native.sh" "$@"
|
||||
source "${repo_root}/tools/web/native-build-env.sh"
|
||||
|
||||
build_target="${BLENDER_BUILD_TARGET:-blender}"
|
||||
jobs="${BLENDER_BUILD_JOBS:-2}"
|
||||
cmake --build "${BLENDER_BUILD_DIR}" --target "${build_target}" --parallel "${jobs}"
|
||||
test -x "${BLENDER_BUILD_DIR}/bin/blender"
|
||||
|
||||
# Blender's bundled asset-library add-on imports cattrs, while upstream's
|
||||
# install rules only copy NumPy, requests, and zstandard. Copy the small
|
||||
# pure-Python dependency set into the portable bundle after installation.
|
||||
if [[ "${build_target}" == "install" ]]; then
|
||||
bundle_site="${BLENDER_BUILD_DIR}/bin/5.2/python/lib/python3.13/site-packages"
|
||||
source_site="${BLENDER_PYTHON_ROOT}/lib/python3.13/site-packages"
|
||||
mkdir -p "${bundle_site}"
|
||||
for package in cattrs attrs attr cattr; do
|
||||
if [[ -d "${source_site}/${package}" ]]; then
|
||||
rm -rf "${bundle_site:?}/${package}"
|
||||
cp -a "${source_site}/${package}" "${bundle_site}/"
|
||||
fi
|
||||
done
|
||||
if [[ -d "${source_site}/numpy.libs" ]]; then
|
||||
rm -rf "${bundle_site:?}/numpy.libs"
|
||||
cp -a "${source_site}/numpy.libs" "${bundle_site}/"
|
||||
fi
|
||||
for module in typing_extensions.py; do
|
||||
if [[ -f "${source_site}/${module}" ]]; then
|
||||
cp -a "${source_site}/${module}" "${bundle_site}/"
|
||||
fi
|
||||
done
|
||||
for metadata in "${source_site}"/{cattrs,attrs,typing_extensions}-*.dist-info; do
|
||||
if [[ -d "${metadata}" ]]; then
|
||||
cp -a "${metadata}" "${bundle_site}/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Keep historical task cards runnable while the clean native build lives in a
|
||||
# separate directory. Preserve a copied-host binary before replacing it.
|
||||
legacy_binary="${repo_root}/build_blender_5.2.0/bin/blender"
|
||||
if [[ "${legacy_binary}" != "${BLENDER_BUILD_DIR}/bin/blender" ]]; then
|
||||
mkdir -p "$(dirname "${legacy_binary}")"
|
||||
if [[ -e "${legacy_binary}" && ! -L "${legacy_binary}" ]]; then
|
||||
legacy_backup="${legacy_binary}.copied-host"
|
||||
if [[ ! -e "${legacy_backup}" ]]; then
|
||||
mv "${legacy_binary}" "${legacy_backup}"
|
||||
else
|
||||
echo "legacy Blender backup already exists: ${legacy_backup}" >&2
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
ln -sfn "../../build_blender_native/bin/blender" "${legacy_binary}"
|
||||
fi
|
||||
"${BLENDER_BUILD_DIR}/bin/blender" --version | head -3
|
||||
printf 'native-build-ok binary=%s\n' "${BLENDER_BUILD_DIR}/bin/blender"
|
||||
Reference in New Issue
Block a user