Skip to content

igraph recipe: Patch during prebuild rather than regular build #185

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

Closed
wants to merge 18 commits into from
Closed
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
24 changes: 10 additions & 14 deletions recipes/android/src/android/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@ def __init__(self, callback, actions=None, categories=None):
if not actions and not categories:
raise Exception('You need to define at least actions or categories')

# resolve actions/categories first
Intent = autoclass('android.content.Intent')
resolved_actions = []
if actions:
for x in actions:
name = 'ACTION_{}'.format(x.upper())
def _expand_partial_name(partial_name):
if '.' in partial_name:
return partial_name # Its actually a full dotted name
else:
name = 'ACTION_{}'.format(partial_name.upper())
if not hasattr(Intent, name):
raise Exception('The intent {} doesnt exist'.format(name))
resolved_actions += [getattr(Intent, name)]
return getattr(Intent, name)

resolved_categories = []
if categories:
for x in categories:
name = 'CATEGORY_{}'.format(x.upper())
if not hasattr(Intent, name):
raise Exception('The intent {} doesnt exist'.format(name))
resolved_categories += [getattr(Intent, name)]
# resolve actions/categories first
Intent = autoclass('android.content.Intent')
resolved_actions = [_expand_partial_name(x) for x in actions or []]
resolved_categories = [_expand_partial_name(x) for x in categories or []]

# resolve android API
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Expand Down
27 changes: 17 additions & 10 deletions recipes/c_igraph/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ BUILD_c_igraph=$BUILD_PATH/c_igraph/$(get_directory $URL_c_igraph)
RECIPE_c_igraph=$RECIPES_PATH/c_igraph

function prebuild_c_igraph() {
true
if [ ! -e $BUILD_c_igraph/.patched ]; then {
try patch $BUILD_c_igraph/src/Makefile.am $RECIPE_c_igraph/Makefile.am.patch;
try cp -f $RECIPE_c_igraph/arith.h $BUILD_c_igraph/src/f2c/arith.h;
try patch $BUILD_c_igraph/src/f2c/sysdep1.h $RECIPE_c_igraph/sysdep1.h.patch;
try patch $BUILD_c_igraph/src/f2c/uninit.c $RECIPE_c_igraph/uninit.c.patch;
touch $BUILD_c_igraph/.patched;
}
fi
}

function shouldbuild_c_igraph() {
Expand All @@ -32,15 +39,15 @@ function build_c_igraph() {
cd $BUILD_c_igraph

push_arm
try patch $BUILD_c_igraph/src/Makefile.am $RECIPE_c_igraph/Makefile.am.patch
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -L$ANDROIDNDK/platforms/android-$ANDROIDAPI/arch-arm/usr/lib"
try ./configure --prefix="$BUILD_PATH/python-install" --build=i686-pc-linux-gnu --host=arm-linux-eabi
export CPPFLAGS="$OLD_CPPFLAGS"
try cp -f $RECIPE_c_igraph/arith.h $BUILD_c_igraph/src/f2c/arith.h
try patch $BUILD_c_igraph/src/f2c/sysdep1.h $RECIPE_c_igraph/sysdep1.h.patch
try patch $BUILD_c_igraph/src/f2c/uninit.c $RECIPE_c_igraph/uninit.c.patch
try patch $BUILD_c_igraph/config.h $RECIPE_c_igraph/config.h.patch
if [ ! -e $BUILD_c_igraph/config.h ]; then
export OLD_CPPFLAGS="$CPPFLAGS";
export CPPFLAGS="$CPPFLAGS -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -L$ANDROIDNDK/platforms/android-$ANDROIDAPI/arch-arm/usr/lib";
try ./configure --prefix="$BUILD_PATH/python-install" --build=i686-pc-linux-gnu --host=arm-linux-eabi;
try patch $BUILD_c_igraph/config.h $RECIPE_c_igraph/config.h.patch;
export CPPFLAGS="$OLD_CPPFLAGS";
fi


try $MAKE
try $MAKE install

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

VERSION_django=${VERSION_django:-1.6.1}
DEPS_django=(sqlite3)
URL_django=https://pypi.python.org/packages/source/D/Django/Django-$VERSION_django.tar.gz
MD5_django=3ea7a00ea9e7a014e8a4067dd6466a1b
BUILD_django=$BUILD_PATH/django/$(get_directory $URL_django)
RECIPE_django=$RECIPES_PATH/django

function prebuild_django() {
true
}

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

function build_django() {
cd $BUILD_django
push_arm
try $HOSTPYTHON setup.py install
pop_arm
}

function postbuild_django() {
# ensure the blacklist doesn't contain wsgiref or unittest
$SED '/unittest/d' $BUILD_PATH/blacklist.txt
$SED '/wsgiref/d' $BUILD_PATH/blacklist.txt
}
10 changes: 6 additions & 4 deletions recipes/igraph/recipe.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
b#!/bin/bash
#!/bin/bash

# Recipe for the Python interface to igraph, a high-performance graph library in C: http://igraph.org/
#
Expand All @@ -18,7 +18,11 @@ RECIPE_igraph=$RECIPES_PATH/igraph


function prebuild_igraph() {
true
if [ ! -f "$BUILD_igraph/.patched" ]; then
try patch $BUILD_igraph/setup.py $RECIPE_igraph/setup.py.patch
try patch $BUILD_igraph/setup.cfg $RECIPE_igraph/setup.cfg.patch
touch $BUILD_igraph/.patched
fi
}

function shouldbuild_igraph() {
Expand All @@ -29,8 +33,6 @@ function shouldbuild_igraph() {

function build_igraph() {
cd $BUILD_igraph
patch setup.py $RECIPE_igraph/setup.py.patch
patch setup.cfg $RECIPE_igraph/setup.cfg.patch
push_arm

try $HOSTPYTHON setup.py build_ext -I"$BUILD_PATH/python-install/include/igraph:$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include" -L"$BUILD_PATH/python-install/lib:$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi" -l gnustl_static -p arm-gnueabi install
Expand Down