RPi: Clone jpeglib from GitHub (PyPI tarball incomplete)

The PyPI source tarball is missing both jpeglib's own headers
(cjpeglib_common.h, etc.) and libjpeg headers. Clone from GitHub
which has the jpeglib headers, then download libjpeg headers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-10 22:30:21 -05:00
parent 889df881ba
commit 28cb9bb9b3

View File

@@ -340,46 +340,45 @@ else
# Upgrade pip and install build tools # Upgrade pip and install build tools
pip install --upgrade pip setuptools wheel pip install --upgrade pip setuptools wheel
# Install jpeglib (has no ARM64 wheel, needs headers fix) # Install jpeglib (no ARM64 wheel, PyPI tarball missing headers - use GitHub)
echo " Installing jpeglib for ARM64..." echo " Installing jpeglib for ARM64..."
if [ -f "$INSTALL_DIR/rpi/patches/jpeglib/install-jpeglib-arm64.sh" ]; then JPEGLIB_WORKDIR=$(mktemp -d)
bash "$INSTALL_DIR/rpi/patches/jpeglib/install-jpeglib-arm64.sh" cd "$JPEGLIB_WORKDIR"
else
# Inline fix: download headers and build
JPEGLIB_WORKDIR=$(mktemp -d)
cd "$JPEGLIB_WORKDIR"
pip download jpeglib==1.0.2 --no-binary :all: --no-deps -d . -q
tar -xzf jpeglib-1.0.2.tar.gz
cd jpeglib-1.0.2
CJPEGLIB="src/jpeglib/cjpeglib"
# Download and copy libjpeg 6b headers # Clone from GitHub (PyPI source tarball is missing .h files)
curl -sL "https://www.ijg.org/files/jpegsrc.v6b.tar.gz" | tar -xzf - echo " Cloning jpeglib from GitHub..."
cp jpeg-6b/*.h "$CJPEGLIB/6b/" git clone --depth 1 --branch v1.0.2 https://github.com/martinbenes1996/jpeglib.git
cd jpeglib
CJPEGLIB="src/jpeglib/cjpeglib"
# Download and copy libjpeg 9f headers (works for 7-9f) # Download libjpeg headers (not included in repo either)
curl -sL "https://www.ijg.org/files/jpegsrc.v9f.tar.gz" | tar -xzf - echo " Downloading libjpeg 6b headers..."
for v in 7 8 8a 8b 8c 8d 9 9a 9b 9c 9d 9e 9f; do curl -sL "https://www.ijg.org/files/jpegsrc.v6b.tar.gz" | tar -xzf -
cp jpeg-9f/*.h "$CJPEGLIB/$v/" cp jpeg-6b/*.h "$CJPEGLIB/6b/"
done
# Download and copy libjpeg-turbo headers echo " Downloading libjpeg 9f headers..."
curl -sL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.1.0.tar.gz" | tar -xzf - curl -sL "https://www.ijg.org/files/jpegsrc.v9f.tar.gz" | tar -xzf -
for v in turbo120 turbo130 turbo140 turbo150 turbo200 turbo210; do for v in 7 8 8a 8b 8c 8d 9 9a 9b 9c 9d 9e 9f; do
cp libjpeg-turbo-2.1.0/*.h "$CJPEGLIB/$v/" 2>/dev/null || true cp jpeg-9f/*.h "$CJPEGLIB/$v/"
done done
# Download and copy mozjpeg headers echo " Downloading libjpeg-turbo headers..."
curl -sL "https://github.com/mozilla/mozjpeg/archive/refs/tags/v4.0.3.tar.gz" | tar -xzf - curl -sL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.1.0.tar.gz" | tar -xzf -
for v in mozjpeg101 mozjpeg201 mozjpeg300 mozjpeg403; do for v in turbo120 turbo130 turbo140 turbo150 turbo200 turbo210; do
cp mozjpeg-4.0.3/*.h "$CJPEGLIB/$v/" 2>/dev/null || true cp libjpeg-turbo-2.1.0/*.h "$CJPEGLIB/$v/" 2>/dev/null || true
done done
# Build and install echo " Downloading mozjpeg headers..."
pip install . curl -sL "https://github.com/mozilla/mozjpeg/archive/refs/tags/v4.0.3.tar.gz" | tar -xzf -
cd "$INSTALL_DIR" for v in mozjpeg101 mozjpeg201 mozjpeg300 mozjpeg403; do
rm -rf "$JPEGLIB_WORKDIR" cp mozjpeg-4.0.3/*.h "$CJPEGLIB/$v/" 2>/dev/null || true
fi done
# Build and install
echo " Building jpeglib (this takes a few minutes)..."
pip install .
cd "$INSTALL_DIR"
rm -rf "$JPEGLIB_WORKDIR"
# Install remaining dependencies # Install remaining dependencies
echo " Installing remaining dependencies..." echo " Installing remaining dependencies..."