From d764a4c985b715c063a246bcb1fa8571e8ebb9a7 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 24 Dec 2016 19:16:11 +0200 Subject: [PATCH 1/3] Refactor to avoid repeated version number --- depends/download-and-extract.sh | 12 ++++++++++++ depends/install_openjpeg.sh | 13 +++---------- depends/install_webp.sh | 9 +++------ 3 files changed, 18 insertions(+), 16 deletions(-) create mode 100755 depends/download-and-extract.sh diff --git a/depends/download-and-extract.sh b/depends/download-and-extract.sh new file mode 100755 index 000000000..9f82877db --- /dev/null +++ b/depends/download-and-extract.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Usage: ./download-and-extract.sh something.tar.gz https://example.com/something.tar.gz + +archive=$1 +url=$2 + +if [ ! -f $archive.tar.gz ]; then + wget -O $archive.tar.gz $url +fi + +rm -r $archive +tar -xvzf $archive.tar.gz diff --git a/depends/install_openjpeg.sh b/depends/install_openjpeg.sh index 8d5f5c010..d307a127e 100755 --- a/depends/install_openjpeg.sh +++ b/depends/install_openjpeg.sh @@ -1,19 +1,12 @@ #!/bin/bash # install openjpeg +archive=openjpeg-2.1.2 -if [ ! -f openjpeg-2.1.2.tar.gz ]; then - wget -O 'openjpeg-2.1.2.tar.gz' 'https://github.com/python-pillow/pillow-depends/blob/master/openjpeg-2.1.2.tar.gz?raw=true' +./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true -fi - -rm -r openjpeg-2.1.2 -tar -xvzf openjpeg-2.1.2.tar.gz - - -pushd openjpeg-2.1.2 +pushd $archive cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j4 && sudo make -j4 install popd - diff --git a/depends/install_webp.sh b/depends/install_webp.sh index a1a28b524..8bb664116 100755 --- a/depends/install_webp.sh +++ b/depends/install_webp.sh @@ -1,14 +1,11 @@ #!/bin/bash # install webp -if [ ! -f libwebp-0.5.2.tar.gz ]; then - wget -O 'libwebp-0.5.2.tar.gz' 'https://github.com/python-pillow/pillow-depends/blob/master/libwebp-0.5.2.tar.gz?raw=true' -fi +archive=libwebp-0.5.2 -rm -r libwebp-0.5.2 -tar -xvzf libwebp-0.5.2.tar.gz +./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true -pushd libwebp-0.5.2 +pushd $archive ./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make -j4 && sudo make -j4 install From a927a7d4e0011ecdeec5cf9b3574dfb8a49a4062 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 24 Dec 2016 19:31:45 +0200 Subject: [PATCH 2/3] Install libimagequant from pillow-depends --- depends/install_imagequant.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index dd497dc3c..8ddf7c991 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -1,9 +1,11 @@ #!/bin/bash # install libimagequant -git clone -b 2.6.0 https://github.com/pornel/pngquant +archive=pngquant-2.6.0 -pushd pngquant +./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true + +pushd $archive make -C lib shared sudo cp lib/libimagequant.so* /usr/lib/ From 9e6cbbe0e6c1d6d7537d2a91b13651da39f4fbce Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 24 Dec 2016 22:19:00 +0200 Subject: [PATCH 3/3] Use effective URLs to avoid resolving twice --- depends/install_imagequant.sh | 2 +- depends/install_openjpeg.sh | 2 +- depends/install_webp.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index 8ddf7c991..c7774d5cb 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -3,7 +3,7 @@ archive=pngquant-2.6.0 -./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true +./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz pushd $archive diff --git a/depends/install_openjpeg.sh b/depends/install_openjpeg.sh index d307a127e..cac86dbbb 100755 --- a/depends/install_openjpeg.sh +++ b/depends/install_openjpeg.sh @@ -3,7 +3,7 @@ archive=openjpeg-2.1.2 -./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true +./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz pushd $archive diff --git a/depends/install_webp.sh b/depends/install_webp.sh index 8bb664116..8f700901c 100755 --- a/depends/install_webp.sh +++ b/depends/install_webp.sh @@ -3,7 +3,7 @@ archive=libwebp-0.5.2 -./download-and-extract.sh $archive https://github.com/python-pillow/pillow-depends/blob/master/$archive.tar.gz?raw=true +./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz pushd $archive