emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 3be448f4290 2/5: Remove redundant second copy of gnulib


From: Po Lu
Subject: feature/android 3be448f4290 2/5: Remove redundant second copy of gnulib
Date: Sat, 4 Mar 2023 21:52:09 -0500 (EST)

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

    Remove redundant second copy of gnulib
    
    * .gitignore: Simplify cross/lib rule.
    * admin/merge-gnulib (avoided_flags): Stop copying to cross/lib.
    * configure.ac: Link gnulib source and header files to
    cross/lib.
    * cross/Makefile.in (LIB_SRCDIR): Make relative to builddir.
    (maintainer-clean): Merge with distclean.  Remove links created
    by configure.
---
 .gitignore         | 28 +---------------------------
 admin/merge-gnulib |  8 --------
 configure.ac       | 16 ++++++++++++++++
 cross/Makefile.in  | 27 ++++++++++-----------------
 4 files changed, 27 insertions(+), 52 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3950a46211b..8552d118552 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,33 +101,7 @@ src/lisp.mk
 src/verbose.mk
 
 # Stuff built during cross compilation
-cross/lib/alloca.h
-cross/lib/assert.h
-cross/lib/byteswap.h
-cross/lib/dirent.h
-cross/lib/errno.h
-cross/lib/execinfo.h
-cross/lib/fcntl.h
-cross/lib/getopt.h
-cross/lib/getopt-cdefs.h
-cross/lib/gmp.h
-cross/lib/ieee754.h
-cross/lib/inttypes.h
-cross/lib/libgnu.a
-cross/lib/limits.h
-cross/lib/malloc/*.gl.h
-cross/lib/signal.h
-cross/lib/std*.h
-!cross/lib/std*.in.h
-!cross/lib/stdio-impl.h
-!cross/lib/_Noreturn.h
-cross/lib/math.h
-cross/lib/string.h
-cross/lib/sys/
-cross/lib/time.h
-cross/lib/unistd.h
-cross/lib/config.h
-cross/lib/gnulib.mk
+cross/lib/*
 cross/src/*
 cross/lib-src/*
 cross/sys/*
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 60963669f1b..4e84e1a2c8d 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -139,11 +139,3 @@ cp -- "$gnulib_srcdir"/lib/af_alg.h \
    "$src"lib &&
 { test -z "$src" || cd "$src"; } &&
 ./autogen.sh
-
-# Finally, copy gnulib stuff in lib/ to xcompile/lib.
-rm -rf "$src"cross/lib
-cp -r "$src"lib "$src"cross
-
-# Remove unnecessary files.
-rm -f "$src"cross/lib/*.mk.in "$src"cross/lib/Makefile.in \
-   "$src"cross/lib/Makefile
diff --git a/configure.ac b/configure.ac
index 3a9d2614c00..e66551805ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7755,7 +7755,23 @@ if test "$XCONFIGURE" != "android"; then
   dnl Make cross/lib, which various Makefiles in cross expect to
   dnl always exist.
   AS_MKDIR_P([cross/lib])
+  AS_MKDIR_P([cross/lib/malloc])
+  AS_MKDIR_P([cross/lib/sys])
   AS_MKDIR_P([cross/lib-src])
+
+  dnl Link gnulib files to cross/lib as well.
+  dnl af_alg.h and lib/save-cwd.h are copied manually from
+  dnl gnulib, and as such aren't specified in gl_FILE_LIST.
+  emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h'
+  dnl These files are specific to Emacs.
+  emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \
+                 lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \
+                lib/min-max.h"
+  for file in $emacs_files; do
+    AS_IF([expr "X${file}J" : "Xlib/.*[[ch]]J" >/dev/null],
+      [AS_IF([test -f $file],
+        [AC_CONFIG_LINKS([cross/$file:$file])])])
+  done
 fi
 
 # Make java/Makefile
diff --git a/cross/Makefile.in b/cross/Makefile.in
index b30aade759f..b8955a70ebd 100644
--- a/cross/Makefile.in
+++ b/cross/Makefile.in
@@ -33,9 +33,10 @@ top_builddir = @top_builddir@
 # $(top_builddir)/lib-src/Makefile.android are copied to their usual
 # locations in this directory.
 
-# This is possibly the ugliest Makefile ever written!
+# N.B. that LIB_SRCDIR is actually relative to builddir, because that
+# is where the gnulib files get linked.
 
-LIB_SRCDIR = $(realpath $(srcdir)/lib)
+LIB_SRCDIR = $(realpath $(builddir)/lib)
 LIB_TOP_SRCDIR = $(realpath $(top_srcdir))
 
 SRC_SRCDIR = $(realpath $(top_srcdir)/src)
@@ -49,7 +50,7 @@ LIB_SRC_TOP_SRCDIR = $(realpath $(top_src))
 LIBSRC_BINARIES = lib-src/etags lib-src/ctags lib-src/emacsclient \
                  lib-src/ebrowse lib-src/hexl lib-src/movemail
 
-CLEAN_SUBDIRS=src lib-src
+CLEAN_SUBDIRS=src lib-src lib
 
 .PHONY: all
 all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES)
@@ -185,23 +186,15 @@ $(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ 
lib/libgnu.a \
 clean:
        for dir in $(CLEAN_SUBDIRS); do \
          find $$dir -type f -delete;   \
-       done;                           \
-       if [ -e lib/Makefile ]; then    \
-         make -C lib clean;            \
-       fi
+       done
        rm -rf lib/config.h lib-src/config.h
 # ndk-build won't have been generated in a non-Android build.
        -make -C ndk-build clean
 
-distclean bootstrap-clean: clean
-       if [ -e lib/Makefile ]; then            \
-         make -C lib distclean;                \
-       fi
-# Just in case.
+maintainer-clean distclean bootstrap-clean: clean
+# Remove links created by configure.
+       for dir in $(CLEAN_SUBDIRS); do \
+         find $$dir -type l -delete;   \
+       done
        rm -rf lib/Makefile lib/gnulib.mk ndk-build/Makefile
        rm -rf ndk-build/ndk-build.mk Makefile
-
-maintainer-clean: distclean bootstrap-clean
-       if [ -e lib/Makefile ]; then            \
-         make -C lib maintainer-clean;         \
-       fi



reply via email to

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