sigrok-cross-android: Use Java glue for PV from github
authorMarcus Comstedt <marcus@mc.pp.se>
Sun, 6 Jul 2014 15:24:30 +0000 (17:24 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Mon, 25 Aug 2014 20:38:43 +0000 (22:38 +0200)
cross-compile/android/pulseview-java.patch [deleted file]
cross-compile/android/sigrok-cross-android

diff --git a/cross-compile/android/pulseview-java.patch b/cross-compile/android/pulseview-java.patch
deleted file mode 100644 (file)
index 6d7d04f..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
-index 0564a8d..0356f33 100644
---- a/java/AndroidManifest.xml
-+++ b/java/AndroidManifest.xml
-@@ -1,5 +1,5 @@
- <?xml version='1.0' encoding='utf-8'?>
--<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
--    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name">
-+<manifest package="org.sigrok.pulseview" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
-+    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/logo">
-         <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
-                   android:name="org.qtproject.qt5.android.bindings.QtActivity"
-@@ -9,21 +9,21 @@
-                 <action android:name="android.intent.action.MAIN"/>
-                 <category android:name="android.intent.category.LAUNCHER"/>
-             </intent-filter>
--            <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
-+            <meta-data android:name="android.app.lib_name" android:value="pulseview"/>
-             <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
-             <meta-data android:name="android.app.repository" android:value="default"/>
-             <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
-             <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
-             <!-- Deploy Qt libs as part of package -->
--            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
-+            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="0"/>
-             <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
-             <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
-             <!-- Run with local libs -->
--            <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
-+            <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/>
-             <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
--            <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
--            <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
--            <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
-+            <meta-data android:name="android.app.load_local_libs" android:value="libs/libgnustl_shared.so"/>
-+            <meta-data android:name="android.app.load_local_jars" android:value=":"/>
-+            <meta-data android:name="android.app.static_init_classes" android:value=":"/>
-             <!--  Messages maps -->
-             <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
-             <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
-diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
-index bd6928f..68f017e 100644
---- a/java/res/values/strings.xml
-+++ b/java/res/values/strings.xml
-@@ -1,6 +1,6 @@
- <?xml version='1.0' encoding='utf-8'?>
- <resources>
--    <string name="app_name"><!-- %%INSERT_APP_NAME%% --></string>
-+    <string name="app_name">PulseView</string>
-     <string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
-     <string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
-diff --git a/java/res/values/libs.xml b/java/res/values/libs.xml
---- a/java/res/values/libs.xml 2014-05-17 11:09:29.855631921 +0200
-+++ b/java/res/values/libs.xml 2014-05-17 11:13:04.380841784 +0200
-@@ -13,6 +13,10 @@
-      <array name="qt_libs">
-          <!-- %%INSERT_QT_LIBS%% -->
-+         <item>Qt5Core</item>
-+         <item>Qt5Gui</item>
-+         <item>Qt5Widgets</item>
-+         <item>Qt5Svg</item>
-      </array>
-     <array name="bundled_in_lib">
-diff --git a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
-index 4ebf1f6..f4e3598 100644
---- a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
-+++ b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
-@@ -187,6 +187,14 @@
-     private void loadApplication(Bundle loaderParams)
-     {
-         try {
-+          org.sigrok.androidutils.Environment.initEnvironment(
-+               getApplicationInfo().sourceDir);
-+          System.loadLibrary("gnustl_shared");
-+            org.sigrok.androidutils.LibWrangler.setupLibs(
-+                getAssets().open("liblist.txt"),
-+                new File(getApplicationInfo().nativeLibraryDir),
-+                new File(getFilesDir(), "lib"));
-+
-             final int errorCode = loaderParams.getInt(ERROR_CODE_KEY);
-             if (errorCode != 0) {
-                 if (errorCode == INCOMPATIBLE_MINISTRO_VERSION) {
-diff --git a/java/src/org/sigrok/androidutils/LibWrangler.java b/java/src/org/sigrok/androidutils/LibWrangler.java
-new file mode 100644
-index 0000000..0c9effe
---- /dev/null
-+++ b/java/src/org/sigrok/androidutils/LibWrangler.java
-@@ -0,0 +1,63 @@
-+package org.sigrok.androidutils;
-+
-+import java.io.InputStream;
-+import java.io.InputStreamReader;
-+import java.io.BufferedReader;
-+import java.io.IOException;
-+import java.io.File;
-+
-+public final class LibWrangler
-+{
-+    protected static String stripSoVersion(String s)
-+    {
-+        int p = s.lastIndexOf(".so.");
-+        if (p >= 0)
-+            s = s.substring(0, p+3);
-+        return s;
-+    }
-+
-+    protected static void makeLink(File from, File to)
-+        throws IOException
-+    {
-+        if (to.equals(from.getCanonicalFile())) {
-+            // Symlink already correct
-+            return;
-+        }
-+        from.delete();
-+        int rc;
-+        Process proc =
-+            Runtime.getRuntime().exec(new String[]{"ln", "-s",
-+                                                   to.getAbsolutePath(),
-+                                                   from.getAbsolutePath()});
-+        for(;;) {
-+            try {
-+                rc = proc.waitFor();
-+                break;
-+            } catch(InterruptedException ie) {
-+            }
-+        }
-+        if (rc != 0)
-+            throw new IOException("Failed to create symlink "+from);
-+    }
-+
-+    public static void setupLibs(BufferedReader reader, File libDir1, File libDir2)
-+        throws IOException
-+    {
-+        if (!libDir2.exists())
-+            libDir2.mkdir();
-+
-+        String libname;
-+        while ((libname = reader.readLine()) != null) {
-+            File shlib = new File(libDir2, libname);
-+            makeLink(shlib, new File(libDir1, stripSoVersion(libname)));
-+            System.load(shlib.getAbsolutePath());
-+        }
-+    }
-+
-+    public static void setupLibs(InputStream is, File libDir1, File libDir2)
-+        throws IOException
-+    {
-+      setupLibs(new BufferedReader(new InputStreamReader(is, "US-ASCII")),
-+                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",
-+      };
-+    }
-+}
index f270f1462192ef854f8d28b540d18b3918f51707..95dffb379ee5d608e980d5d4556a701097425539 100755 (executable)
@@ -318,12 +318,11 @@ cd pulseview
 patch -p1 < ../../pulseview-cpp.patch
 cmake $CM -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl .
 make $PARALLEL
-cp -r "$PREFIX"/src/android/java .
+git clone https://github.com/zeldin/pulseview_android_java java
 cp -r libs java/
 mkdir -p java/res/drawable
 cp icons/sigrok-logo-notext.png java/res/drawable/logo.png
 cd java
-patch -p2 < ../../../pulseview-java.patch
 cp "$PREFIX"/jar/QtAndroid-bundled.jar libs/
 cp "$PREFIX"/jar/QtAndroidAccessibility-bundled.jar libs/
 mkdir -p assets