over.core is mostly working

This commit is contained in:
Overwatch 2014-08-13 00:19:54 +02:00
parent 5baa9b75d0
commit 0df57ad386
23 changed files with 1528 additions and 1039 deletions

63
m/build.sh Executable file
View file

@ -0,0 +1,63 @@
#! /bin/zsh
# encoding: utf-8
setopt extendedglob
function die() {
echo "\n\n>>> Failed during ${1}, aborting."
exit 1
}
function translate() {
echo -n "Translating from Python to C: "
first=1
for item in ${@}
do
if [ $first -eq 1 ]; then
echo -n "${item}"
first=0
else
echo -n ", ${item}"
fi
cython -3 ${item}.pyx -o ${item}.c || die "translating"
done
echo "."
}
function combobulate() {
name="$1"
echo -n > "$name.pyx"
for part in src/$name.*.pyx
do
# echo "Combobulating $part..."
echo "###############################################################################" >> "$name.pyx"
echo "# Combobulated from file $part" >> "$name.pyx"
echo "###############################################################################\n" >> "$name.pyx"
cat "$part" >> "$name.pyx"
echo >> "$name.pyx"
done
}
CFLAGS=(-Wall -pedantic -std=c99 -fPIC)
LFLAGS=(-shared)
combobulate core
ln -s src/interface/* .
# call Cython
translate core
echo -n "Compiling and linking: core"
gcc $CFLAGS -I/usr/include/python3.3 -pthread -c core.c || die "compilation"
gcc $LFLAGS -L/usr/lib -lpython3.3 core.o -o core.so || die "linking"
rm -f core.{c,o}
echo "."
# remove temporary sources
rm -f *.pyx *.pxd