summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt16
-rw-r--r--core/android.cpp8
-rwxr-xr-xpackaging/android/build.sh23
-rw-r--r--packaging/android/patches/libusb-android.patch94
4 files changed, 13 insertions, 128 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ea1ab212..3faf72c63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,7 +152,10 @@ else()
pkg_config_library(LIBXSLT libxslt REQUIRED)
endif()
pkg_config_library(LIBZIP libzip REQUIRED)
-pkg_config_library(LIBUSB libusb-1.0 QUIET)
+
+if(NOT ANDROID)
+ pkg_config_library(LIBUSB libusb-1.0 QUIET)
+endif()
include_directories(.
${CMAKE_CURRENT_BINARY_DIR}
@@ -190,6 +193,7 @@ endif()
if(ANDROID)
set(NO_PRINTING ON)
set(NO_USERMANUAL ON)
+ set(MAKE_TESTS OFF)
list(APPEND QT_EXTRA_COMPONENTS AndroidExtras)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
@@ -257,12 +261,18 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
find_package(Qt5 5.9.1 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
else()
# Kirigami 5.62 and newer require at least Qt 5.12
- find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
+ if(ANDROID)
+ find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
+ else()
+ find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
+ endif()
endif()
foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS})
list(APPEND QT_LIBRARIES Qt5::${_QT_COMPONENT})
endforeach()
-set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)
+if(NOT ANDROID)
+ set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)
+endif()
#set up the subsurface_link_libraries variable
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES})
diff --git a/core/android.cpp b/core/android.cpp
index d1a1570fb..34d4ac46e 100644
--- a/core/android.cpp
+++ b/core/android.cpp
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
-#include <libusb.h>
#include <errno.h>
#include <unistd.h>
#include <zip.h>
@@ -38,13 +37,6 @@ double system_divelist_default_font_size = -1;
int get_usb_fd(uint16_t idVendor, uint16_t idProduct);
void subsurface_OS_pref_setup(void)
{
- // Abusing this function to get a decent place where we can wire in
- // our open callback into libusb
-#ifdef libusb_android_open_callback_func
- libusb_set_android_open_callback(get_usb_fd);
-#elif __ANDROID__
-#error we need libusb_android_open_callback
-#endif
}
bool subsurface_ignore_font(const char *font)
diff --git a/packaging/android/build.sh b/packaging/android/build.sh
index 42d208587..53925ef45 100755
--- a/packaging/android/build.sh
+++ b/packaging/android/build.sh
@@ -315,29 +315,6 @@ if [ "$QUICK" = "" ] ; then
popd
fi
- "${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libusb
- if ! grep -q libusb_set_android_open_callback libusb/libusb/libusb.h ; then
- # Patch in our libusb callback
- pushd libusb
- patch -p1 < "$SUBSURFACE_SOURCE"/packaging/android/patches/libusb-android.patch
- popd
- fi
- if [ ! -e libusb/configure ] ; then
- pushd libusb
- mkdir m4
- autoreconf -i
- popd
- fi
- if [ ! -e "$PKG_CONFIG_LIBDIR/libusb-1.0.pc" ] ; then
- mkdir -p libusb-build-"$ARCH"
- pushd libusb-build-"$ARCH"
- ../libusb/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared --disable-udev --enable-system-log
- # --enable-debug-log
- make
- make install
- popd
- fi
-
fi # QUICK
pushd "$SUBSURFACE_SOURCE"
diff --git a/packaging/android/patches/libusb-android.patch b/packaging/android/patches/libusb-android.patch
deleted file mode 100644
index bb98743b8..000000000
--- a/packaging/android/patches/libusb-android.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff -ur libusb-1.0.19.orig/libusb/libusb.h libusb-1.0.19/libusb/libusb.h
---- libusb-1.0.19.orig/libusb/libusb.h 2014-06-13 20:31:35.000000000 +0200
-+++ libusb-1.0.19/libusb/libusb.h 2015-08-20 22:26:15.851840655 +0200
-@@ -1991,6 +1991,14 @@
- void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
- libusb_hotplug_callback_handle handle);
-
-+#ifdef __ANDROID__
-+typedef int (*libusb_android_open_callback_func)(uint16_t idVendor, uint16_t idProduct);
-+/* Make the darn thing ifdef'able */
-+#define libusb_android_open_callback_func libusb_android_open_callback_func
-+
-+void libusb_set_android_open_callback(libusb_android_open_callback_func aocf);
-+#endif
-+
- #ifdef __cplusplus
- }
- #endif
-diff -ur libusb-1.0.19.orig/libusb/os/linux_usbfs.c libusb-1.0.19/libusb/os/linux_usbfs.c
---- libusb-1.0.19.orig/libusb/os/linux_usbfs.c 2014-06-13 20:31:35.000000000 +0200
-+++ libusb-1.0.19/libusb/os/linux_usbfs.c 2015-08-20 22:24:26.841479417 +0200
-@@ -179,6 +179,14 @@
- int iso_packet_offset;
- };
-
-+#ifdef __ANDROID__
-+static libusb_android_open_callback_func _android_open_callback = NULL;
-+
-+void libusb_set_android_open_callback(libusb_android_open_callback_func aocf) {
-+ _android_open_callback = aocf;
-+}
-+#endif
-+
- static int _get_usbfs_fd(struct libusb_device *dev, mode_t mode, int silent)
- {
- struct libusb_context *ctx = DEVICE_CTX(dev);
-@@ -186,14 +194,25 @@
- int fd;
- int delay = 10000;
-
-+#ifndef __ANDROID__
- if (usbdev_names)
- snprintf(path, PATH_MAX, "%s/usbdev%d.%d",
- usbfs_path, dev->bus_number, dev->device_address);
- else
- snprintf(path, PATH_MAX, "%s/%03d/%03d",
- usbfs_path, dev->bus_number, dev->device_address);
-+#endif
-
-+#ifdef __ANDROID__
-+ if (_android_open_callback) {
-+ fd = _android_open_callback(dev->device_descriptor.idVendor, dev->device_descriptor.idProduct);
-+ } else {
-+ usbi_err(ctx, "_android_open_callback not set");
-+ return LIBUSB_ERROR_OTHER;
-+ }
-+#else
- fd = open(path, mode);
-+#endif
- if (fd != -1)
- return fd; /* Success */
-
-@@ -369,11 +388,13 @@
- struct stat statbuf;
- int r;
-
-+#ifndef __ANDROID__
- usbfs_path = find_usbfs_path();
- if (!usbfs_path) {
- usbi_err(ctx, "could not find usbfs");
- return LIBUSB_ERROR_OTHER;
- }
-+#endif
-
- if (monotonic_clkid == -1)
- monotonic_clkid = find_monotonic_clock();
-@@ -469,6 +490,8 @@
- {
- #if defined(USE_UDEV)
- return linux_udev_start_event_monitor();
-+#elif __ANDROID__
-+ return LIBUSB_SUCCESS;
- #else
- return linux_netlink_start_event_monitor();
- #endif
-@@ -478,6 +501,8 @@
- {
- #if defined(USE_UDEV)
- return linux_udev_stop_event_monitor();
-+#elif __ANDROID__
-+ return LIBUSB_SUCCESS;
- #else
- return linux_netlink_stop_event_monitor();
- #endif