diff options
author | Po Lu <luangruo@yahoo.com> | 2023-01-26 15:37:04 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-01-26 15:37:04 +0800 |
commit | 4255d7f0514c5fa1badded6b0bc445ec2d2764c0 (patch) | |
tree | 93efa03d4ba0c1987eab16645f9ebcc405ab9e19 /build-aux | |
parent | 8125e26a323cb8906a14005519b0fa5693718c90 (diff) | |
download | emacs-4255d7f0514c5fa1badded6b0bc445ec2d2764c0.tar.gz |
Update Android port
* .gitignore: Ignore lib/math.h.
* INSTALL.android: Update accordingly.
* build-aux/ndk-build-helper-1.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper.mk:
* build-aux/ndk-module-extract.awk: Handle C++ modules.
* configure.ac: Enable libxml2 on Android.
* cross/ndk-build/Makefile.in:
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk:
* cross/ndk-build/ndk-build.mk.in:
* cross/ndk-build/ndk-resolve.mk: Fix dependency resolution of
includes.
* java/org/gnu/emacs/EmacsView.java (popupMenu): Fix minimum SDK
version for actual popup menus.
* lib/math.h: Delete file.
* m4/ndk-build.m4 (ndk_SEARCH_MODULE, ndk_CHECK_MODULES): Look
for nasm and C++ libraries.
* src/android.c (faccessat): Rename to `android_faccessat'.
* src/android.h: Update prototypes.
* src/dired.c (file_name_completion_dirp):
* src/fileio.c (file_access_p, Faccess_file, file_directory_p):
* src/lisp.h:
* src/lread.c (openp):
* src/process.c (allocate_pty): Use sys_faccessat.
* src/sysdep.c (sys_faccessat): New function.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/ndk-build-helper-1.mk | 31 | ||||
-rw-r--r-- | build-aux/ndk-build-helper-2.mk | 22 | ||||
-rw-r--r-- | build-aux/ndk-build-helper.mk | 35 | ||||
-rw-r--r-- | build-aux/ndk-module-extract.awk | 30 |
4 files changed, 97 insertions, 21 deletions
diff --git a/build-aux/ndk-build-helper-1.mk b/build-aux/ndk-build-helper-1.mk index 86e3ebd6558..4ffe0d423e4 100644 --- a/build-aux/ndk-build-helper-1.mk +++ b/build-aux/ndk-build-helper-1.mk @@ -30,13 +30,12 @@ NDK_A_NAMES = # on to recurse over libraries. NDK_$(LOCAL_MODULE)_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES) NDK_$(LOCAL_MODULE)_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) +NDK_$(LOCAL_MODULE)_EXPORT_INCLUDES := $(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES) $(info Building $(build_kind)) $(info $(LOCAL_MODULE)) -$(info $(addprefix $(ANDROID_MODULE_DIRECTORY)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) +$(info $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) -$(info $(foreach dir,$(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES),-I$(dir))) -$(info $(LOCAL_EXPORT_CFLAGS)) ifeq ($(LOCAL_MODULE_FILENAME),) ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) NDK_SO_NAMES = $(LOCAL_MODULE)_emacs.so @@ -62,15 +61,31 @@ $$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARI endif endef -# Resolve additional dependencies based on LOCAL_STATIC_LIBRARIES and -# LOCAL_SHARED_LIBRARIES. Static library dependencies can be ignored -# while building a shared library, as they will be linked in to the -# resulting shared object file later. +# Figure out includes from dependencies as well. +NDK_INCLUDES := $(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES) + +define add-includes +ifeq ($$(findstring $$(NDK_$(1)_EXPORT_INCLUDES),$$(NDK_INCLUDES)),) +NDK_INCLUDES += $$(NDK_$(1)_EXPORT_INCLUDES) + +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)) $$(NDK_$(1)_STATIC_LIBRARIES),$$(eval $$(call add-includes,$$(module)))) +endif +endef + +# Resolve additional dependencies and their export includes based on +# LOCAL_STATIC_LIBRARIES and LOCAL_SHARED_LIBRARIES. Static library +# dependencies can be ignored while building a shared library, as they +# will be linked in to the resulting shared object file later. -SYSTEM_LIBRARIES = z libz libc c +SYSTEM_LIBRARIES = z libz libc c libdl dl stdc++ libstdc++ $(foreach module,$(filter-out $(SYSTEM_LIBRARIES), $(LOCAL_SHARED_LIBRARIES)),$(eval $(call add-so-name,$(module)))) +$(foreach module,$(filter-out $(SYSTEM_LIBRARIES), $(LOCAL_SHARED_LIBRARIES) $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_LIBRARIES)),$(eval $(call add-includes,$(module)))) + +$(info $(foreach dir,$(NDK_INCLUDES),-I$(dir))) +$(info $(LOCAL_EXPORT_CFLAGS)) $(info $(LOCAL_EXPORT_LDFLAGS) $(abspath $(addprefix $(NDK_BUILD_DIR)/,$(NDK_A_NAMES))) -L$(abspath $(NDK_BUILD_DIR)) $(foreach soname,$(NDK_SO_NAMES),-l:$(soname))) $(info $(NDK_SO_NAMES)) +$(info $(filter %stdc++,$(LOCAL_SHARED_LIBRARIES))) $(info End) diff --git a/build-aux/ndk-build-helper-2.mk b/build-aux/ndk-build-helper-2.mk index bd50e8b3efa..9c9e7cf09a9 100644 --- a/build-aux/ndk-build-helper-2.mk +++ b/build-aux/ndk-build-helper-2.mk @@ -24,13 +24,12 @@ NDK_A_NAMES = # on to recurse over libraries. NDK_$(LOCAL_MODULE)_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES) NDK_$(LOCAL_MODULE)_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) +NDK_$(LOCAL_MODULE)_EXPORT_INCLUDES := $(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES) $(info Building $(build_kind)) $(info $(LOCAL_MODULE)) -$(info $(addprefix $(ANDROID_MODULE_DIRECTORY)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) +$(info $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES$(EMACS_ABI)))) -$(info $(foreach dir,$(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES),-I$(dir))) -$(info $(LOCAL_EXPORT_CFLAGS)) ifeq ($(LOCAL_MODULE_FILENAME),) ifeq ($(findstring lib,$(LOCAL_MODULE)),lib) @@ -74,14 +73,29 @@ $$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARI endif endef +# Figure out includes from dependencies as well. +NDK_INCLUDES := $(LOCAL_EXPORT_C_INCLUDE_DIRS) $(LOCAL_EXPORT_C_INCLUDES) + +define add-includes +ifeq ($$(findstring $$(NDK_$(1)_EXPORT_INCLUDES),$$(NDK_INCLUDES)),) +NDK_INCLUDES += $$(NDK_$(1)_EXPORT_INCLUDES) + +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)) $$(NDK_$(1)_STATIC_LIBRARIES),$$(eval $$(call add-includes,$$(module)))) +endif +endef + # Resolve additional dependencies based on LOCAL_STATIC_LIBRARIES and # LOCAL_SHARED_LIBRARIES. -SYSTEM_LIBRARIES = z libz +SYSTEM_LIBRARIES = z libz libc c libdl dl libstdc++ stdc++ $(foreach module,$(filter-out $(SYSTEM_LIBRARIES), $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES)),$(eval $(call add-a-name,$(module)))) $(foreach module,$(filter-out $(SYSTEM_LIBRARIES), $(LOCAL_SHARED_LIBRARIES)),$(eval $(call add-so-name,$(module)))) +$(foreach module,$(filter-out $(SYSTEM_LIBRARIES), $(LOCAL_SHARED_LIBRARIES) $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_LIBRARIES)),$(eval $(call add-includes,$(module)))) +$(info $(foreach dir,$(NDK_INCLUDES),-I$(dir))) +$(info $(LOCAL_EXPORT_CFLAGS)) $(info $(LOCAL_EXPORT_LDFLAGS) $(abspath $(addprefix $(NDK_BUILD_DIR)/,$(NDK_A_NAMES))) $(and $(NDK_SO_NAMES), -L$(abspath $(NDK_BUILD_DIR)) $(foreach soname,$(NDK_SO_NAMES),-l:$(soname)))) $(info $(NDK_A_NAMES)) +$(info $(filter %stdc++,$(LOCAL_SHARED_LIBRARIES))) $(info End) diff --git a/build-aux/ndk-build-helper.mk b/build-aux/ndk-build-helper.mk index beb32cae3f1..886459b1378 100644 --- a/build-aux/ndk-build-helper.mk +++ b/build-aux/ndk-build-helper.mk @@ -21,20 +21,38 @@ # See the text under ``NDK BUILD SYSTEM IMPLEMENTATION'' in # INSTALL.android for more details. +# NDK_LAST_MAKEFILE is the last Makefile that was included. +NDK_LAST_MAKEFILE = $(lastword $(filter %Android.mk,$(MAKEFILE_LIST))) + +# local-makefile is the current Makefile being loaded. +local-makefile = $(NDK_LAST_MAKEFILE) + # Make NDK_BUILD_DIR absolute. NDK_BUILD_DIR := $(absname $(NDK_BUILD_DIR)) -# my-dir is a function that returns the Android module directory. -my-dir = $(ANDROID_MODULE_DIRECTORY) +# Make EMACS_SRCDIR absolute. This must be absolute, or nested +# Android.mk files will not be able to find CLEAR_VARS. +EMACS_SRCDIR := $(absname $(EMACS_SRCDIR)) + +# my-dir is a function that returns the Android module directory. If +# no Android.mk has been loaded, use ANDROID_MODULE_DIRECTORY. +my-dir = $(or $(and $(local-makefile),$(dir $(local-makefile))),$(ANDROID_MODULE_DIRECTORY)) + +# Return all Android.mk files under the first arg. +all-makefiles-under = $(wildcard $(1)/*/Android.mk) -# all-subdir-makefiles is a function which returns all Android.mk -# files within this directory. -all-subdir-makefiles = $(shell find . -name "Android.mk") +# Return all Android.mk files in subdirectories of this Makefile's +# location. +all-subdir-makefiles = $(call all-makefiles-under,$(call my-dir)) # These functions are not implemented. parent-makefile = grand-parent-makefile = -import-module = + +NDK_IMPORTS := + +# Add the specified module (arg 1) to NDK_IMPORTS. +import-module = $(eval NDK_IMPORTS += $(1)) # Print out module information every time BUILD_SHARED_LIBRARY is # called. @@ -48,5 +66,10 @@ CLEAR_VARS=$(EMACS_SRCDIR)/build-aux/ndk-build-helper-4.mk include $(ANDROID_MAKEFILE) +# Finally, print out the imports. +$(info Start Imports) +$(info $(NDK_IMPORTS)) +$(info End Imports) + # Dummy target. all: diff --git a/build-aux/ndk-module-extract.awk b/build-aux/ndk-module-extract.awk index eaea3e96dd8..681f20237fa 100644 --- a/build-aux/ndk-module-extract.awk +++ b/build-aux/ndk-module-extract.awk @@ -2,13 +2,27 @@ kind = $2 } +/^Start Imports$/ { + imports = 1 +} + // { - if (!match ($0, /^End$/) && !match ($0, /^Building.+$/)) + if (imports && ++imports > 2) + { + if (!match ($0, /^End Imports$/)) + makefile_imports = makefile_imports " " $1 + } + else if (!match ($0, /^End$/) && !match ($0, /^Building.+$/)) { if (kind) { - if (ldflags_found) - target = $0 + if (target_found) + cxx_deps = $0 + else if (ldflags_found) + { + target = $0 + target_found = 1 + } else if (cflags_found) { ldflags = $0 @@ -48,6 +62,7 @@ printf "module_cflags=\"%s\"\n", cflags printf "module_ldflags=\"%s\"\n", ldflags printf "module_target=\"%s\"\n", target + printf "module_cxx_deps=\"%s\"\n", cxx_deps } src = "" @@ -61,4 +76,13 @@ includes_found = "" cflags_found = "" ldflags_found = "" + target_found = "" +} + +/^End Imports$/ { + imports = "" + # Strip off leading whitespace. + gsub (/^[ \t]+/, "", makefile_imports) + printf "module_imports=\"%s\"\n", makefile_imports + makefile_imports = "" } |