1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Respect --disable-build-details in Android builds

* java/Makefile.in (BUILD_DETAILS, GEN_BUILD_DETAILS): New
variables.
(install_tmp): Tolerate failures in generation of metadata files
and prefix commands for such generation with GEN_BUILD_DETAILS.

* lisp/version.el (android-read-build-system)
(android-read-build-time): Return nil if metadata file does not
exist.
This commit is contained in:
Po Lu 2024-06-30 16:26:39 +08:00
parent c8473ee8c1
commit c6a052f2fe
2 changed files with 21 additions and 12 deletions

View file

@ -57,7 +57,6 @@ else
GZIP_PROG = GZIP_PROG =
endif endif
# Android 4.3 and earlier require Emacs to be signed with a different # Android 4.3 and earlier require Emacs to be signed with a different
# digital signature algorithm. # digital signature algorithm.
@ -77,6 +76,11 @@ else
AAPT_ASSET_ARGS = AAPT_ASSET_ARGS =
endif endif
# This will be replaced by `--no-build-details' if details of the build
# system are not to be recorded in generated packages.
BUILD_DETAILS = @BUILD_DETAILS@
GEN_BUILD_DETAILS := $(if $(BUILD_DETAILS),true ||,)
SIGN_EMACS = -keystore $(srcdir)/emacs.keystore -storepass \ SIGN_EMACS = -keystore $(srcdir)/emacs.keystore -storepass \
emacs1 $(JARSIGNER_FLAGS) emacs1 $(JARSIGNER_FLAGS)
SIGN_EMACS_V2 = sign --v2-signing-enabled --ks \ SIGN_EMACS_V2 = sign --v2-signing-enabled --ks \
@ -249,13 +253,13 @@ install_temp: $(CROSS_BINS) $(CROSS_LIBS) $(RESOURCE_FILES) \
| xargs ${GZIP_PROG} -9n ; \ | xargs ${GZIP_PROG} -9n ; \
} }
# Produce metadata files providing build information and suchlike. # Produce metadata files providing build information and suchlike.
$(AM_V_SILENT) \ -$(AM_V_SILENT) $(GEN_BUILD_DETAILS) \
{ (cd $(top_srcdir) \ { (cd $(top_srcdir) \
&& git rev-parse HEAD || echo "Unknown") \ && git rev-parse HEAD || echo "Unknown") \
&& (git rev-parse --abbrev-ref HEAD \ && (git rev-parse --abbrev-ref HEAD \
|| echo "Unknown") } 2> /dev/null > \ || echo "Unknown") } 2> /dev/null > \
install_temp/assets/version install_temp/assets/version
$(AM_V_SILENT) \ -$(AM_V_SILENT) $(GEN_BUILD_DETAILS) \
{ hostname; date +%s; } > install_temp/assets/build_info { hostname; date +%s; } > install_temp/assets/build_info
# Produce the file index. # Produce the file index.
$(AM_V_SILENT) $(libsrc)/asset-directory-tool \ $(AM_V_SILENT) $(libsrc)/asset-directory-tool \

View file

@ -28,26 +28,31 @@
;; If either of the files examined by the following two functions does
;; not exist, Emacs was configured `--disable-build-details'.
(defun android-read-build-system () (defun android-read-build-system ()
"Obtain the host name of the system on which Emacs was built. "Obtain the host name of the system on which Emacs was built.
Use the data stored in the special file `/assets/build_info'. Use the data stored in the special file `/assets/build_info'.
Value is the string ``Unknown'' upon failure, else the hostname Value is the string ``Unknown'' upon failure, else the hostname
of the build system." of the build system."
(with-temp-buffer (when (file-exists-p "/assets/build_info")
(insert-file-contents "/assets/build_info") (with-temp-buffer
(let ((string (buffer-substring 1 (line-end-position)))) (insert-file-contents "/assets/build_info")
(and (not (equal string "Unknown")) string)))) (let ((string (buffer-substring 1 (line-end-position))))
(and (not (equal string "Unknown")) string)))))
(defun android-read-build-time () (defun android-read-build-time ()
"Obtain the time at which Emacs was built. "Obtain the time at which Emacs was built.
Use the data stored in the special file `/assets/build_info'. Use the data stored in the special file `/assets/build_info'.
Value is nil upon failure, else the time in the same format as Value is nil upon failure, else the time in the same format as
returned by `current-time'." returned by `current-time'."
(with-temp-buffer (when (file-exists-p "/assets/build_info")
(insert-file-contents "/assets/build_info") (with-temp-buffer
(end-of-line) (insert-file-contents "/assets/build_info")
(let ((number (read (current-buffer)))) (end-of-line)
(time-convert number 'list)))) (let ((number (read (current-buffer))))
(time-convert number 'list)))))