emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 492aa74b13b 1/3: Update Android port


From: Po Lu
Subject: feature/android 492aa74b13b 1/3: Update Android port
Date: Sun, 29 Jan 2023 06:02:53 -0500 (EST)

branch: feature/android
commit 492aa74b13bb2c9d5a751d043fed2ef9e9365781
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * INSTALL.android (module_target): Clarify documentation.
    * cross/ndk-build/ndk-build-shared-library.mk:
    * cross/ndk-build/ndk-build-static-library.mk: Fix building Neon objects.
    * java/AndroidManifest.xml.in: Add a version code.
---
 INSTALL.android                             | 26 +++++++++++++++++++++++++-
 cross/ndk-build/ndk-build-shared-library.mk | 11 ++++++++---
 cross/ndk-build/ndk-build-static-library.mk |  9 +++++++--
 java/AndroidManifest.xml.in                 |  1 +
 4 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/INSTALL.android b/INSTALL.android
index d84d20b533b..eeeb14d78b3 100644
--- a/INSTALL.android
+++ b/INSTALL.android
@@ -34,7 +34,8 @@ script like so:
 Replacing the paths in the command line above with:
 
   - the path to the `android.jar' headers which come with the Android
-    SDK.  They must correspond to Android version 13 or later.
+    SDK.  They must correspond to Android version 13 (API level 33) or
+    later.
 
   - the path to the C compiler in the Android NDK, for the machine you
     are building Emacs to run on.
@@ -154,6 +155,8 @@ work, along with what has to be patched to make them work:
 
   libpng       - https://android.googlesource.com/platform/external/libpng
   libwebp      - https://android.googlesource.com/platform/external/webp
+     (You must apply the patch at the end of this file for the resulting
+      binary to work on armv7 devices.)
   giflib       - https://android.googlesource.com/platform/external/giflib
      (You must add LOCAL_EXPORT_CFLAGS := -I$(LOCAL_PATH) before
       its Android.mk includes $(BUILD_STATIC_LIBRARY))
@@ -639,3 +642,24 @@ index bf277d2..36734d9 100644
  LOCAL_MODULE:= libsqlite_static_minimal
  LOCAL_SDK_VERSION := 23
  include $(BUILD_STATIC_LIBRARY)
+
+PATCH FOR WEBP
+
+diff --git a/Android.mk b/Android.mk
+index c7bcb0f5..d4da1704 100644
+--- a/Android.mk
++++ b/Android.mk
+@@ -28,9 +28,10 @@ ifneq ($(findstring armeabi-v7a, $(TARGET_ARCH_ABI)),)
+   # Setting LOCAL_ARM_NEON will enable -mfpu=neon which may cause illegal
+   # instructions to be generated for armv7a code. Instead target the neon code
+   # specifically.
+-  NEON := c.neon
+-  USE_CPUFEATURES := yes
+-  WEBP_CFLAGS += -DHAVE_CPU_FEATURES_H
++  # NEON := c.neon
++  # USE_CPUFEATURES := yes
++  # WEBP_CFLAGS += -DHAVE_CPU_FEATURES_H
++  NEON := c
+ else
+   NEON := c
+ endif
diff --git a/cross/ndk-build/ndk-build-shared-library.mk 
b/cross/ndk-build/ndk-build-shared-library.mk
index f169e89d058..a63bf90b042 100644
--- a/cross/ndk-build/ndk-build-shared-library.mk
+++ b/cross/ndk-build/ndk-build-shared-library.mk
@@ -50,7 +50,7 @@ $(call objname,$(LOCAL_MODULE),$(basename $(1))): 
$(LOCAL_PATH)/$(1)
        $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_ASFLAGS_$(LOCAL_MODULE))
 
 else
-ifneq (x$(suffix $(1)),x.asm)
+ifneq (x.$(suffix $(1)),x.asm)
 $$(error Unsupported suffix: $(suffix $(1)))
 else
 ifneq (x$(LOCAL_ASM_RULE_DEFINED),x)
@@ -124,10 +124,15 @@ LOCAL_MODULE_FILENAME := $(LOCAL_MODULE_FILENAME).so
 include ndk-resolve.mk
 
 # Then define rules to build all objects.
-ALL_SOURCE_FILES = $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(NDK_BUILD_ARCH))
+ALL_SOURCE_FILES := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(NDK_BUILD_ARCH))
 
 # This defines all dependencies.
-ALL_OBJECT_FILES$(LOCAL_MODULE) =
+ALL_OBJECT_FILES$(LOCAL_MODULE) :=
+
+# Now filter out code that is only built on systems with neon.
+ifeq ($(NDK_BUILD_ABI),armeabi-v7a)
+ALL_SOURCE_FILES := $(filter-out %.neon,$(ALL_SOURCE_FILES))
+endif
 
 $(foreach source,$(ALL_SOURCE_FILES),$(eval $(call 
single-object-target,$(source))))
 
diff --git a/cross/ndk-build/ndk-build-static-library.mk 
b/cross/ndk-build/ndk-build-static-library.mk
index d5a8e93800d..e6e2d2810fb 100644
--- a/cross/ndk-build/ndk-build-static-library.mk
+++ b/cross/ndk-build/ndk-build-static-library.mk
@@ -42,7 +42,7 @@ $(call objname,$(LOCAL_MODULE),$(basename $(1))): 
$(LOCAL_PATH)/$(1)
        $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_ASFLAGS_$(LOCAL_MODULE))
 
 else
-ifneq (x$(suffix $(1)),x.asm)
+ifneq (x.$(suffix $(1)),x.asm)
 $$(error Unsupported suffix: $(suffix $(1)))
 else
 ifneq (x$(LOCAL_ASM_RULE_DEFINED),x)
@@ -113,7 +113,12 @@ LOCAL_MODULE_FILENAME := $(LOCAL_MODULE_FILENAME).a
 include ndk-resolve.mk
 
 # Then define rules to build all objects.
-ALL_SOURCE_FILES = $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(NDK_BUILD_ARCH))
+ALL_SOURCE_FILES := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(NDK_BUILD_ARCH))
+
+# Now filter out code that is only built on systems with neon.
+ifeq ($(NDK_BUILD_ABI),armeabi-v7a)
+ALL_SOURCE_FILES := $(filter-out %.neon,$(ALL_SOURCE_FILES))
+endif
 
 # This defines all dependencies.
 ALL_OBJECT_FILES$(LOCAL_MODULE) =
diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index 09e4e788e0b..3833e1735c3 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. -->
          package="org.gnu.emacs"
          android:targetSandboxVersion="1"
          android:installLocation="auto"
+         android:versionCode="@emacs_major_version@"
          android:versionName="@version@">
 
   <!-- Paste in every permission in existence so Emacs can do



reply via email to

[Prev in Thread] Current Thread [Next in Thread]