Android build name correction
Fixes #31
See #143 and #596 for solutions to the whole build system.
Closes #971
diff --git a/android/jni/examples.mk b/android/jni/examples.mk
index 30b5c84..e2993c3 100644
--- a/android/jni/examples.mk
+++ b/android/jni/examples.mk
@@ -20,6 +20,12 @@
LIBUSB_ROOT_REL := ../..
LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
+ifeq ($(USE_PC_NAME),1)
+ LIBUSB_MODULE := usb-1.0
+else
+ LIBUSB_MODULE := libusb1.0
+endif
+
# dpfp
include $(CLEAR_VARS)
@@ -31,7 +37,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := dpfp
@@ -50,7 +56,7 @@
LOCAL_CFLAGS := -DDPFP_THREADED -pthread
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := dpfp_threaded
@@ -68,7 +74,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := fxload
@@ -85,7 +91,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := hotplugtest
@@ -102,7 +108,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := listdevs
@@ -119,7 +125,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := sam3u_benchmark
@@ -136,7 +142,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := xusb
diff --git a/android/jni/libusb.mk b/android/jni/libusb.mk
index dacf1ee..8786626 100644
--- a/android/jni/libusb.mk
+++ b/android/jni/libusb.mk
@@ -48,6 +48,13 @@
LOCAL_LDLIBS := -llog
-LOCAL_MODULE := libusb1.0
+ifeq ($(USE_PC_NAME),1)
+ LOCAL_MODULE := usb-1.0
+else
+ LOCAL_MODULE := libusb1.0
+ $(warning Building to legacy library name libusb1.0, which differs from pkg-config.)
+ $(warning Use ndk-build USE_PC_NAME=1 to change the module name to the compatible usb-1.0.)
+ $(warning USE_PC_NAME=1 may be the default in the future.)
+endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/android/jni/tests.mk b/android/jni/tests.mk
index b42bd1c..a32942a 100644
--- a/android/jni/tests.mk
+++ b/android/jni/tests.mk
@@ -20,6 +20,12 @@
LIBUSB_ROOT_REL := ../..
LIBUSB_ROOT_ABS := $(LOCAL_PATH)/../..
+ifeq ($(USE_PC_NAME),1)
+ LIBUSB_MODULE := usb-1.0
+else
+ LIBUSB_MODULE := libusb1.0
+endif
+
# stress
include $(CLEAR_VARS)
@@ -32,7 +38,7 @@
$(LOCAL_PATH)/.. \
$(LIBUSB_ROOT_ABS)
-LOCAL_SHARED_LIBRARIES += libusb1.0
+LOCAL_SHARED_LIBRARIES += $(LIBUSB_MODULE)
LOCAL_MODULE := stress
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 36ca1a0..cf676be 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11651
+#define LIBUSB_NANO 11652