diff options
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/config.guess | 49 | ||||
-rwxr-xr-x | build-aux/config.sub | 70 | ||||
-rw-r--r-- | build-aux/git-hooks/commit-msg-files.awk | 128 | ||||
-rwxr-xr-x | build-aux/git-hooks/post-commit | 47 | ||||
-rwxr-xr-x | build-aux/git-hooks/pre-commit | 11 | ||||
-rwxr-xr-x | build-aux/git-hooks/pre-push | 88 | ||||
-rwxr-xr-x | build-aux/git-hooks/prepare-commit-msg | 4 | ||||
-rwxr-xr-x | build-aux/gitlog-to-changelog | 6 | ||||
-rwxr-xr-x | build-aux/make-info-dir | 2 | ||||
-rwxr-xr-x | build-aux/makecounter.sh | 43 | ||||
-rw-r--r-- | build-aux/ndk-build-helper-1.mk | 112 | ||||
-rw-r--r-- | build-aux/ndk-build-helper-2.mk | 105 | ||||
-rw-r--r-- | build-aux/ndk-build-helper-3.mk | 28 | ||||
-rw-r--r-- | build-aux/ndk-build-helper-4.mk | 39 | ||||
-rw-r--r-- | build-aux/ndk-build-helper.mk | 81 | ||||
-rw-r--r-- | build-aux/ndk-module-extract.awk | 88 | ||||
-rwxr-xr-x | build-aux/update-copyright | 24 |
17 files changed, 860 insertions, 65 deletions
diff --git a/build-aux/config.guess b/build-aux/config.guess index 33a163c1170..405d53d9785 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-09-17' +timestamp='2023-07-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of the system \`$me' is run on. +Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit @@ -60,13 +60,13 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2022 Free Software Foundation, Inc. +Copyright 1992-2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" -Try \`$me --help' for more information." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -102,8 +102,8 @@ GUESS= # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. @@ -459,7 +459,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in UNAME_RELEASE=`uname -v` ;; esac - # Japanese Language versions have a version number like `4.1.3-JL'. + # Japanese Language versions have a version number like '4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; @@ -976,7 +976,27 @@ EOF GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be @@ -1042,6 +1062,15 @@ EOF k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; @@ -1197,7 +1226,7 @@ EOF GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility + # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; @@ -1338,7 +1367,7 @@ EOF GUESS=ns32k-sni-sysv fi ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> GUESS=i586-unisys-sysv4 ;; diff --git a/build-aux/config.sub b/build-aux/config.sub index 529a77a9c7c..183b3cc627b 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-09-17' +timestamp='2023-07-31' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -76,13 +76,13 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright 1992-2022 Free Software Foundation, Inc. +Copyright 1992-2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" -Try \`$me --help' for more information." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -130,7 +130,7 @@ IFS=$saved_IFS # Separate into logical components for further validation case $1 in *-*-*-*-*) - echo Invalid configuration \`"$1"\': more than four components >&2 + echo "Invalid configuration '$1': more than four components" >&2 exit 1 ;; *-*-*-*) @@ -145,7 +145,8 @@ case $1 in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; @@ -943,7 +944,7 @@ $basic_machine EOF IFS=$saved_IFS ;; - # We use `pc' rather than `unknown' + # We use 'pc' rather than 'unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) @@ -1075,7 +1076,7 @@ case $cpu-$vendor in pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) cpu=i586 ;; - pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) + pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) cpu=i686 ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) @@ -1205,6 +1206,7 @@ case $cpu-$vendor in | i370 | i*86 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ + | kvx \ | le32 | le64 \ | lm32 \ | loongarch32 | loongarch64 \ @@ -1213,31 +1215,7 @@ case $cpu-$vendor in | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ | m88110 | m88k | maxq | mb | mcore | mep | metag \ | microblaze | microblazeel \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64eb | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r3 | mipsisa32r3el \ - | mipsisa32r5 | mipsisa32r5el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r3 | mipsisa64r3el \ - | mipsisa64r5 | mipsisa64r5el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ + | mips* \ | mmix \ | mn10200 | mn10300 \ | moxie \ @@ -1285,7 +1263,7 @@ case $cpu-$vendor in ;; *) - echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 exit 1 ;; esac @@ -1732,7 +1710,7 @@ case $os in | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | hiux* | abug | nacl* | netware* | windows* \ - | os9* | macos* | osx* | ios* \ + | os9* | macos* | osx* | ios* | tvos* | watchos* \ | mpw* | magic* | mmixware* | mon960* | lnews* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ @@ -1758,7 +1736,7 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* ) + | fiwix* | mlibc* | cos* | mbr* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) @@ -1766,11 +1744,11 @@ case $os in ;; none) ;; - kernel* ) + kernel* | msvc* ) # Restricted further below ;; *) - echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac @@ -1785,18 +1763,24 @@ case $kernel-$os in ;; managarm-mlibc* | managarm-kernel* ) ;; + windows*-gnu* | windows*-msvc*) + ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. - echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel* ) - echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel* ) - echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc* ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) @@ -1809,11 +1793,15 @@ case $kernel-$os in ;; *-eabi* | *-gnueabi*) ;; + none-coff* | none-elf*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an output format "OS" + ;; -*) # Blank kernel with real OS is always fine. ;; *-*) - echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac diff --git a/build-aux/git-hooks/commit-msg-files.awk b/build-aux/git-hooks/commit-msg-files.awk new file mode 100644 index 00000000000..5c9b70a5de5 --- /dev/null +++ b/build-aux/git-hooks/commit-msg-files.awk @@ -0,0 +1,128 @@ +# Check the file list of GNU Emacs change log entries for each commit SHA. + +# Copyright 2023 Free Software Foundation, Inc. + +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +### Commentary: + +# This script accepts a list of (unabbreviated) Git commit SHAs, and +# will then iterate over them to check that any files mentioned in the +# commit message are actually present in the commit's diff. If not, +# it will print out the incorrect file names and return 1. + +# You can also pass "-v reason=pre-push", which will add more-verbose +# output, indicating the abbreviated commit SHA and first line of the +# commit message for any improper commits. + +### Code: + +function get_commit_changes(commit_sha, changes, cmd, i, j, len, \ + bits, filename) { + # Collect all the files touched in the specified commit. + cmd = ("git show --name-status --first-parent --format= " commit_sha) + while ((cmd | getline) > 0) { + for (i = 2; i <= NF; i++) { + len = split($i, bits, "/") + for (j = 1; j <= len; j++) { + if (j == 1) + filename = bits[j] + else + filename = filename "/" bits[j] + changes[filename] = 1 + } + } + } + close(cmd) +} + +function check_commit_msg_files(commit_sha, verbose, changes, good, \ + cmd, msg, filenames_str, filenames, i) { + get_commit_changes(commit_sha, changes) + good = 1 + + cmd = ("git log -1 --format=%B " commit_sha) + while ((cmd | getline) > 0) { + if (verbose && ! msg) + msg = $0 + + # Find file entries in the commit message. We look at any line + # starting with "*" (possibly prefixed by "; ") followed by a ":", + # possibly on a different line. If we encounter a blank line + # without seeing a ":", then we don't treat that as a file entry. + + # Accumulate the contents of a (possible) file entry. + if (/^[ \t]*$/) + filenames_str = "" + else if (/^(; )?\*[ \t]+[[:alnum:]]/) + filenames_str = $0 + else if (filenames_str) + filenames_str = (filenames_str $0) + + # We have a file entry; analyze it. + if (filenames_str && /:/) { + # Delete the leading "*" and any trailing information. + sub(/^(; )?\*[ \t]+/, "", filenames_str) + sub(/[ \t]*[[(<:].*$/, "", filenames_str) + + # There might be multiple files listed in this entry, separated + # by spaces (and possibly a comma). Iterate over each of them. + split(filenames_str, filenames, ",[ \t]+") + for (i in filenames) { + # Remove trailing slashes from any directory entries. + sub(/\/$/, "", filenames[i]) + + if (length(filenames[i]) && ! (filenames[i] in changes)) { + if (good) { + # Print a header describing the error. + if (verbose) + printf("In commit %s \"%s\"...\n", substr(commit_sha, 1, 10), msg) + printf("Files listed in commit message, but not in diff:\n") + } + printf(" %s\n", filenames[i]) + good = 0 + } + } + + filenames_str = "" + } + } + close(cmd) + + return good +} + +BEGIN { + if (reason == "pre-push") + verbose = 1 +} + +/^[a-z0-9]{40}$/ { + if (! check_commit_msg_files($0, verbose)) { + status = 1 + } +} + +END { + if (status != 0) { + if (reason == "pre-push") + error_msg = "Push aborted" + else + error_msg = "Bad commit message" + printf("%s; please see the file 'CONTRIBUTE'\n", error_msg) + } + exit status +} diff --git a/build-aux/git-hooks/post-commit b/build-aux/git-hooks/post-commit new file mode 100755 index 00000000000..e02fee48db4 --- /dev/null +++ b/build-aux/git-hooks/post-commit @@ -0,0 +1,47 @@ +#!/bin/sh +# Check the file list of GNU Emacs change log entries after committing. + +# Copyright 2023 Free Software Foundation, Inc. + +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +### Commentary: + +# This hook runs after a commit is finalized and checks that the files +# mentioned in the commit message match the diff. We perform this in +# the post-commit phase so that we can be sure we properly detect all +# the files in the diff (this is difficult during the commit-msg hook, +# since there's no cross-platform way to detect when a commit is being +# amended). + +# However, since this is a post-commit hook, it's too late to error +# out and abort the commit: it's already done! As a result, this hook +# is purely advisory, and instead we error out when trying to push +# (see "pre-push" in this directory). + +### Code: + +HOOKS_DIR=`dirname "$0"` + +# Prefer gawk if available, as it handles NUL bytes properly. +if type gawk >/dev/null 2>&1; then + awk="gawk" +else + awk="awk" +fi + +git rev-parse HEAD | $awk -v reason=post-commit \ + -f "$HOOKS_DIR"/commit-msg-files.awk diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit index c07188bffd3..a86bbf642a5 100755 --- a/build-aux/git-hooks/pre-commit +++ b/build-aux/git-hooks/pre-commit @@ -21,6 +21,14 @@ LC_ALL=C export LC_ALL +# If this is a system where /bin/sh isn't sufficient to +# run git-sh-setup, use a working shell as a recourse. +if test -x "/usr/xpg4/bin/sh" && test -z "$POSIX_SHELL"; then + POSIX_SHELL=1 + export POSIX_SHELL + exec "/usr/xpg4/bin/sh" `dirname $0`/pre-commit +fi + exec >&2 . git-sh-setup @@ -52,6 +60,9 @@ while IFS= read -r new_name; do -* | */-*) echo "$new_name: File name component begins with '-'." exit 1;; + ChangeLog.android) + # This file is explicitly ok. + ;; ChangeLog | */ChangeLog) echo "$new_name: Please use git commit messages, not ChangeLog files." exit 1;; diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push new file mode 100755 index 00000000000..a342814c1e3 --- /dev/null +++ b/build-aux/git-hooks/pre-push @@ -0,0 +1,88 @@ +#!/bin/sh +# Check the file list of GNU Emacs change log entries before pushing. + +# Copyright 2023 Free Software Foundation, Inc. + +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +### Commentary: + +# This hook runs before pushing a series of commits and checks that +# the files mentioned in each commit message match the diffs. This +# helps ensure that the resulting change logs are correct, which +# should prevent errors when generating etc/AUTHORS. + +# These checks also happen in the "post-commit" hook (which see), but +# that hook can't abort a commit; it just advises the committer to fix +# the commit so that this hook runs without errors. + +### Code: + +HOOKS_DIR=`dirname "$0"` + +# Prefer gawk if available, as it handles NUL bytes properly. +if type gawk >/dev/null 2>&1; then + awk="gawk" +else + awk="awk" +fi + +# Standard input receives lines of the form: +# <local ref> SP <local sha> SP <remote ref> SP <remote sha> LF +$awk -v origin_name="$1" ' + # If the local SHA is all zeroes, ignore it. + $2 ~ /^0{40}$/ { + next + } + + # Check any lines with a valid local SHA and whose remote ref is + # master or an emacs-NN release branch. (We want to avoid checking + # feature or scratch branches here.) + $2 ~ /^[a-z0-9]{40}$/ && $3 ~ /^refs\/heads\/(master|emacs-[0-9]+)$/ { + newref = $2 + # If the remote SHA is all zeroes, this is a new object to be + # pushed (likely a branch)... + if ($4 ~ /^0{40}$/) { + back = 0 + # ... Go backwards until we find a SHA on an origin branch. + # Stop trying after 1000 commits, just in case... + for (back = 0; back < 1000; back++) { + cmd = ("git branch -r -l '\''" origin_name "/*'\''" \ + " --contains " newref "~" back) + rv = (cmd | getline) + close(cmd) + if (rv > 0) + break; + } + + cmd = ("git rev-parse " newref "~" back) + cmd | getline oldref + if (!(oldref ~ /^[a-z0-9]{40}$/)) { + # The SHA is misformatted! Skip this line. + next + } + close(cmd) + } else if ($4 ~ /^[a-z0-9]{40}$/) { + oldref = $4 + } else { + # The SHA is misformatted! Skip this line. + next + } + + # Print every SHA after oldref, up to (and including) newref. + system("git rev-list --first-parent --reverse " oldref ".." newref) + } +' | $awk -v reason=pre-push -f "$HOOKS_DIR"/commit-msg-files.awk diff --git a/build-aux/git-hooks/prepare-commit-msg b/build-aux/git-hooks/prepare-commit-msg index 082c9444365..0367858ea7e 100755 --- a/build-aux/git-hooks/prepare-commit-msg +++ b/build-aux/git-hooks/prepare-commit-msg @@ -25,6 +25,10 @@ SHA1=$3 # Prefer gawk if available, as it handles NUL bytes properly. if type gawk >/dev/null 2>&1; then awk="gawk" +# Next use /usr/xpg4/bin/awk if available, since the script +# doesn't support Unix awk. +elif test -x /usr/xpg4/bin/awk; then + awk="/usr/xpg4/bin/awk" else awk="awk" fi diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 0cc2c04a4c4..16a9405a7cb 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -20,7 +20,7 @@ # # Written by Jim Meyering -# This is a prologue that allows to run a perl script as an executable +# This is a prologue that allows running a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start @@ -35,7 +35,7 @@ eval 'exec perl -wSx "$0" "$@"' if 0; -my $VERSION = '2022-01-27 18:49'; # UTC +my $VERSION = '2023-06-24 21:59'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -355,7 +355,7 @@ sub git_dir_option($) . "(expected date/author/email):\n$author_line\n"; # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog - # `(tiny change)' annotation. + # '(tiny change)' annotation. my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line) ? ' (tiny change)' : ''); diff --git a/build-aux/make-info-dir b/build-aux/make-info-dir index e5f4972902f..703abc7bd0a 100755 --- a/build-aux/make-info-dir +++ b/build-aux/make-info-dir @@ -38,7 +38,7 @@ shift exec "${AWK-awk}" ' function detexinfo() { - gsub(/@value{emacsname}/, "Emacs") + gsub(/@value\{emacsname\}/, "Emacs") gsub(/@[^{]*\{/, "") gsub(/}/, "") } diff --git a/build-aux/makecounter.sh b/build-aux/makecounter.sh new file mode 100755 index 00000000000..3bebd288031 --- /dev/null +++ b/build-aux/makecounter.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# Generate or update a C file containing an increasing counter +# variable. +# +# Copyright (C) 2023 Free Software Foundation, Inc. +# +# This file is part of GNU Emacs. GNU Emacs is free software: you can +# redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation, either +# version 3 of the License, or (at your option) any later version. +# +# GNU Emacs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +set -e + +curcount= +if test -f "$1"; then + curcount=`cat "$1" | grep = | cut -d= -f2 \ + | sed -e 's/;//' -e 's/ //'` +fi + +curcount=`expr 1 + $curcount 2>/dev/null || echo 0` + +cat > $1 <<EOF +/* Generated automatically by makecounter.sh. Do not edit! */ + +#include <config.h> + +#ifdef HAVE_ANDROID +#define EXPORT __attribute__ ((visibility ("default"))) +#endif /* HAVE_ANDROID */ + +#ifdef EXPORT +EXPORT +#endif /* EXPORT */ +int emacs_shortlisp_counter = $curcount; +EOF diff --git a/build-aux/ndk-build-helper-1.mk b/build-aux/ndk-build-helper-1.mk new file mode 100644 index 00000000000..2cde5146301 --- /dev/null +++ b/build-aux/ndk-build-helper-1.mk @@ -0,0 +1,112 @@ +# ndk-build-helper-1.mk -- Helper for ndk-build.m4. +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +# Print out information now defined. Important details include: +# - list of source files to compile. +# - module export include directories. +# - module export CFLAGS. +# - module export LDFLAGS. +# - module name. + +build_kind = shared +NDK_SO_NAMES = +NDK_A_NAMES = + +# Record this module's dependencies. This information is used later +# 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) +NDK_CXX_FLAG_$(LOCAL_MODULE) := + +$(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) +NDK_SO_NAMES = $(LOCAL_MODULE)_emacs.so +else +NDK_SO_NAMES = lib$(LOCAL_MODULE)_emacs.so +endif + +define add-so-name-1 +# Now recurse over this module's dependencies. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)),$$(eval $$(call add-so-name,$$(module)))) +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARIES)),$$(eval $$(call add-so-name-1,$$(module)))) +endef + +define add-so-name +ifeq ($(findstring lib,$(1)),lib) +NDK_SO_NAME = $(1)_emacs.so +else +NDK_SO_NAME = lib$(1)_emacs.so +endif + +ifeq ($$(findstring $$(NDK_SO_NAME),$$(NDK_SO_NAMES)),) +NDK_SO_NAMES := $$(NDK_SO_NAMES) $$(NDK_SO_NAME) + +# Now recurse over this module's dependencies. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)),$$(eval $$(call add-so-name,$$(module)))) + +# Recurse over static library dependencies of this shared library. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARIES) $$(NDK_$(1)_WHOLE_LIBRARIES)),$$(eval $$(call add-so-name-1,$$(module)))) +endif + +ifneq ($$(findstring stdc++,$$(NDK_$(1)_SHARED_LIBRARIES)),) +NDK_CXX_FLAG_$(LOCAL_MODULE) := yes +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)))) + +# Recurse over shared library dependencies of this static library. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)),$$(eval $$(call add-so-name,$$(module)))) + +# Recurse over static or shared library dependencies of this static +# library. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARIES)),$$(eval $$(call add-so-name-1,$$(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 libdl dl stdc++ libstdc++ log liblog android libandroid + +$(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_STATIC_LIBRARIES)),$(eval $(call add-includes,$(module)))) + +ifneq ($(findstring stdc++,$(LOCAL_SHARED_LIBRARIES)),) +NDK_CXX_FLAG_$(LOCAL_MODULE) := yes +endif + +$(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 $(NDK_CXX_FLAG_$(LOCAL_MODULE))) +$(info End) diff --git a/build-aux/ndk-build-helper-2.mk b/build-aux/ndk-build-helper-2.mk new file mode 100644 index 00000000000..186f3aec333 --- /dev/null +++ b/build-aux/ndk-build-helper-2.mk @@ -0,0 +1,105 @@ +# ndk-build-helper-2.mk -- Helper for ndk-build.m4. +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +# Say a static library is being built +build_kind = static +NDK_SO_NAMES = +NDK_A_NAMES = + +# Record this module's dependencies. This information is used later +# 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) +NDK_CXX_FLAG_$(LOCAL_MODULE) := + +$(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) +NDK_A_NAMES = $(LOCAL_MODULE).a +else +NDK_A_NAMES = lib$(LOCAL_MODULE).a +endif + +define add-a-name +ifeq ($(findstring lib,$(1)),lib) +NDK_A_NAME = $(1).a +else +NDK_A_NAME = lib$(1).a +endif + +ifeq ($$(findstring $$(NDK_A_NAME),$$(NDK_A_NAMES)),) +NDK_A_NAMES := $$(NDK_A_NAMES) $$(NDK_A_NAME) + +# Now recurse over this module's dependencies. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARIES)),$$(eval $$(call add-a-name,$$(module)))) +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)),$$(eval $$(call add-so-name,$$(module)))) +endif + +ifneq ($$(findstring stdc++,$$(NDK_$(1)_SHARED_LIBRARIES)),) +NDK_CXX_FLAG_$(LOCAL_MODULE) := yes +endif +endef + +define add-so-name +ifeq ($(findstring lib,$(1)),lib) +NDK_SO_NAME = $(1)_emacs.so +else +NDK_SO_NAME = lib$(1)_emacs.so +endif + +ifeq ($$(NDK_SO_NAMES:$$(NDK_SO_NAME)=),$$(NDK_SO_NAMES)) +NDK_SO_NAMES := $$(NDK_SO_NAMES) $$(NDK_SO_NAME) + +# Now recurse over this module's dependencies. +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_STATIC_LIBRARIES)),$$(eval $$(call add-a-name,$$(module)))) +$$(foreach module,$$(filter-out $$(SYSTEM_LIBRARIES), $$(NDK_$(1)_SHARED_LIBRARIES)),$$(eval $$(call add-so-name,$$(module)))) +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 libc c libdl dl libstdc++ stdc++ log liblog android libandroid + +$(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)))) + +ifneq ($(findstring stdc++,$(LOCAL_SHARED_LIBRARIES)),) +NDK_CXX_FLAG_$(LOCAL_MODULE) := yes +endif + +$(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) $(NDK_SO_NAMES)) +$(info $(NDK_CXX_FLAG_$(LOCAL_MODULE))) +$(info End) diff --git a/build-aux/ndk-build-helper-3.mk b/build-aux/ndk-build-helper-3.mk new file mode 100644 index 00000000000..4d0358d4f77 --- /dev/null +++ b/build-aux/ndk-build-helper-3.mk @@ -0,0 +1,28 @@ +# ndk-build-helper-3.mk -- Helper for ndk-build.m4. +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +# Say a static library is being built +build_kind = executable + +$(info Building $(build_kind)) +$(info $(LOCAL_MODULE)) +$(info $(addprefix $(ANDROID_MODULE_DIRECTORY),$(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)) +$(info $(LOCAL_EXPORT_LDFLAGS)) +$(info End) diff --git a/build-aux/ndk-build-helper-4.mk b/build-aux/ndk-build-helper-4.mk new file mode 100644 index 00000000000..a41679c53af --- /dev/null +++ b/build-aux/ndk-build-helper-4.mk @@ -0,0 +1,39 @@ +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +undefine LOCAL_MODULE +undefine LOCAL_MODULE_FILENAME +undefine LOCAL_SRC_FILES +undefine LOCAL_CPP_EXTENSION +undefine LOCAL_CPP_FEATURES +undefine LOCAL_C_INCLUDES +undefine LOCAL_CFLAGS +undefine LOCAL_CPPFLAGS +undefine LOCAL_STATIC_LIBRARIES +undefine LOCAL_SHARED_LIBRARIES +undefine LOCAL_WHOLE_STATIC_LIBRARIES +undefine LOCAL_LDLIBS +undefine LOCAL_LDFLAGS +undefine LOCAL_ALLOW_UNDEFINED_SYMBOLS +undefine LOCAL_ARM_MODE +undefine LOCAL_ARM_NEON +undefine LOCAL_DISABLE_FORMAT_STRING_CHECKS +undefine LOCAL_EXPORT_CFLAGS +undefine LOCAL_EXPORT_CPPFLAGS +undefine LOCAL_EXPORT_C_INCLUDES +undefine LOCAL_EXPORT_C_INCLUDE_DIRS +undefine LOCAL_EXPORT_LDFLAGS +undefine LOCAL_EXPORT_LDLIBS diff --git a/build-aux/ndk-build-helper.mk b/build-aux/ndk-build-helper.mk new file mode 100644 index 00000000000..05f0af76411 --- /dev/null +++ b/build-aux/ndk-build-helper.mk @@ -0,0 +1,81 @@ +# ndk-build-helper.mk -- Helper for ndk-build.m4. +# Copyright (C) 2023 Free Software Foundation, Inc. +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +# This Makefile sets up enough to parse an Android-style Android.mk +# file and return useful information about its contents. + +# See the text under ``NDK BUILD SYSTEM IMPLEMENTATION'' in +# cross/ndk-build/README for more details. + +# TARGET_ARCH_ABI is the ABI that is being built for. +TARGET_ARCH_ABI := $(EMACS_ABI) + +# TARGET_ARCH is the architecture that is being built for. +TARGET_ARCH := $(NDK_BUILD_ARCH) + +# 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)) + +# 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) + +# 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 = + +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. + +BUILD_SHARED_LIBRARY=$(BUILD_AUXDIR)ndk-build-helper-1.mk +BUILD_STATIC_LIBRARY=$(BUILD_AUXDIR)ndk-build-helper-2.mk +BUILD_EXECUTABLE=$(BUILD_AUXDIR)ndk-build-helper-3.mk +CLEAR_VARS=$(BUILD_AUXDIR)ndk-build-helper-4.mk + +# Now include Android.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 new file mode 100644 index 00000000000..6ff30973d67 --- /dev/null +++ b/build-aux/ndk-module-extract.awk @@ -0,0 +1,88 @@ +/^Building.+$/ { + kind = $2 +} + +/^Start Imports$/ { + imports = 1 +} + +// { + if (imports && ++imports > 2) + { + if (!match ($0, /^End Imports$/)) + makefile_imports = makefile_imports " " $0 + } + else if (!match ($0, /^End$/) && !match ($0, /^Building.+$/)) + { + if (kind) + { + if (target_found) + cxx_deps = $0 + else if (ldflags_found) + { + target = $0 + target_found = 1 + } + else if (cflags_found) + { + ldflags = $0 + ldflags_found = 1 + } + else if (includes_found) + { + cflags = $0 + cflags_found = 1 + } + else if (src_found) + { + includes = $0 + includes_found = 1 + } + else if (name_found) + { + src = $0 + src_found = 1; + } + else + { + name = $0 + name_found = 1 + } + } + } +} + +/^End$/ { + if (name == MODULE && (kind == "shared" || kind == "static")) + { + printf "module_name=%s\n", name + printf "module_kind=%s\n", kind + printf "module_src=\"%s\"\n", src + printf "module_includes=\"%s\"\n", includes + 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 = "" + name = "" + kind = "" + includes = "" + cflags = "" + ldflags = "" + name_found = "" + src_found = "" + 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 = "" +} diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 6cf50d14e53..6d56e48fdb1 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -98,7 +98,8 @@ # 6. Blank lines, even if preceded by the prefix, do not appear # within the FSF copyright statement. # 7. Each copyright year is 2 or 4 digits, and years are separated by -# commas, "-", or "--". Whitespace may appear after commas. +# commas, "-", "--", or "\(en" (for troff). Whitespace may appear +# after commas. # # Environment variables: # @@ -122,7 +123,7 @@ # 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other # than "Free Software Foundation, Inc.". -# This is a prologue that allows to run a perl script as an executable +# This is a prologue that allows running a perl script as an executable # on systems that are compliant to a POSIX version before POSIX:2017. # On such systems, the usual invocation of an executable through execlp() # or execvp() fails with ENOEXEC if it is a script that does not start @@ -137,7 +138,7 @@ eval 'exec perl -wSx -0777 -pi "$0" "$@"' if 0; -my $VERSION = '2020-04-04.15:07'; # UTC +my $VERSION = '2023-06-18.01:14'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -148,6 +149,7 @@ use warnings; my $copyright_re = 'Copyright'; my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©|©)'; +my $ndash_re = '(?:--?|\\\\\(en)'; my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; $holder ||= 'Free Software Foundation, Inc.'; my $prefix_max = 5; @@ -192,7 +194,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g) $holder_re =~ s/\s/$ws_re/g; my $stmt_remainder_re = "(?:$ws_re$circle_c_re)?" - . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*" + . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|$ndash_re))*" . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re"; if (/\G$stmt_remainder_re/) { @@ -215,7 +217,7 @@ if (defined $stmt_re) if ($final_year != $this_year) { # Update the year. - $stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/; + $stmt =~ s/(^|[^\d])$final_year_orig\b/$1$final_year, $this_year/; } if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'}) { @@ -231,17 +233,19 @@ if (defined $stmt_re) # Make the use of intervals consistent. if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) { - $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg; + $stmt =~ s/(\d{4})$ndash_re(\d{4})/join(', ', $1..$2)/eg; } else { - my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-"; + my $ndash = ($ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" + : $ARGV =~ /\.(\d[a-z]*|man)$/ ? "\\(en" + : "-"); $stmt =~ s/ (\d{4}) (?: - (,\ |--?) + (,\ |$ndash_re) ((??{ if ($2 ne ', ') { '\d{4}'; } elsif (!$3) { $1 + 1; } @@ -252,7 +256,7 @@ if (defined $stmt_re) # When it's 2, emit a single range encompassing all year numbers. $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 - and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/; + and $stmt =~ s/(^|[^\d])(\d{4})\b.*(?:[^\d])(\d{4})\b/$1$2$ndash$3/; } # Format within margin. @@ -280,7 +284,7 @@ if (defined $stmt_re) } # Replace the old copyright statement. - s/$stmt_re/$stmt_wrapped/; + s/$stmt_re/$stmt_wrapped/g; } } else |