Skip to content

Commit 21663d9

Browse files
committed
2 parents 495acf9 + ca369d7 commit 21663d9

20 files changed

+405
-57
lines changed

docs/source/usage.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ component.
140140

141141
* - Token
142142
- Description
143-
* - `surface.transluent`
144-
- If set to 1, the created surface will be transluent (can be used
143+
* - `surface.transparent`
144+
- If set to 1, the created surface will be transparent (can be used
145145
to add background Android widget in the background, or use accelerated
146146
widgets)
147147
* - `surface.depth`
@@ -150,3 +150,7 @@ component.
150150
support the depth you want.
151151
* - `surface.stencil`
152152
- Size of the stencil component, default to 8.
153+
* - `android.background_color`
154+
- Color (32bits RGBA color), used for the background window. Usually, the
155+
background is covered by the OpenGL Background, unless
156+
`surface.transparent` is set.

recipes/android/src/android/_android.pyx

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,56 @@ def get_dpi():
167167

168168

169169
# Soft keyboard.
170-
cdef extern void android_show_keyboard()
170+
cdef extern void android_show_keyboard(int)
171171
cdef extern void android_hide_keyboard()
172172

173-
def show_keyboard():
174-
android_show_keyboard()
173+
# Flags for input_type, for requesting a particular type of keyboard
174+
#android FLAGS
175+
TYPE_CLASS_DATETIME = 4
176+
TYPE_CLASS_NUMBER = 2
177+
TYPE_NUMBER_VARIATION_NORMAL = 0
178+
TYPE_NUMBER_VARIATION_PASSWORD = 16
179+
TYPE_CLASS_TEXT = 1
180+
TYPE_TEXT_FLAG_AUTO_COMPLETE = 65536
181+
TYPE_TEXT_FLAG_AUTO_CORRECT = 32768
182+
TYPE_TEXT_FLAG_NO_SUGGESTIONS = 524288
183+
TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 32
184+
TYPE_TEXT_VARIATION_NORMAL = 0
185+
TYPE_TEXT_VARIATION_PASSWORD = 128
186+
TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 112
187+
TYPE_TEXT_VARIATION_URI = 16
188+
TYPE_CLASS_PHONE = 3
189+
190+
def show_keyboard(target, input_type):
191+
if input_type == 'text':
192+
_input_type = TYPE_CLASS_TEXT
193+
elif input_type == 'number':
194+
_input_type = TYPE_CLASS_NUMBER
195+
elif input_type == 'url':
196+
_input_type = \
197+
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_URI
198+
elif input_type == 'mail':
199+
_input_type = \
200+
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS
201+
elif input_type == 'datetime':
202+
_input_type = TYPE_CLASS_DATETIME
203+
elif input_type == 'tel':
204+
_input_type = TYPE_CLASS_PHONE
205+
elif input_type == 'address':
206+
_input_type = TYPE_TEXT_VARIATION_POSTAL_ADDRESS
207+
208+
if target.password:
209+
if _input_type == TYPE_CLASS_TEXT:
210+
_input_type |= TYPE_TEXT_VARIATION_PASSWORD
211+
elif _input_type == TYPE_CLASS_NUMBER:
212+
_input_type |= TYPE_NUMBER_VARIATION_PASSWORD
213+
214+
if not target.keyboard_suggestions:
215+
if _input_type == TYPE_CLASS_TEXT:
216+
_input_type = TYPE_CLASS_TEXT | \
217+
TYPE_TEXT_FLAG_NO_SUGGESTIONS
218+
219+
android_show_keyboard(_input_type)
175220

176221
def hide_keyboard():
177222
android_hide_keyboard()

recipes/android/src/android/_android_jni.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int android_get_dpi(void) {
129129
return (*env)->CallStaticIntMethod(env, cls, mid);
130130
}
131131

132-
void android_show_keyboard(void) {
132+
void android_show_keyboard(int input_type) {
133133
static JNIEnv *env = NULL;
134134
static jclass *cls = NULL;
135135
static jmethodID mid = NULL;
@@ -139,11 +139,11 @@ void android_show_keyboard(void) {
139139
aassert(env);
140140
cls = (*env)->FindClass(env, "org/renpy/android/Hardware");
141141
aassert(cls);
142-
mid = (*env)->GetStaticMethodID(env, cls, "showKeyboard", "()V");
142+
mid = (*env)->GetStaticMethodID(env, cls, "showKeyboard", "(I)V");
143143
aassert(mid);
144144
}
145145

146-
(*env)->CallStaticVoidMethod(env, cls, mid);
146+
(*env)->CallStaticVoidMethod(env, cls, mid, (jint) input_type);
147147
}
148148

149149
void android_hide_keyboard(void) {

recipes/c_igraph/Makefile.am.patch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
68,72d67
2+
< f2c/arith.h: f2c/arithchk.c
3+
< $(CC) $(CFLAGS) -DNO_FPINIT f2c/arithchk.c -lm -o f2c/arith || \
4+
< $(CC) -DNO_LONG_LONG $(CFLAGS) -DNO_FPINIT f2c/arithchk.c \
5+
< $(WARNING_CFLAGS) -lm -o f2c/arith
6+
< f2c/arith > f2c/arith.h

recipes/c_igraph/arith.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#define IEEE_8087
2+
#define Arith_Kind_ASL 1
3+
#define Double_Align
4+
#define NANCHECK
5+
#define QNaN0 0x0
6+
#define QNaN1 0x7ff80000

recipes/c_igraph/config.h.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- build/c_igraph/igraph-0.6.5/config.h 2013-11-05 14:10:26.285433616 -0500
2+
+++ config.h 2013-11-05 14:12:36.431283045 -0500
3+
@@ -53,7 +53,7 @@
4+
/* #undef HAVE_LOG2 */
5+
6+
/* Define to 1 if you have the `logbl' function. */
7+
-/* #undef HAVE_LOGBL */
8+
+#define HAVE_LOGBL 1
9+
10+
/* Define to 1 if you have the <memory.h> header file. */
11+
#define HAVE_MEMORY_H 1

recipes/c_igraph/recipe.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Recipe for igraph, a high performance graph library in C: http://igraph.org
4+
#
5+
# Written by Zachary Spector: https://github.com/LogicalDash/
6+
#
7+
#
8+
9+
VERSION_c_igraph=${VERSION_c_igraph:0.6.5}
10+
11+
DEPS_c_igraph=()
12+
13+
URL_c_igraph=http://downloads.sourceforge.net/project/igraph/C%20library/0.6.5/igraph-0.6.5.tar.gz
14+
15+
MD5_c_igraph=5f9562263ba78b31c564d6897ff5a110
16+
17+
BUILD_c_igraph=$BUILD_PATH/c_igraph/$(get_directory $URL_c_igraph)
18+
19+
RECIPE_c_igraph=$RECIPES_PATH/c_igraph
20+
21+
function prebuild_c_igraph() {
22+
true
23+
}
24+
25+
function shouldbuild_c_igraph() {
26+
if [ -e $BUILD_c_igraph/.built ]; then
27+
export DO_BUILD=0;
28+
fi
29+
}
30+
31+
function build_c_igraph() {
32+
cd $BUILD_c_igraph
33+
34+
push_arm
35+
try patch $BUILD_c_igraph/src/Makefile.am $RECIPE_c_igraph/Makefile.am.patch
36+
export OLD_CPPFLAGS="$CPPFLAGS"
37+
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"
38+
try ./configure --prefix="$BUILD_PATH/python-install" --build=i686-pc-linux-gnu --host=arm-linux-eabi
39+
export CPPFLAGS="$OLD_CPPFLAGS"
40+
try cp -f $RECIPE_c_igraph/arith.h $BUILD_c_igraph/src/f2c/arith.h
41+
try patch $BUILD_c_igraph/src/f2c/sysdep1.h $RECIPE_c_igraph/sysdep1.h.patch
42+
try patch $BUILD_c_igraph/src/f2c/uninit.c $RECIPE_c_igraph/uninit.c.patch
43+
try patch $BUILD_c_igraph/config.h $RECIPE_c_igraph/config.h.patch
44+
try $MAKE
45+
try $MAKE install
46+
47+
pop_arm
48+
touch .built
49+
}
50+
51+
function postbuild_c_igraph() {
52+
true
53+
}

recipes/c_igraph/sysdep1.h.patch

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
16a17
2+
> /*android doesn't like these
3+
18c19,20
4+
< #define OFF_T __off64_t
5+
---
6+
> #define OFF_T __off64_t*/
7+
> #define OFF_T long

recipes/c_igraph/uninit.c.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
276c276,277
2+
< #include <fpu_control.h>
3+
---
4+
> //doesn't exist on Android
5+
> //#include <fpu_control.h>
6+
334a336
7+
> /*
8+
336c338
9+
< #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)
10+
---
11+
> #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)*/
12+
343a346
13+
> /*
14+
345c348
15+
< #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)
16+
---
17+
> #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)*/
18+
350a354
19+
> /*
20+
352c356
21+
< #define RQD_FPU_MASK (_FPU_MASK_O+_FPU_MASK_V+_FPU_MASK_Z)
22+
---
23+
> #define RQD_FPU_MASK (_FPU_MASK_O+_FPU_MASK_V+_FPU_MASK_Z)*/

recipes/igraph/Makefile.am.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
170c170,180
2+
< scg_headers.h igraph_hacks_internal.h
3+
---
4+
> scg_headers.h igraph_hacks_internal.h \
5+
> arpackobject.h \
6+
> pyattributes.h bfsiter.h \
7+
> common.h convert.h \
8+
> edgeobject.h edgeseqobject.h \
9+
> error.h filehandle.h \
10+
> graphobject.h igraphmodule_api.h \
11+
> indexing.h platform.h \
12+
> py2compat.h pyhelpers.h \
13+
> pyrandom.h vertexobject.h \
14+
> vertexseqobject.h
15+
260c270,287
16+
< qsort.c qsort_r.c types.c hacks.c
17+
---
18+
> qsort.c qsort_r.c types.c hacks.c \
19+
> arpackobject.c \
20+
> pyattributes.c \
21+
> bfsiter.c \
22+
> common.c \
23+
> convert.c \
24+
> edgeobject.c \
25+
> edgeseqobject.c \
26+
> error.c \
27+
> filehandle.c \
28+
> graphobject.c \
29+
> igraphmodule.c \
30+
> indexing.c \
31+
> py2compat.c \
32+
> pyhelpers.c \
33+
> pyrandom.c \
34+
> vertexobject.c \
35+
> vertexseqobject.c
36+
263,265c290,292
37+
< libigraph_la_CFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(WARNING_CFLAGS)
38+
< libigraph_la_CXXFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(WARNING_CFLAGS)
39+
< libigraph_la_LDFLAGS = -no-undefined
40+
---
41+
> libigraph_la_CFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(WARNING_CFLAGS) -IBUILD_PATH/python-install/include/python2.7
42+
> libigraph_la_CXXFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(WARNING_CFLAGS) -IBUILD_PATH/python-install/include/python2.7
43+
> libigraph_la_LDFLAGS = -no-undefined -LBUILD_PATH/python-install/lib -IBUILD_PATH/python-install/include/python2.7
44+
267c294
45+
< $(LAPACK_LIB) $(ARPACK_LIB) $(GLPK_LIB) $(PLFIT_LIB)
46+
---
47+
> $(LAPACK_LIB) $(ARPACK_LIB) $(GLPK_LIB) $(PLFIT_LIB) -lpython2.7

recipes/igraph/config.h.in.patch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1a2
2+
> #define HAVE_LOGBL 1

recipes/igraph/config.h.patch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2a3
2+
> #define HAVE_LOGBL 1

recipes/igraph/configure.ac.patch

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
43c43
2+
< AC_CHECK_FUNCS([expm1 rint rintf finite log2 logbl snprintf log1p round fabsl fmin strcasecmp isnan strdup _strdup ftruncate stpcpy])
3+
---
4+
> AC_CHECK_FUNCS([expm1 rint rintf finite log2 snprintf log1p round fabsl fmin strcasecmp isnan strdup _strdup ftruncate stpcpy])

recipes/igraph/get_platform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from distutils.util import get_platform
2+
from sys import version
3+
print get_platform() + '-' + version[:3]

recipes/igraph/recipe.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# Recipe for the Python interface to igraph, a high-performance graph library in C: http://igraph.org/
4+
#
5+
# Written by Zachary Spector: https://github.com/LogicalDash/
6+
7+
VERSION_igraph=${VERSION_igraph:0.6.5}
8+
9+
DEPS_igraph=(c_igraph python)
10+
11+
URL_igraph=http://pypi.python.org/packages/source/p/python-igraph/python-igraph-0.6.5.tar.gz
12+
13+
MD5_igraph=c626585baf003af855c0dc4eec0c9baa
14+
15+
BUILD_igraph=$BUILD_PATH/igraph/$(get_directory $URL_igraph)
16+
17+
RECIPE_igraph=$RECIPES_PATH/igraph
18+
19+
20+
function prebuild_igraph() {
21+
patch setup.py $RECIPE_igraph/setup.py.patch
22+
}
23+
24+
function shouldbuild_igraph() {
25+
if [ -e $BUILD_igraph/.built ]; then
26+
export DO_BUILD=0;
27+
fi
28+
}
29+
30+
function build_igraph() {
31+
cd $BUILD_igraph
32+
push_arm
33+
34+
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
35+
36+
pop_arm
37+
touch .built
38+
}
39+
40+
function postbuild_igraph() {
41+
true
42+
}

recipes/igraph/setup.py.patch

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--- /home/sanotehu/Downloads/python-igraph-0.6.5/setup.py 2013-02-27 06:04:09.000000000 -0500
2+
+++ build/igraph/python-igraph-0.6.5/setup.py 2013-11-06 08:54:17.944200143 -0500
3+
@@ -19,7 +19,7 @@
4+
from shutil import copy2
5+
from subprocess import Popen, PIPE
6+
7+
-LIBIGRAPH_FALLBACK_INCLUDE_DIRS = ['/usr/include/igraph', '/usr/local/include/igraph']
8+
+LIBIGRAPH_FALLBACK_INCLUDE_DIRS = ['../../python-install/include/igraph', '../../python-install/include/python2.7']
9+
LIBIGRAPH_FALLBACK_LIBRARIES = ['igraph']
10+
LIBIGRAPH_FALLBACK_LIBRARY_DIRS = []
11+
12+
@@ -40,26 +40,15 @@
13+
14+
def detect_igraph_include_dirs(default = LIBIGRAPH_FALLBACK_INCLUDE_DIRS):
15+
"""Tries to detect the igraph include directory"""
16+
- line, exit_code = get_output("pkg-config igraph --cflags")
17+
- if exit_code > 0 or len(line) == 0:
18+
- return default
19+
- opts=line.split()
20+
- return [opt[2:] for opt in opts if opt.startswith("-I")]
21+
+ return default
22+
23+
def detect_igraph_libraries(default = LIBIGRAPH_FALLBACK_LIBRARIES):
24+
"""Tries to detect the libraries that igraph uses"""
25+
- line, exit_code = get_output("pkg-config igraph --libs")
26+
- if exit_code>0 or len(line) == 0:
27+
- return default
28+
- opts=line.split()
29+
- return [opt[2:] for opt in opts if opt.startswith("-l")]
30+
+ return default
31+
32+
def detect_igraph_library_dirs(default = LIBIGRAPH_FALLBACK_LIBRARY_DIRS):
33+
"""Tries to detect the igraph library directory"""
34+
- line, exit_code = get_output("pkg-config igraph --libs")
35+
- if exit_code>0 or len(line) == 0: return default
36+
- opts=line.split()
37+
- return [opt[2:] for opt in opts if opt[0:2]=="-L"]
38+
+ return default
39+
40+
sources=glob.glob(os.path.join('src', '*.c'))
41+
include_dirs=[]
42+
@@ -113,7 +102,7 @@
43+
Many thanks to the maintainers of this page!
44+
"""
45+
46+
-plat = get_platform()
47+
+plat = 'arm-gnueabi'
48+
options = dict(
49+
name = 'python-igraph',
50+
version = '0.6.5',

src/build.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python2.7
22

3-
from os.path import basename, dirname, join, isfile, realpath, relpath, split
3+
from os.path import dirname, join, isfile, realpath, relpath, split
44
from zipfile import ZipFile
55
import sys
66
sys.path.insert(0, 'buildlib/jinja2.egg')
@@ -164,17 +164,7 @@ def select(fn):
164164
for sd in source_dirs:
165165
sd = realpath(sd)
166166
compile_dir(sd)
167-
for x in listdir(sd):
168-
if select(x):
169-
# symbolic links should go in the archive by the name of the link, not the name of what they point to
170-
try:
171-
realbase = os.readlink(x)
172-
linkbase = basename(x)
173-
realp = realpath(x).replace(realbase, linkbase)
174-
nufile = (x, relpath(realp, sd))
175-
except OSError:
176-
nufile = (x, relpath(realpath(x), sd))
177-
files.append(nufile)
167+
files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd) if select(x)]
178168

179169
# create tar.gz of thoses files
180170
tf = tarfile.open(tfn, 'w:gz')

0 commit comments

Comments
 (0)