Created
October 9, 2017 21:25
-
-
Save anntzer/a03230f94e6d111ba3abc737d5091b99 to your computer and use it in GitHub Desktop.
manylinux build script for pycairo
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
#!/bin/bash | |
# Written by Antony Lee (@anntzer). | |
set -e | |
PYTHON_VERSION=36 | |
PIP="/opt/python/cp$PYTHON_VERSION-cp${PYTHON_VERSION}m/bin/pip" | |
if ! [[ -e "$PIP" ]]; then | |
# Not in the manylinux image yet: call self from within docker. | |
docker run -it \ | |
--mount type=bind,source="$(readlink -f "$(dirname "$0")")",target=/io \ | |
quay.io/pypa/manylinux1_x86_64 \ | |
"/io/$(basename "$0")" | |
exit | |
fi | |
ZLIB_VERSION=1.2.11 | |
LIBPNG_VERSION=1.6.32 | |
FREETYPE_VERSION=2.8.1 | |
EXPAT_VERSION=2.2.4 | |
# FONTCONFIG_VERSION=2.12.6 # Requires one of: libxml2, expat (technically a dependency of Python too); gperf. | |
PIXMAN_VERSION=0.34.0 | |
CAIRO_VERSION=1.14.10 | |
PYCAIRO_VERSION=1.15.3 | |
cd io | |
mkdir -p deps wheelhouse | |
yum install -y xz | |
download_unpack_cd () { | |
local url filename | |
url="$1" | |
filename="$(basename "$url")" | |
if ! [[ -e "$filename" ]]; then | |
curl -LOJ "$url" | |
fi | |
if [[ "$filename" =~ '\.tar\.gz' ]]; then | |
tar -xzf "$filename" | |
dirname="${filename::${#filename}-7}" | |
elif [[ "$filename" =~ '\.tar\.bz2' ]]; then | |
tar -xjf "$filename" | |
dirname="${filename::${#filename}-8}" | |
elif [[ "$filename" =~ '\.tar\.xz' ]]; then | |
xzcat "$filename" | tar -x | |
dirname="${filename::${#filename}-7}" | |
else | |
echo 'Unknown extension' >&2 | |
exit 1 | |
fi | |
cd "$dirname" | |
} | |
install_autoconf () { | |
local url flags dirname | |
url="$1" | |
flags="$2" | |
( | |
cd deps | |
download_unpack_cd "$url" | |
./configure $flags | |
make | |
make install | |
) | |
} | |
build_wheel () { | |
local url dest | |
url="$1" | |
dest="$2" | |
( | |
cd deps | |
download_unpack_cd "$url" | |
"$PIP" wheel --no-deps --wheel-dir "$dest" . | |
) | |
} | |
install_autoconf "https://zlib.net/zlib-$ZLIB_VERSION.tar.gz" | |
install_autoconf "https://download.sourceforge.net/libpng/libpng-$LIBPNG_VERSION.tar.gz" | |
install_autoconf "https://download.savannah.gnu.org/releases/freetype/freetype-$FREETYPE_VERSION.tar.gz" | |
install_autoconf "https://downloads.sourceforge.net/project/expat/expat/$EXPAT_VERSION/expat-$EXPAT_VERSION.tar.bz2" | |
# install_autoconf "https://www.freedesktop.org/software/fontconfig/release/fontconfig-$FONTCONFIG_VERSION.tar.gz" | |
install_autoconf "https://www.cairographics.org/releases/pixman-$PIXMAN_VERSION.tar.gz" | |
install_autoconf "https://www.cairographics.org/releases/cairo-$CAIRO_VERSION.tar.xz" --disable-gobject | |
build_wheel "https://github.com/pygobject/pycairo/releases/download/v$PYCAIRO_VERSION/pycairo-$PYCAIRO_VERSION.tar.gz" \ | |
"$(readlink -f wheelhouse)" | |
auditwheel repair "wheelhouse/pycairo-$PYCAIRO_VERSION-cp$PYTHON_VERSION-cp${PYTHON_VERSION}m-linux_x86_64.whl" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment