forked from python-pillow/Pillow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request python-pillow#7741 from hugovk/ci-stuff
CI: Cache libimagequant on Linux builds
- Loading branch information
Showing
4 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
#!/bin/bash | ||
# install libimagequant | ||
|
||
archive=libimagequant-4.2.2 | ||
archive_name=libimagequant | ||
archive_version=4.2.2 | ||
|
||
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz | ||
archive=$archive_name-$archive_version | ||
|
||
pushd $archive/imagequant-sys | ||
if [[ "$GHA_LIBIMAGEQUANT_CACHE_HIT" == "true" ]]; then | ||
|
||
cargo install cargo-c | ||
cargo cinstall --prefix=/usr --destdir=. | ||
sudo cp usr/lib/libimagequant.so* /usr/lib/ | ||
sudo cp usr/include/libimagequant.h /usr/include/ | ||
# Copy cached files into place | ||
sudo cp ~/cache-$archive_name/libimagequant.so* /usr/lib/ | ||
sudo cp ~/cache-$archive_name/libimagequant.h /usr/include/ | ||
|
||
popd | ||
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 | ||
|
||
cargo install cargo-c | ||
cargo cinstall --prefix=/usr --destdir=. | ||
|
||
# Copy into place | ||
sudo cp usr/lib/libimagequant.so* /usr/lib/ | ||
sudo cp usr/include/libimagequant.h /usr/include/ | ||
|
||
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 | ||
|
||
popd | ||
|
||
fi |