Skip to content

Add a storm/psycopg2 recipe #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions recipes/libpq/patches/libpq.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/port/crypt.c b/src/port/crypt.c
index 85b98c5..416c509 100644
--- a/src/port/crypt.c
+++ b/src/port/crypt.c
@@ -87,7 +87,10 @@ static int des_cipher(const char *in, char *out, long salt, int num_iter);
* define "B64" to be the declaration for a 64 bit integer.
* XXX this feature is currently unused, see "endian" comment below.
*/
-#define B64 __int64
+//to avoid crypt.c:237: error: expected specifier-qualifier-list before '__int64' when cross compiling for android
+#ifndef ANDROID
+ #define B64 __int64
+#endif

/*
* define "LARGEDATA" to get faster permutations, by using about 72 kilobytes
41 changes: 41 additions & 0 deletions recipes/libpq/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

VERSION_libpq=${VERSION_libpq:-9.3.5}
URL_libpq=http://ftp.postgresql.org/pub/source/v$VERSION_libpq/postgresql-$VERSION_libpq.tar.bz2
DEPS_libpq=(python)
MD5_libpq=5059857c7d7e6ad83b6d55893a121b59
BUILD_libpq=$BUILD_PATH/libpq/$(get_directory $URL_libpq)
RECIPE_libpq=$RECIPES_PATH/libpq

function prebuild_libpq() {
cd $BUILD_libpq
if [ -f .patched ]; then
return
fi
# http://www.postgresql.org/message-id/4ECCD3D9.3040505@bernawebdesign.ch
try patch -p1 < $RECIPE_libpq/patches/libpq.patch
touch .patched
}

function shouldbuild_libpq() {
if [ -f "$BUILD_libpq/src/interfaces/libpq/libpq.so" ]; then
DO_BUILD=0
fi
}

function build_libpq() {
cd $BUILD_libpq

push_arm

try ./configure --without-readline --host=arm-linux
try make submake-libpq
try cp -a $BUILD_libpq/src/interfaces/libpq/libpq.a $LIBS_PATH

pop_arm

}

function postbuild_libpq() {
true
}
45 changes: 45 additions & 0 deletions recipes/psycopg2/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# There is a bug in storm that breaks with newer versions (>= 2.5)
VERSION_psycopg2=${VERSION_psycopg2:-2.4.5}
DEPS_psycopg2=(python libpq)
URL_psycopg2=http://pypi.python.org/packages/source/p/psycopg2/psycopg2-$VERSION_psycopg2.tar.gz
MD5_psycopg2=075e4df465e9a863f288d5bdf6e6887e
BUILD_psycopg2=$BUILD_PATH/psycopg2/$(get_directory $URL_psycopg2)
RECIPE_psycopg2=$RECIPES_PATH/psycopg2

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_psycopg2() {
cd $BUILD_psycopg2
if [ -f .patched ]; then
return
fi
# Set the correct path where our cross compiled libpq.a is (otherwise it
# will try to link against the system one)
try sed -i "s|pg_config_helper.query(.libdir.)|'$LIBS_PATH'|" setup.py
touch .patched
}

function shouldbuild_psycopg2() {
if [ -d "$SITEPACKAGES_PATH/psycopg2" ]; then
DO_BUILD=0
fi
}

function build_psycopg2() {
cd $BUILD_psycopg2
push_arm
export LDFLAGS="$LDFLAGS -L$LIBS_PATH"
export EXTRA_CFLAGS="--host linux-armv"
# Statically compile psycopg
try $HOSTPYTHON setup.py build_ext --static-libpq
try $HOSTPYTHON setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
pop_arm
}

# function called after all the compile have been done
function postbuild_psycopg2() {
true
}

41 changes: 41 additions & 0 deletions recipes/storm/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

VERSION_storm=${VERSION_storm:-0.20}
DEPS_storm=(python)
URL_storm=https://pypi.python.org/packages/source/s/storm/storm-$VERSION_storm.tar.bz2
MD5_storm=4a9048fed9d1ec472ce73fbe54387054
BUILD_storm=$BUILD_PATH/storm/$(get_directory $URL_storm)
RECIPE_storm=$RECIPES_PATH/storm

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_storm() {
cd $BUILD_storm
wget -nc http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
if [ -f .patched ]; then
return
fi
# I still dont know how to build the c extensions for android yet.
# Luckly, storm provides a python fallback
try sed -i "s|BUILD_CEXTENSIONS = True|BUILD_CEXTENSIONS = False|" setup.py
touch .patched
}

function shouldbuild_storm() {
if [ -d "$SITEPACKAGES_PATH/storm" ]; then
DO_BUILD=0
fi
}

function build_storm() {
cd $BUILD_storm
push_arm
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
pop_arm
}

# function called after all the compile have been done
function postbuild_storm() {
true
}