#! /bin/zsh # encoding: utf-8 setopt extendedglob function die() { echo "\n\n>>> Failed during ${1}, aborting." exit 1 } CFLAGS=(-Wall -pedantic -std=c99 -fPIC) LFLAGS=(-shared) echo "- translating from Python to C" cython -f -3 --fast-fail -X embedsignature=True cython_types.pyx -o cython_types.c || die "translating" echo "- compiling and linking" gcc $CFLAGS -I/usr/include/python3.5m -pthread -c cython_types.c || die "compilation" gcc $LFLAGS -L/usr/lib -lpython3.5m cython_types.o -o cython_types.so || die "linking" rm -f cython_types.{c,o} echo "- done"