0.0) + h;
const QRectF rect(x - w / 2, y - h / 2, w, h);
+diff --git a/main.cpp b/main.cpp
+index 2c6a59e..79627db 100644
+--- a/main.cpp 2014-04-26 23:40:24.253187700 +0200
++++ b/main.cpp 2014-04-27 00:38:55.378353311 +0200
+@@ -20,6 +20,9 @@
+
+ #ifdef ENABLE_DECODE
+ #include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
++#ifdef ANDROID
++#include <jni.h>
++#endif
+ #endif
+
+ #include <stdint.h>
+@@ -45,6 +48,47 @@
+ Q_IMPORT_PLUGIN(qsvg)
+ #endif
+
++#if defined(ENABLE_DECODE) && defined(ANDROID)
++jint JNI_OnLoad(JavaVM *vm, void *reserved)
++{
++ JNIEnv* env;
++
++ (void)reserved;
++
++ if (vm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) {
++ return -1;
++ }
++
++ jclass envc = env->FindClass("org/sigrok/androidutils/Environment");
++ jmethodID getEnv = env->GetStaticMethodID(envc, "getEnvironment",
++ "()[Ljava/lang/String;");
++ jobjectArray envs =
++ (jobjectArray)env->CallStaticObjectMethod(envc, getEnv);
++ jsize i, envn = env->GetArrayLength(envs);
++ for (i=0; i<envn; i+=2) {
++ jstring key = (jstring)env->GetObjectArrayElement(envs, i);
++ jstring value = (jstring)env->GetObjectArrayElement(envs, i+1);
++ const char *utfkey = env->GetStringUTFChars(key, 0);
++ const char *utfvalue = env->GetStringUTFChars(value, 0);
++ setenv(utfkey, utfvalue, 1);
++ env->ReleaseStringUTFChars(value, utfvalue);
++ env->ReleaseStringUTFChars(key, utfkey);
++ env->DeleteLocalRef(value);
++ env->DeleteLocalRef(key);
++ }
++ env->DeleteLocalRef(envs);
++ env->DeleteLocalRef(envc);
++
++ return JNI_VERSION_1_6;
++}
++
++void JNI_OnUnload(JavaVM *vm, void *reserved)
++{
++ (void)vm;
++ (void)reserved;
++}
++#endif
++
+ void usage()
+ {
+ fprintf(stdout,
index 4ebf1f6..f4e3598 100644
--- a/java/src/org/kde/necessitas/origo/QtActivity.java
+++ b/java/src/org/kde/necessitas/origo/QtActivity.java
-@@ -108,6 +108,12 @@ public class QtActivity extends Activity
+@@ -108,6 +108,14 @@ public class QtActivity extends Activity
{
try
{
++ org.sigrok.androidutils.Environment.initEnvironment(
++ getApplicationInfo().sourceDir);
+ System.loadLibrary("gnustl_shared");
+ org.sigrok.androidutils.LibWrangler.setupLibs(
+ getAssets().open("liblist.txt"),
+ libDir1, libDir2);
+ }
+}
+diff --git a/java/src/org/sigrok/androidutils/Environment.java b/java/src/org/sigrok/androidutils/Environment.java
+new file mode 100644
+index 0000000..0c9effe
+--- /dev/null 2014-04-15 00:13:35.543030287 +0200
++++ b/java/src/org/sigrok/androidutils/Environment.java 2014-04-27 00:09:23.073513663 +0200
+@@ -0,0 +1,21 @@
++package org.sigrok.androidutils;
++
++public final class Environment
++{
++ static private String[] environment;
++
++ public static String[] getEnvironment()
++ {
++ return environment;
++ }
++
++ public static void initEnvironment(String apkFile)
++ {
++ environment = new String[]
++ {
++ "PYTHONHOME", ".",
++ "PYTHONPATH", apkFile+"/assets/python3.3",
++ "SIGROKDECODE_DIR", apkFile+"/assets/libsigrokdecode/decoders",
++ };
++ }
++}
$GIT_CLONE git://sigrok.org/pulseview
cd pulseview
patch -p1 < ../../pulseview-cpp.patch
-cmake $CM -DQT_QMAKE_EXECUTABLE=${PREFIX}/bin/qmake -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl -DENABLE_DECODE=FALSE .
+cmake $CM -DQT_QMAKE_EXECUTABLE=${PREFIX}/bin/qmake -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl .
make $PARALLEL
cp -r "$PREFIX"/src/android/java .
cp -r libs java/
patch -p2 < ../../../pulseview-java.patch
mkdir -p assets
READELF=$TOOLCHAIN_TRIPLET-readelf ../../../fix-libraries.sh "$PREFIX/lib" libs/"$TARGET_ARCH" libpulseview.so > assets/liblist.txt
+cp -r "$PREFIX"/lib/python3.3 assets/
+cp -r "$PREFIX"/share/libsigrokdecode assets/
cp ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}/libs/${TARGET_ARCH}/libgnustl_shared.so libs/${TARGET_ARCH}/
"$ANDROID_TOOLS/android" update project -p . -t android-14 -n PulseView
ant debug