2016-05-06 18:33:07 +03:00
|
|
|
#!/bin/bash
|
|
|
|
# install libimagequant
|
|
|
|
|
2024-01-21 02:15:59 +03:00
|
|
|
archive_name=libimagequant
|
2024-08-06 04:16:55 +03:00
|
|
|
archive_version=4.3.3
|
2016-05-06 18:33:07 +03:00
|
|
|
|
2024-01-21 02:15:59 +03:00
|
|
|
archive=$archive_name-$archive_version
|
2016-12-24 20:31:45 +03:00
|
|
|
|
2024-01-21 02:15:59 +03:00
|
|
|
if [[ "$GHA_LIBIMAGEQUANT_CACHE_HIT" == "true" ]]; then
|
2016-05-06 18:33:07 +03:00
|
|
|
|
2024-01-21 02:15:59 +03:00
|
|
|
# Copy cached files into place
|
|
|
|
sudo cp ~/cache-$archive_name/libimagequant.so* /usr/lib/
|
|
|
|
sudo cp ~/cache-$archive_name/libimagequant.h /usr/include/
|
2016-05-06 18:33:07 +03:00
|
|
|
|
2024-01-21 02:15:59 +03:00
|
|
|
else
|
|
|
|
|
|
|
|
# Build from source
|
|
|
|
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz
|
|
|
|
|
|
|
|
pushd $archive/imagequant-sys
|
|
|
|
|
2024-01-22 13:42:03 +03:00
|
|
|
cargo install cargo-c
|
|
|
|
cargo cinstall --prefix=/usr --destdir=.
|
2024-01-21 02:15:59 +03:00
|
|
|
|
|
|
|
# Copy into place
|
2024-09-22 15:42:39 +03:00
|
|
|
if [ -d "usr/lib64" ]; then
|
|
|
|
lib="lib64"
|
|
|
|
else
|
|
|
|
lib="lib"
|
|
|
|
fi
|
|
|
|
sudo cp usr/$lib/libimagequant.so* /usr/lib/
|
2024-01-21 02:15:59 +03:00
|
|
|
sudo cp usr/include/libimagequant.h /usr/include/
|
|
|
|
|
2024-01-22 13:42:03 +03:00
|
|
|
if [ -n "$GITHUB_ACTIONS" ]; then
|
|
|
|
# Copy to cache
|
|
|
|
rm -rf ~/cache-$archive_name
|
|
|
|
mkdir ~/cache-$archive_name
|
|
|
|
cp usr/lib/libimagequant.so* ~/cache-$archive_name/
|
|
|
|
cp usr/include/libimagequant.h ~/cache-$archive_name/
|
|
|
|
fi
|
2024-01-21 02:15:59 +03:00
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
fi
|