From a48f062e36be3ce5890a8a789272f31f074fea40 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 6 Jun 2024 20:55:40 +0800 Subject: [PATCH] Minor enhancements to the Android build system * build-aux/ndk-build-helper-1.mk: * build-aux/ndk-build-helper-2.mk: * cross/ndk-build/ndk-build-shared-library.mk: * cross/ndk-build/ndk-build-static-library.mk: * cross/ndk-build/ndk-resolve.mk (NDK_SO_EXTRA_FLAGS_$(LOCAL_MODULE)): (NDK_LOCAL_SO_NAMES_$(LOCAL_MODULE)): (NDK_LOCAL_A_NAMES_$(LOCAL_MODULE)): Reinforce tests for string prefixes. * m4/ndk-build.m4 (ndk_INIT): Guarantee that a module's dependencies are recorded. * configure.ac (XCONFIGURE): Prepare for building librsvg. --- build-aux/ndk-build-helper-1.mk | 4 ++-- build-aux/ndk-build-helper-2.mk | 6 +++--- configure.ac | 10 +++++++--- cross/ndk-build/ndk-build-shared-library.mk | 2 +- cross/ndk-build/ndk-build-static-library.mk | 2 +- cross/ndk-build/ndk-resolve.mk | 6 +++--- m4/ndk-build.m4 | 1 + 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/build-aux/ndk-build-helper-1.mk b/build-aux/ndk-build-helper-1.mk index 490064b6e32..985f7cddfaf 100644 --- a/build-aux/ndk-build-helper-1.mk +++ b/build-aux/ndk-build-helper-1.mk @@ -37,7 +37,7 @@ $(info Building $(build_kind)) $(info $(LOCAL_MODULE)) $(info $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) -ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) +ifeq ($(filter-out lib%,$(LOCAL_MODULE)),) NDK_SO_NAMES = $(LOCAL_MODULE)_emacs.so else NDK_SO_NAMES = lib$(LOCAL_MODULE)_emacs.so @@ -50,7 +50,7 @@ $$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARI endef define add-so-name -ifeq ($(findstring lib,$(1)),lib) +ifeq ($(filter-out lib%,$(1)),) NDK_SO_NAME = $(1)_emacs.so else NDK_SO_NAME = lib$(1)_emacs.so diff --git a/build-aux/ndk-build-helper-2.mk b/build-aux/ndk-build-helper-2.mk index e696fcbdade..697740b3d45 100644 --- a/build-aux/ndk-build-helper-2.mk +++ b/build-aux/ndk-build-helper-2.mk @@ -31,14 +31,14 @@ $(info Building $(build_kind)) $(info $(LOCAL_MODULE)) $(info $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) -ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) +ifeq ($(filter-out lib%,$(LOCAL_MODULE)),) NDK_A_NAMES = $(LOCAL_MODULE).a else NDK_A_NAMES = lib$(LOCAL_MODULE).a endif define add-a-name -ifeq ($(findstring lib,$(1)),lib) +ifeq ($(filter-out lib%,$(1)),) NDK_A_NAME = $(1).a else NDK_A_NAME = lib$(1).a @@ -58,7 +58,7 @@ endif endef define add-so-name -ifeq ($(findstring lib,$(1)),lib) +ifeq ($(filter-out lib%,$(1)),) NDK_SO_NAME = $(1)_emacs.so else NDK_SO_NAME = lib$(1)_emacs.so diff --git a/configure.ac b/configure.ac index e3213f4ac79..1754ca4f977 100644 --- a/configure.ac +++ b/configure.ac @@ -1251,6 +1251,7 @@ package will likely install on older systems but crash on startup.]) passthrough="$passthrough --with-pop=$with_pop" passthrough="$passthrough --with-harfbuzz=$with_harfbuzz" passthrough="$passthrough --with-threads=$with_threads" + passthrough="$passthrough --with-rsvg=$with_rsvg" # Now pass through some checking-related options. emacs_val="--enable-check-lisp-object-type=$enable_check_lisp_object_type" @@ -1341,9 +1342,9 @@ if test "$ANDROID" = "yes"; then with_harfbuzz=no with_native_compilation=no with_threads=no + with_rsvg=no fi - with_rsvg=no with_libsystemd=no with_cairo=no with_xft=no @@ -3559,10 +3560,13 @@ fi HAVE_RSVG=no if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" \ || test "${opsys}" = "mingw32" || test "${HAVE_BE_APP}" = "yes" \ - || test "${window_system}" = "pgtk"; then + || test "${window_system}" = "pgtk" \ + || test "${REALLY_ANDROID}" = "yes"; then if test "${with_rsvg}" != "no"; then RSVG_REQUIRED=2.14.0 - RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED" + AS_IF([test "${REALLY_ANDROID}" = "yes"], + [RSVG_MODULE="librsvg"], + [RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"]) EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE]) AC_SUBST([RSVG_CFLAGS]) diff --git a/cross/ndk-build/ndk-build-shared-library.mk b/cross/ndk-build/ndk-build-shared-library.mk index 74c6756a0c1..b0605503271 100644 --- a/cross/ndk-build/ndk-build-shared-library.mk +++ b/cross/ndk-build/ndk-build-shared-library.mk @@ -125,7 +125,7 @@ NDK_CFLAGS ::= -mthumb endif endif -ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) +ifeq ($(filter-out lib%,$(LOCAL_MODULE)),) LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)_emacs else LOCAL_MODULE_FILENAME := lib$(LOCAL_MODULE)_emacs diff --git a/cross/ndk-build/ndk-build-static-library.mk b/cross/ndk-build/ndk-build-static-library.mk index aba4539f6bb..449eaadb403 100644 --- a/cross/ndk-build/ndk-build-static-library.mk +++ b/cross/ndk-build/ndk-build-static-library.mk @@ -110,7 +110,7 @@ NDK_CFLAGS ::= -mthumb endif endif -ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) +ifeq ($(filter-out lib%,$(LOCAL_MODULE)),) LOCAL_MODULE_FILENAME := $(LOCAL_MODULE) else LOCAL_MODULE_FILENAME := lib$(LOCAL_MODULE) diff --git a/cross/ndk-build/ndk-resolve.mk b/cross/ndk-build/ndk-resolve.mk index 4d8ecf8667a..896c29f7f90 100644 --- a/cross/ndk-build/ndk-resolve.mk +++ b/cross/ndk-build/ndk-resolve.mk @@ -140,7 +140,7 @@ NDK_SO_EXTRA_FLAGS_$(LOCAL_MODULE) += -landroid endif ifeq ($(findstring $(1),$(NDK_SYSTEM_LIBRARIES))$(2)$(3),) -ifneq ($(findstring lib,$(1)),) +ifeq ($(filter-out lib%,$(1)),) NDK_LOCAL_SO_NAMES_$(LOCAL_MODULE) += $(1)_emacs.so else NDK_LOCAL_SO_NAMES_$(LOCAL_MODULE) += lib$(1)_emacs.so @@ -148,7 +148,7 @@ endif endif ifneq ($(2),) -ifneq ($(findstring lib,$(1)),) +ifeq ($(filter-out lib%,$(1)),) NDK_LOCAL_A_NAMES_$(LOCAL_MODULE) += $(1).a else NDK_LOCAL_A_NAMES_$(LOCAL_MODULE) += lib$(1).a @@ -156,7 +156,7 @@ endif endif ifneq ($(3),) -ifneq ($(findstring lib,$(1)),) +ifeq ($(filter-out lib%,$(1)),) NDK_WHOLE_A_NAMES_$(LOCAL_MODULE) += $(1).a else NDK_WHOLE_A_NAMES_$(LOCAL_MODULE) += lib$(1).a diff --git a/m4/ndk-build.m4 b/m4/ndk-build.m4 index 2689ee34287..f86d4e4fc1e 100644 --- a/m4/ndk-build.m4 +++ b/m4/ndk-build.m4 @@ -178,6 +178,7 @@ but a working C++ compiler was not found.])]) AC_MSG_RESULT([yes]) # Make sure the module is prepended. + ndk_MODULES="$ndk_MODULES $module_target" ndk_MAKEFILES="$ndk_android_mk $ndk_MAKEFILES" ndk_import_includes="$module_includes $ndk_import_includes"