diff --git a/x11-packages/emacs-x/Makefile.patch b/x11-packages/emacs-x/Makefile.patch new file mode 100644 index 000000000..7ce22d19c --- /dev/null +++ b/x11-packages/emacs-x/Makefile.patch @@ -0,0 +1,11 @@ +--- ../Makefile.in.orig 2020-09-14 22:21:34.172699093 +0200 ++++ ./Makefile.in 2020-09-15 21:43:19.212824716 +0200 +@@ -365,7 +365,7 @@ + sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \ + -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "${standardlisppath}";' \ + -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "${locallisppath}";' \ +- -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "${buildlisppath}";' \ ++ -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "${standardlisppath}";' \ + -e '/^#define PATH_[^ ]*SEARCH /s/\([":]\):*/\1/g' \ + -e '/^#define PATH_[^ ]*SEARCH /s/:"/"/' \ + -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \ diff --git a/x11-packages/emacs-x/build.sh b/x11-packages/emacs-x/build.sh new file mode 100644 index 000000000..ea0e6bc02 --- /dev/null +++ b/x11-packages/emacs-x/build.sh @@ -0,0 +1,137 @@ +TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/emacs/ +TERMUX_PKG_DESCRIPTION="Extensible, customizable text editor-and more" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=27.2 +TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=b4a7cc4e78e63f378624e0919215b910af5bb2a0afc819fad298272e9f40c1b9 +TERMUX_PKG_DEPENDS="fontconfig, freetype, gdk-pixbuf, giflib, glib, libgnutls, libice, libjpeg-turbo, libpng, librsvg, libsm, libtiff, libx11, libxaw, libxcb, libxext, libxfixes, libxft, libxinerama, libxml2, libxmu, libxpm, libxrandr, libxrender, libxt, littlecms, ncurses, zlib" +TERMUX_PKG_BREAKS="emacs-dev" +TERMUX_PKG_REPLACES="emacs-dev" +TERMUX_PKG_SERVICE_SCRIPT=("emacsd" 'exec emacs --fg-daemon 2>&1') +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-autodepend +--without-cairo +--without-imagemagick +--without-libotf +--without-xaw3d +--without-gpm +--without-dbus +--without-gconf +--without-gsettings +--with-x +--with-x-toolkit=lucid +--without-selinux +--with-modules +--with-pdumper=yes +--with-dumping=none +" + +if $TERMUX_DEBUG_BUILD; then + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" + --enable-checking=yes,glyphs + --enable-check-lisp-object-type + " + CFLAGS+=" -gdwarf-4" +fi + +# Ensure use of system malloc: +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_sanitize_address=yes" +# Prevent configure from adding -nopie: +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_prog_cc_no_pie=no" +# Prevent linking against libelf: +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_lib_elf_elf_begin=no" +# implemented using dup3(), which fails if oldfd == newfd +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" gl_cv_func_dup2_works=no" +# disable setrlimit function to make termux-am work from within emacs +TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_setrlimit=no" +if [ "$TERMUX_ARCH" == "arm" ] || [ "$TERMUX_ARCH" == "i686" ]; then + # setjmp does not work properly on 32bit android: + # https://github.com/termux/termux-packages/issues/2599 + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_func__setjmp=no" + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_func_sigsetjmp=no" +fi +TERMUX_PKG_HOSTBUILD=true + +# Remove some irrelevant files: +TERMUX_PKG_RM_AFTER_INSTALL=" +bin/grep-changelog +share/applications/emacs.desktop +share/emacs/${TERMUX_PKG_VERSION}/etc/emacs.desktop +share/emacs/${TERMUX_PKG_VERSION}/etc/emacs.icon +share/emacs/${TERMUX_PKG_VERSION}/etc/images +share/emacs/${TERMUX_PKG_VERSION}/etc/refcards +share/emacs/${TERMUX_PKG_VERSION}/etc/tutorials/TUTORIAL.* +share/icons +share/man/man1/grep-changelog.1.gz +" + +# Remove ctags from the emacs package to prevent conflicting with +# the Universal Ctags from the 'ctags' package (the bin/etags +# program still remain in the emacs package): +TERMUX_PKG_RM_AFTER_INSTALL+=" bin/ctags share/man/man1/ctags.1 share/man/man1/ctags.1.gz" + +termux_step_post_get_source() { + # Certain packages are not safe to build on device because their + # build.sh script deletes specific files in $TERMUX_PREFIX. + if $TERMUX_ON_DEVICE_BUILD; then + termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds." + fi + + # XXX: We have to start with new host build each time + # to avoid build error when cross compiling. + rm -Rf $TERMUX_PKG_HOSTBUILD_DIR + + # Termux only use info pages for emacs. Remove the info directory + # to get a clean Info directory file dir. + rm -Rf $TERMUX_PREFIX/share/info +} + +termux_step_host_build() { + # Build a bootstrap-emacs binary to be used in termux_step_post_configure. + local NATIVE_PREFIX=$TERMUX_PKG_TMPDIR/emacs-native + mkdir -p $NATIVE_PREFIX/share/emacs/$TERMUX_PKG_VERSION + ln -s $TERMUX_PKG_SRCDIR/lisp $NATIVE_PREFIX/share/emacs/$TERMUX_PKG_VERSION/lisp + ( cd $TERMUX_PKG_SRCDIR; ./autogen.sh ) + $TERMUX_PKG_SRCDIR/configure --prefix=$NATIVE_PREFIX --without-all --without-x + make -j $TERMUX_MAKE_PROCESSES +} + +termux_step_post_configure() { + cp $TERMUX_PKG_HOSTBUILD_DIR/src/bootstrap-emacs $TERMUX_PKG_BUILDDIR/src/bootstrap-emacs + cp $TERMUX_PKG_HOSTBUILD_DIR/lib-src/make-docfile $TERMUX_PKG_BUILDDIR/lib-src/make-docfile + cp $TERMUX_PKG_HOSTBUILD_DIR/lib-src/make-fingerprint $TERMUX_PKG_BUILDDIR/lib-src/make-fingerprint + # Update timestamps so that the binaries does not get rebuilt: + touch -d "next hour" $TERMUX_PKG_BUILDDIR/src/bootstrap-emacs \ + $TERMUX_PKG_BUILDDIR/lib-src/make-docfile \ + $TERMUX_PKG_BUILDDIR/lib-src/make-fingerprint +} + +termux_step_post_make_install() { + cp $TERMUX_PKG_BUILDER_DIR/site-init.el $TERMUX_PREFIX/share/emacs/${TERMUX_PKG_VERSION}/lisp/emacs-lisp/ +} + +termux_step_create_debscripts() { + cat <<- EOF > ./postinst + #!$TERMUX_PREFIX/bin/sh + if [ "\$1" = "configure" ] || [ "\$1" = "abort-upgrade" ]; then + if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then + update-alternatives --install \ + $TERMUX_PREFIX/bin/editor editor $TERMUX_PREFIX/bin/emacs 40 + fi + fi + + cd $TERMUX_PREFIX/share/emacs/$TERMUX_PKG_VERSION/lisp + LC_ALL=C $TERMUX_PREFIX/bin/emacs -batch -l loadup --temacs=pdump + mv $TERMUX_PREFIX/bin/emacs*.pdmp $TERMUX_PREFIX/libexec/emacs/$TERMUX_PKG_VERSION/${TERMUX_ARCH}-linux-android*/ + EOF + + cat <<- EOF > ./prerm + #!$TERMUX_PREFIX/bin/sh + if [ "\$1" != "upgrade" ]; then + if [ -x "$TERMUX_PREFIX/bin/update-alternatives" ]; then + update-alternatives --remove editor $TERMUX_PREFIX/bin/emacs + fi + fi + EOF +} diff --git a/x11-packages/emacs-x/disable-fdsan.patch b/x11-packages/emacs-x/disable-fdsan.patch new file mode 100644 index 000000000..0a1c1f49b --- /dev/null +++ b/x11-packages/emacs-x/disable-fdsan.patch @@ -0,0 +1,34 @@ +diff -uNr emacs-27.2/src/emacs.c emacs-27.2.mod/src/emacs.c +--- emacs-27.2/src/emacs.c 2021-01-28 19:52:38.000000000 +0200 ++++ emacs-27.2.mod/src/emacs.c 2021-04-10 17:04:56.744343967 +0300 +@@ -120,6 +120,11 @@ + #include "pdumper.h" + #include "epaths.h" + ++#ifdef __ANDROID__ ++#include ++#include ++#endif ++ + static const char emacs_version[] = PACKAGE_VERSION; + static const char emacs_copyright[] = COPYRIGHT; + static const char emacs_bugreport[] = PACKAGE_BUGREPORT; +@@ -954,6 +959,18 @@ + /* Record (approximately) where the stack begins. */ + stack_bottom = (char *) &stack_bottom_variable; + ++#ifdef __ANDROID__ ++ // For Android 11+. ++ void *lib_handle = dlopen("libc.so", RTLD_LAZY); ++ if (lib_handle) { ++ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level"); ++ if (set_fdsan_error_level) { ++ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); ++ } ++ dlclose(lib_handle); ++ } ++#endif ++ + const char *dump_mode = NULL; + int skip_args = 0; + char *temacs = NULL; diff --git a/x11-packages/emacs-x/lib-src-emacsclient.c.patch b/x11-packages/emacs-x/lib-src-emacsclient.c.patch new file mode 100644 index 000000000..ebdacb9eb --- /dev/null +++ b/x11-packages/emacs-x/lib-src-emacsclient.c.patch @@ -0,0 +1,20 @@ +--- ./lib-src/emacsclient.c.orig 2020-07-29 23:40:41.000000000 +0200 ++++ ./lib-src/emacsclient.c 2020-09-14 21:36:04.883963456 +0200 +@@ -1411,7 +1411,7 @@ + tmpdirlen = min (n - 1, socknamesize); + # endif + if (tmpdirlen < 0) +- tmpdirlen = snprintf (sockname, socknamesize, "/tmp"); ++ tmpdirlen = snprintf (sockname, socknamesize, "@TERMUX_PREFIX@/tmp"); + } + socknamelen = local_sockname (sockname, socknamesize, tmpdirlen, + uid, server_name); +@@ -1495,7 +1495,7 @@ + uintmax_t id = uid; + char sockdirname[socknamesize]; + int sockdirnamelen = snprintf (sockdirname, sizeof sockdirname, +- "/run/user/%"PRIuMAX, id); ++ "@TERMUX_PREFIX@/var/run/user/%"PRIuMAX, id); + if (0 <= sockdirnamelen && sockdirnamelen < sizeof sockdirname + && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0) + message diff --git a/x11-packages/emacs-x/lisp-cus-start.el.patch.beforehostbuild b/x11-packages/emacs-x/lisp-cus-start.el.patch.beforehostbuild new file mode 100644 index 000000000..4ff5fec4c --- /dev/null +++ b/x11-packages/emacs-x/lisp-cus-start.el.patch.beforehostbuild @@ -0,0 +1,11 @@ +--- ./lisp/cus-start.el.orig 2020-07-27 23:21:49.000000000 +0200 ++++ ./lisp/cus-start.el 2020-09-14 21:34:59.583435440 +0200 +@@ -290,7 +290,7 @@ + "/tmp")) + (t + (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") +- "/tmp")))) ++ "@TERMUX_PREFIX@/tmp")))) + :initialize custom-initialize-delay) + ;; fns.c + (use-dialog-box menu boolean "21.1") diff --git a/x11-packages/emacs-x/lisp-loadup.el-2.patch.beforehostbuild b/x11-packages/emacs-x/lisp-loadup.el-2.patch.beforehostbuild new file mode 100644 index 000000000..4f328fc28 --- /dev/null +++ b/x11-packages/emacs-x/lisp-loadup.el-2.patch.beforehostbuild @@ -0,0 +1,15 @@ +--- ./lisp/loadup.el.orig 2020-07-27 23:21:49.000000000 +0200 ++++ ./lisp/loadup.el 2020-09-14 21:34:59.586768800 +0200 +@@ -423,7 +423,11 @@ + (message "Warning: Change in load-path due to site-init will be \ + lost after dumping"))) + +-(setq current-load-list nil) ++;; On an emacs that runs undumped, i.e. Android, this causes bogus ++;; entries to appear in load-history. Commenting this out causes an entry ++;; for loadup.el with a bogus filename to appear instead, but since it ++;; neither provides nor requires anything, it appears to be safe. ++;;(setq current-load-list nil) + ;; Avoid storing references to build directory in the binary. + (setq custom-current-group-alist nil) + diff --git a/x11-packages/emacs-x/lisp-net-tramp.el.patch.beforehostbuild b/x11-packages/emacs-x/lisp-net-tramp.el.patch.beforehostbuild new file mode 100644 index 000000000..19daf3136 --- /dev/null +++ b/x11-packages/emacs-x/lisp-net-tramp.el.patch.beforehostbuild @@ -0,0 +1,11 @@ +--- ./lisp/net/tramp.el.orig 2020-07-29 23:40:41.000000000 +0200 ++++ ./lisp/net/tramp.el 2020-09-14 21:34:59.593435521 +0200 +@@ -133,7 +133,7 @@ + ;; Suppress `shell-file-name' for w32 systems. + (defcustom tramp-encoding-shell + (let (shell-file-name) +- (or (tramp-compat-funcall 'w32-shell-name) "/bin/sh")) ++ (or (tramp-compat-funcall 'w32-shell-name) "@TERMUX_PREFIX@/bin/sh")) + "Use this program for encoding and decoding commands on the local host. + This shell is used to execute the encoding and decoding command on the + local host, so if you want to use \"~\" in those commands, you should diff --git a/x11-packages/emacs-x/lisp-server.el.patch.beforehostbuild b/x11-packages/emacs-x/lisp-server.el.patch.beforehostbuild new file mode 100644 index 000000000..537d2782c --- /dev/null +++ b/x11-packages/emacs-x/lisp-server.el.patch.beforehostbuild @@ -0,0 +1,11 @@ +--- ./lisp/server.el.orig 2019-11-28 10:49:15.353433913 +0100 ++++ ./lisp/server.el 2019-11-28 10:50:18.741175439 +0100 +@@ -277,7 +277,7 @@ + (let ((xdg_runtime_dir (getenv "XDG_RUNTIME_DIR"))) + (if xdg_runtime_dir + (format "%s/emacs" xdg_runtime_dir) +- (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))))) ++ (format "%s/emacs%d" "@TERMUX_PREFIX@/var/run" (user-uid)))))) + "The directory in which to place the server socket. + If local sockets are not supported, this is nil.") + diff --git a/x11-packages/emacs-x/lisp-term.el.patch.beforehostbuild b/x11-packages/emacs-x/lisp-term.el.patch.beforehostbuild new file mode 100644 index 000000000..fc56b5714 --- /dev/null +++ b/x11-packages/emacs-x/lisp-term.el.patch.beforehostbuild @@ -0,0 +1,11 @@ +--- ./lisp/term.el.orig 2019-11-28 10:52:45.633666279 +0100 ++++ ./lisp/term.el 2019-11-28 10:53:51.234778668 +0100 +@@ -1558,7 +1558,7 @@ + (push (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + process-environment)) + (apply #'start-process name buffer +- "/bin/sh" "-c" ++ "@TERMUX_PREFIX@/bin/sh" "-c" + (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\ + if [ $1 = .. ]; then shift; fi; exec \"$@\"" + term-height term-width) diff --git a/x11-packages/emacs-x/lisp-textmodes-ispell.el.patch.beforehostbuild b/x11-packages/emacs-x/lisp-textmodes-ispell.el.patch.beforehostbuild new file mode 100644 index 000000000..1d0ffec0c --- /dev/null +++ b/x11-packages/emacs-x/lisp-textmodes-ispell.el.patch.beforehostbuild @@ -0,0 +1,37 @@ +diff -u -r ../emacs-26.2/lisp/textmodes/ispell.el ./lisp/textmodes/ispell.el +--- ../emacs-26.2/lisp/textmodes/ispell.el 2019-02-20 13:44:42.000000000 +0000 ++++ ./lisp/textmodes/ispell.el 2019-04-14 18:15:07.894909566 +0000 +@@ -215,14 +215,14 @@ + :group 'ispell) + + (defcustom ispell-alternate-dictionary +- (cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2") +- ((file-readable-p "/usr/share/dict/web2") "/usr/share/dict/web2") +- ((file-readable-p "/usr/dict/words") "/usr/dict/words") +- ((file-readable-p "/usr/lib/dict/words") "/usr/lib/dict/words") +- ((file-readable-p "/usr/share/dict/words") "/usr/share/dict/words") +- ((file-readable-p "/usr/share/lib/dict/words") +- "/usr/share/lib/dict/words") +- ((file-readable-p "/sys/dict") "/sys/dict")) ++ (cond ((file-readable-p "@TERMUX_PREFIX@/dict/web2") "/usr/dict/web2") ++ ((file-readable-p "@TERMUX_PREFIX@/share/dict/web2") "/usr/share/dict/web2") ++ ((file-readable-p "@TERMUX_PREFIX@/dict/words") "/usr/dict/words") ++ ((file-readable-p "@TERMUX_PREFIX@/lib/dict/words") "/usr/lib/dict/words") ++ ((file-readable-p "@TERMUX_PREFIX@/share/dict/words") "/usr/share/dict/words") ++ ((file-readable-p "@TERMUX_PREFIX@/share/lib/dict/words") ++ "@TERMUX_PREFIX@/share/lib/dict/words") ++ ((file-readable-p "@TERMUX_PREFIX@/sys/dict") "@TERMUX_PREFIX@/sys/dict")) + "Alternate plain word-list dictionary for spelling help." + :type '(choice file (const :tag "None" nil)) + :group 'ispell) +@@ -266,9 +266,7 @@ + :group 'ispell) + + (defcustom ispell-look-command +- (cond ((file-exists-p "/bin/look") "/bin/look") +- ((file-exists-p "/usr/local/bin/look") "/usr/local/bin/look") +- ((file-exists-p "/usr/bin/look") "/usr/bin/look") ++ (cond ((file-exists-p "@TERMUX_PREFIX@/bin/look") "@TERMUX_PREFIX@/bin/look") + (t "look")) + "Name of the look command for search processes. + This must be an absolute file name." diff --git a/x11-packages/emacs-x/no_user_fullname.patch b/x11-packages/emacs-x/no_user_fullname.patch new file mode 100644 index 000000000..153dbe63a --- /dev/null +++ b/x11-packages/emacs-x/no_user_fullname.patch @@ -0,0 +1,11 @@ +--- ./src/editfns.c.orig 2020-07-29 23:40:42.000000000 +0200 ++++ ./src/editfns.c 2020-09-14 21:36:04.890630177 +0200 +@@ -1250,7 +1250,7 @@ + if (!pw) + return Qnil; + +- p = USER_FULL_NAME; ++ p = "unknown"; + /* Chop off everything after the first comma. */ + q = strchr (p, ','); + full = make_string (p, q ? q - p : strlen (p)); \ No newline at end of file diff --git a/x11-packages/emacs-x/site-init.el b/x11-packages/emacs-x/site-init.el new file mode 100644 index 000000000..f93baebab --- /dev/null +++ b/x11-packages/emacs-x/site-init.el @@ -0,0 +1,4 @@ +; Enable terminal mouse events: +(xterm-mouse-mode 1) +(global-set-key [mouse-4] 'scroll-down-line) +(global-set-key [mouse-5] 'scroll-up-line) diff --git a/x11-packages/emacs-x/src-callproc.c.patch b/x11-packages/emacs-x/src-callproc.c.patch new file mode 100644 index 000000000..f6588203a --- /dev/null +++ b/x11-packages/emacs-x/src-callproc.c.patch @@ -0,0 +1,11 @@ +--- ./src/callproc.c.orig 2020-07-29 23:40:42.000000000 +0200 ++++ ./src/callproc.c 2020-09-14 21:36:04.897296897 +0200 +@@ -1621,7 +1621,7 @@ + dir_warning ("arch-independent data dir", Vdata_directory); + + sh = getenv ("SHELL"); +- Vshell_file_name = build_string (sh ? sh : "/bin/sh"); ++ Vshell_file_name = build_string (sh ? sh : "@TERMUX_PREFIX@/bin/sh"); + + Lisp_Object gamedir = Qnil; + if (PATH_GAME) diff --git a/x11-packages/emacs-x/src-fileio.c.patch b/x11-packages/emacs-x/src-fileio.c.patch new file mode 100644 index 000000000..499625b7c --- /dev/null +++ b/x11-packages/emacs-x/src-fileio.c.patch @@ -0,0 +1,20 @@ +--- ../fileio.c.orig 2020-07-11 20:22:17.937310671 +0200 ++++ ./src/fileio.c 2020-07-11 20:22:44.147310684 +0200 +@@ -2617,7 +2617,7 @@ + encoded_file = ENCODE_FILE (file); + encoded_newname = ENCODE_FILE (newname); + +- if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) ++ if (symlink (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) + return Qnil; + + if (errno == EEXIST) +@@ -2627,7 +2627,7 @@ + barf_or_query_if_file_exists (newname, true, "make it a new name", + FIXNUMP (ok_if_already_exists), false); + unlink (SSDATA (newname)); +- if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) ++ if (symlink (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) + return Qnil; + } + diff --git a/x11-packages/emacs-x/src-filelock.c.patch b/x11-packages/emacs-x/src-filelock.c.patch new file mode 100644 index 000000000..b27927cc0 --- /dev/null +++ b/x11-packages/emacs-x/src-filelock.c.patch @@ -0,0 +1,51 @@ +--- ../emacs-27/src/filelock.c 2019-11-28 09:41:28.000000000 +0100 ++++ ./src/filelock.c 2019-11-28 15:07:18.792543698 +0100 +@@ -63,11 +63,11 @@ + /* A file whose last-modified time is just after the most recent boot. + Define this to be NULL to disable checking for this file. */ + #ifndef BOOT_TIME_FILE +-#define BOOT_TIME_FILE "/var/run/random-seed" ++#define BOOT_TIME_FILE "@TERMUX_PREFIX@/var/run/random-seed" + #endif + + #if !defined WTMP_FILE && !defined WINDOWSNT +-#define WTMP_FILE "/var/log/wtmp" ++#define WTMP_FILE "@TERMUX_PREFIX@/var/log/wtmp" + #endif + + /* Normally use a symbolic link to represent a lock. +@@ -127,14 +127,14 @@ + static time_t boot_time; + static bool boot_time_initialized; + +-#ifdef BOOT_TIME ++#if defined (BOOT_TIME) && !defined(__ANDROID__) + static void get_boot_time_1 (const char *, bool); + #endif + + static time_t + get_boot_time (void) + { +-#if defined (BOOT_TIME) ++#if defined (BOOT_TIME) && !defined(__ANDROID__) + int counter; + #endif + +@@ -170,7 +170,7 @@ + } + } + +-#if defined (BOOT_TIME) ++#if defined (BOOT_TIME) && !defined(__ANDROID__) + /* The utmp routines maintain static state. Don't touch that state + if we are going to dump, since it might not survive dumping. */ + if (will_dump_p ()) +@@ -229,7 +229,7 @@ + #endif + } + +-#ifdef BOOT_TIME ++#if defined (BOOT_TIME) && !defined(__ANDROID__) + /* Try to get the boot time from wtmp file FILENAME. + This succeeds if that file contains a reboot record. +