Skip to content

Commit

Permalink
Merge pull request kivy#320 from kived/recipe-environment
Browse files Browse the repository at this point in the history
save and restore environment when running recipe functions
  • Loading branch information
kived authored and olymk2 committed Mar 22, 2015
2 parents 5a9d605 + 63e0dbc commit 890eb88
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
16 changes: 13 additions & 3 deletions distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,23 @@ function run_get_packages() {
done
}

function envfn() {
envsave=$(mktemp)
envrestore=$(mktemp)
set > $envsave
$1
set > $envrestore
eval $(grep -v -F -f$envrestore $envsave)
rm -f $envsave $envrestore
}

function run_prebuild() {
info "Run prebuild"
cd $BUILD_PATH
for module in $MODULES; do
fn=$(echo prebuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

Expand Down Expand Up @@ -694,7 +704,7 @@ function run_build() {
if [ "X$DO_BUILD" == "X1" ] || [ ! -f "$MARKER_FN" ]; then
debug "Call $fn"
rm -f "$MARKER_FN"
$fn
envfn $fn
touch "$MARKER_FN"
else
debug "Skipped $fn"
Expand All @@ -708,7 +718,7 @@ function run_postbuild() {
for module in $MODULES; do
fn=$(echo postbuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

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

VERSION_freetype=${VERSION_freetype:-2.5.5}
URL_freetype=http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.gz
BUILD_freetype=$BUILD_PATH/freetype/$(get_directory $URL_freetype)
RECIPE_freetype=$RECIPES_PATH/freetype

# function called for preparing source code if needed
# (you can apply patch etc here.)
function prebuild_freetype() {
true
}

function build_freetype() {
cd $BUILD_freetype
push_arm

#try ./configure --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix="$BUILD_PATH/python-install" --without-zlib --with-png=no --without-harfbuzz --enable-shared
try ./configure --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix=$BUILD_freetype --without-zlib --with-png=no --without-harfbuzz --enable-shared
try make -j5
pop_arm

try cp $BUILD_freetype/objs/.libs/libfreetype.so $LIBS_PATH
}

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

12 changes: 12 additions & 0 deletions src/src/org/renpy/android/PythonService.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ public void run(){
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_io.so");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");

try {
System.loadLibrary("freetype");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/freetype.so");
} catch(UnsatisfiedLinkError e) {
}

try {
System.loadLibrary("sqlite3");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_sqlite3.so");
} catch(UnsatisfiedLinkError e) {
}

try {
System.loadLibrary("sqlite3");
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_sqlite3.so");
Expand Down

0 comments on commit 890eb88

Please sign in to comment.