Skip to content

Commit 9f9dafb

Browse files
committed
initial experimentation to improve the cold-start. all the files are pushed into the libs/, and all the C library are redirected to use our own fopen/opendir/... to redirect the filename to the right filename in libs/. works with showcase.
1 parent 33f10f2 commit 9f9dafb

File tree

28 files changed

+497
-17
lines changed

28 files changed

+497
-17
lines changed

distribute.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,22 @@ function push_arm() {
135135
#export OFLAG="-Os"
136136
#export OFLAG="-O2"
137137

138-
export CFLAGS="-DANDROID -mandroid $OFLAG -fomit-frame-pointer --sysroot $NDKPLATFORM"
138+
if [ "X$NOANDROIDREDIRECT" == "X" ]; then
139+
export CFLAGS="-include $SRC_PATH/android_redirect.h"
140+
export LDFLAGS="-landroid_redirect -llog"
141+
else
142+
export CFLAGS=""
143+
export LDFLAGS=""
144+
fi
145+
146+
export CFLAGS+=" -DANDROID -mandroid $OFLAG -fomit-frame-pointer --sysroot $NDKPLATFORM"
139147
if [ "X$ARCH" == "Xarmeabi-v7a" ]; then
140148
CFLAGS+=" -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb"
141149
fi
142150
export CXXFLAGS="$CFLAGS"
143151

144152
# that could be done only for darwin platform, but it doesn't hurt.
145-
export LDFLAGS="-lm"
153+
export LDFLAGS+=" -L$LIBS_PATH -lm"
146154

147155
# this must be something depending of the API level of Android
148156
PYPLATFORM=$($PYTHON -c 'from __future__ import print_function; import sys; print(sys.platform)')
@@ -567,13 +575,22 @@ function run_postbuild() {
567575
done
568576
}
569577

578+
function run_androidredirect() {
579+
info "Compile android redirect"
580+
export NOANDROIDREDIRECT=1
581+
push_arm
582+
try $CC $CGLAFS $LDFLAGS -shared -llog -o $LIBS_PATH/libandroid_redirect.so $SRC_PATH/android_redirect.c
583+
pop_arm
584+
unset NOANDROIDREDIRECT
585+
}
586+
570587
function run_distribute() {
571588
info "Run distribute"
572589

573590
cd "$DIST_PATH"
574591

575592
debug "Create initial layout"
576-
try mkdir assets bin private res templates
593+
try mkdir assets bin private res res/raw templates
577594

578595
debug "Copy default files"
579596
try cp -a $SRC_PATH/default.properties .
@@ -643,6 +660,7 @@ function run() {
643660
run_prepare
644661
run_source_modules
645662
run_get_packages
663+
run_androidredirect
646664
run_prebuild
647665
run_build
648666
run_biglink

recipes/kivy/recipe.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ function prebuild_kivy() {
1313

1414
function build_kivy() {
1515
if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/kivy" ]; then
16-
#return
17-
true
16+
return
1817
fi
1918

2019
cd $BUILD_kivy

recipes/pyjnius/recipe.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ function prebuild_pyjnius() {
1313

1414
function build_pyjnius() {
1515
if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/jnius" ]; then
16-
#return
17-
true
16+
return
1817
fi
1918

2019
cd $BUILD_pyjnius
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- Python-2.7.2/Python/getcwd.c.orig 2013-05-16 16:05:54.886425361 +0200
2+
+++ Python-2.7.2/Python/getcwd.c 2013-05-16 16:05:57.166425318 +0200
3+
@@ -5,6 +5,8 @@
4+
#include <stdio.h>
5+
#include <errno.h>
6+
7+
+#undef getcwd
8+
+
9+
#ifdef HAVE_GETWD
10+
11+
/* Version for BSD systems -- use getwd() */

recipes/python/recipe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function prebuild_python() {
2929
try patch -p1 < $RECIPE_python/patches/verbose-compilation.patch
3030
try patch -p1 < $RECIPE_python/patches/fix-remove-corefoundation.patch
3131
try patch -p1 < $RECIPE_python/patches/fix-dynamic-lookup.patch
32+
try patch -p1 < $RECIPE_python/patches/fix-getcwd.patch
3233

3334
system=$(uname -s)
3435
if [ "X$system" == "XDarwin" ]; then

0 commit comments

Comments
 (0)