chore: import upstream snapshot with attribution
CI - Node Bindings / Build darwin-arm64 (push) Waiting to run
CI - Node Bindings / Build darwin-x64 (push) Waiting to run
CI - Node Bindings / Test win32-x64-msvc (push) Blocked by required conditions
CI - Node Bindings / Build linux-arm64-gnu (push) Waiting to run
CI - Node Bindings / Build linux-x64-gnu (push) Waiting to run
CI - Node Bindings / Build linux-x64-musl (push) Waiting to run
CI - Node Bindings / Build win32-arm64-msvc (push) Waiting to run
CI - Node Bindings / Build win32-x64-msvc (push) Waiting to run
CI - Node Bindings / Test darwin-arm64 (push) Blocked by required conditions
CI - Node Bindings / Test darwin-x64 (push) Blocked by required conditions
CI - Node Bindings / Test linux-x64-gnu (push) Blocked by required conditions
CI - Node Bindings / Test linux-x64-musl (push) Blocked by required conditions
CI - Node Bindings / Test win32-arm64-msvc (push) Blocked by required conditions
CI - Python Bindings / Build aarch64-pc-windows-msvc (push) Waiting to run
CI - Python Bindings / Build x86_64-pc-windows-msvc (push) Waiting to run
CI - Python Bindings / Build x86_64-apple-darwin (push) Waiting to run
CI - Python Bindings / Build aarch64-apple-darwin (push) Waiting to run
CI - Python Bindings / Build aarch64-unknown-linux-gnu (push) Waiting to run
CI - Python Bindings / Test x86_64-apple-darwin (push) Blocked by required conditions
CI - Python Bindings / Test aarch64-apple-darwin (push) Blocked by required conditions
CI - Python Bindings / Test x86_64-unknown-linux-gnu (push) Blocked by required conditions
CI - Python Bindings / Test x86_64-unknown-linux-musl (push) Blocked by required conditions
CI - Python Bindings / Test aarch64-pc-windows-msvc (push) Blocked by required conditions
CI - Python Bindings / Test x86_64-pc-windows-msvc (push) Blocked by required conditions
CI / build-and-test (macos-26-intel) (push) Waiting to run
CI / build-and-test (macos-latest) (push) Waiting to run
CI / build-and-test (windows-11-arm) (push) Waiting to run
CI / build-and-test (windows-latest) (push) Waiting to run
CI - Python Bindings / sdist (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-musl (push) Failing after 1s
CI / fmt (push) Failing after 1s
E2E Output Validation / compare-outputs (push) Failing after 1s
Sync Docs to Developer Hub / sync-docs (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-gnu (push) Failing after 1s
CI - WASM Bindings / Build WASM (push) Failing after 0s
CI / clippy (push) Failing after 1s
CI / build-and-test (ubuntu-latest) (push) Failing after 0s
CI - WASM Bindings / Edge runtime PDF parse test (push) Has been skipped
CI - WASM Bindings / Browser PDF parse test (push) Has been skipped
E2E Output Validation / upload-dataset (push) Waiting to run
Deploy Demo to GitHub Pages / deploy (push) Failing after 1s
CI / build-docker-image (push) Failing after 3s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:23:44 +08:00
commit 9f97f3abbe
209 changed files with 57998 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
#
# Copy the pdfium shared library into the liteparse package directory
# so it can be found at runtime via @loader_path (macOS) or $ORIGIN (Linux).
#
# Usage: ./scripts/copy-pdfium.sh
#
# The script auto-detects the pdfium library location from:
# 1. PDFIUM_LIB_PATH env var (set by CI or user)
# 2. The pdfium-sys build cache (~/.cache/pdfium-rs or ~/Library/Caches/pdfium-rs)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT_DIR="${SCRIPT_DIR}/../liteparse"
# Determine OS and library filename
case "$(uname -s)" in
Darwin*) DYLIB="libpdfium.dylib" ;;
Linux*) DYLIB="libpdfium.so" ;;
MINGW*|MSYS*|CYGWIN*) DYLIB="pdfium.dll" ;;
*) echo "Unsupported OS: $(uname -s)" >&2; exit 1 ;;
esac
# Find the pdfium library
find_pdfium() {
# 1. Explicit env var
if [ -n "${PDFIUM_LIB_PATH:-}" ] && [ -f "${PDFIUM_LIB_PATH}/${DYLIB}" ]; then
echo "${PDFIUM_LIB_PATH}/${DYLIB}"
return
fi
# 2. Vendor directory
local vendor="${SCRIPT_DIR}/../../vendor/pdfium/release/lib/${DYLIB}"
if [ -f "$vendor" ]; then
echo "$vendor"
return
fi
# 3. Cargo build output (debug and release)
local workspace_root="${SCRIPT_DIR}/../../../.."
for profile in release debug; do
local deps="${workspace_root}/target/${profile}/deps/${DYLIB}"
if [ -f "$deps" ]; then
echo "$deps"
return
fi
done
# 4. Build cache
local cache_base
case "$(uname -s)" in
Darwin*) cache_base="$HOME/Library/Caches/pdfium-rs" ;;
*) cache_base="${XDG_CACHE_HOME:-$HOME/.cache}/pdfium-rs" ;;
esac
if [ -d "$cache_base" ]; then
local found
found=$(find "$cache_base" -name "$DYLIB" -type f 2>/dev/null | head -1)
if [ -n "$found" ]; then
echo "$found"
return
fi
fi
echo ""
}
PDFIUM_PATH=$(find_pdfium)
if [ -z "$PDFIUM_PATH" ]; then
echo "Error: Could not find ${DYLIB}. Set PDFIUM_LIB_PATH to the directory containing it." >&2
exit 1
fi
cp "$PDFIUM_PATH" "${OUTPUT_DIR}/${DYLIB}"
echo "Copied ${PDFIUM_PATH} -> ${OUTPUT_DIR}/${DYLIB}"
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
#
# Download the prebuilt pdfium binary for a given target triple and stage it
# at `packages/python/liteparse/<dylib>` so maturin's `[tool.maturin] include`
# rule packs it into the wheel (and records it in RECORD) at build time.
#
# Usage: ./scripts/download-pdfium.sh <target-triple>
#
# The release tag is parsed from `crates/pdfium-sys/build.rs` so we only have
# one source of truth for the pdfium version.
set -euo pipefail
TARGET="${1:?usage: download-pdfium.sh <target-triple>}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PKG_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
REPO_ROOT="$(cd "$PKG_DIR/../.." && pwd)"
BUILD_RS="$REPO_ROOT/crates/pdfium-sys/build.rs"
TAG=$(grep -E 'const PDFIUM_RELEASE_TAG' "$BUILD_RS" | sed -E 's/.*"([^"]+)".*/\1/')
[ -n "$TAG" ] || { echo "Could not parse PDFIUM_RELEASE_TAG from $BUILD_RS" >&2; exit 1; }
case "$TARGET" in
aarch64-apple-darwin) ASSET="pdfium-mac-arm64"; DYLIB="libpdfium.dylib" ;;
x86_64-apple-darwin) ASSET="pdfium-mac-x64"; DYLIB="libpdfium.dylib" ;;
x86_64-unknown-linux-gnu) ASSET="pdfium-linux-x64"; DYLIB="libpdfium.so" ;;
aarch64-unknown-linux-gnu) ASSET="pdfium-linux-arm64"; DYLIB="libpdfium.so" ;;
x86_64-unknown-linux-musl) ASSET="pdfium-linux-musl-x64"; DYLIB="libpdfium.so" ;;
aarch64-unknown-linux-musl) ASSET="pdfium-linux-arm64"; DYLIB="libpdfium.so" ;;
x86_64-pc-windows-msvc) ASSET="pdfium-win-x64"; DYLIB="pdfium.dll" ;;
aarch64-pc-windows-msvc) ASSET="pdfium-win-arm64"; DYLIB="pdfium.dll" ;;
*) echo "Unsupported target: $TARGET" >&2; exit 1 ;;
esac
URL_TAG="${TAG//\//%2F}"
URL="https://github.com/run-llama/pdfium-binaries/releases/download/${URL_TAG}/${ASSET}.tgz"
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
echo "Downloading $URL"
curl -fsSL "$URL" -o "$TMP/${ASSET}.tgz"
tar -xzf "$TMP/${ASSET}.tgz" -C "$TMP"
# pdfium-binaries layout: lib/<DYLIB> on unix, bin/pdfium.dll on windows
SRC=""
for candidate in "$TMP/lib/$DYLIB" "$TMP/bin/$DYLIB"; do
if [ -f "$candidate" ]; then
SRC="$candidate"
break
fi
done
[ -n "$SRC" ] || { echo "Could not find $DYLIB in archive" >&2; ls -R "$TMP" >&2; exit 1; }
# Mirror the install-name fix in crates/pdfium-sys/build.rs so the dylib resolves
# via @rpath at runtime. pdfium-binaries ships macOS dylibs with install name
# `./libpdfium.dylib` which won't be found via our rpath.
if [ "$DYLIB" = "libpdfium.dylib" ] && command -v install_name_tool >/dev/null 2>&1; then
install_name_tool -id "@rpath/libpdfium.dylib" "$SRC"
fi
DEST_DIR="$PKG_DIR/liteparse"
mkdir -p "$DEST_DIR"
cp "$SRC" "$DEST_DIR/$DYLIB"
echo "Staged $DEST_DIR/$DYLIB"