From 4f2e62ba9fd482375fdc085de71a5c947741d140 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 1 Sep 2012 01:46:39 +0200 Subject: build: refactor how lists of coreutils programs are defined This is in preparation of future changes. Still, this patch leaves the build system in a better shape; true, with more indirections, but also with less convoluted and brittle hacks. Unfortunately, this commit also makes some rebuild rules incomplete; that will son be fixed by follow-up patches. * build-aux/gen-lists-of-programs.sh: New, generates autoconf and automake input fragments that define "lists" of all coreutils programs, with further distinctions about how and when these programs should be built (by default; if the system is capable enough; only if the user asks for them explicitly). This is useful to avoid duplicating the definitions of these lists among several files (at least 'configure.ac' 'src/Makefile.am'); such duplication had proved a source of inconsistencies and bugs in the past. And the pre-existing way to avoid such duplication, as implemented in 'configure.ac' before this patch, was overly complex and brittle. * Makefile.am (EXTRA_DIST): Distribute the new script. * bootstrap.conf (bootstrap_post_import_hook): Run the new script to generate 'm4/cu-progs.m4' and 'src/cu-progs.mk'. * .gitignore: Ignore those files. * configure.ac: Include 'm4/cu-progs.m4', and decidedly simplify most of the program lists definition and processing accordingly. * src/Makefile.am: Similarly include 'src/cu-progs.mk', containing definition of variables $(default__progs), $(no_install__progs) and $(build_if_possible__progs). Accordingly ... (no_install__progs, build_if_possible__progs): ... remove. (EXTRA_DIST): Adjust definition. Adjust a comment. --- build-aux/gen-lists-of-programs.sh | 185 +++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100755 build-aux/gen-lists-of-programs.sh (limited to 'build-aux') diff --git a/build-aux/gen-lists-of-programs.sh b/build-aux/gen-lists-of-programs.sh new file mode 100755 index 000000000..2db0745bc --- /dev/null +++ b/build-aux/gen-lists-of-programs.sh @@ -0,0 +1,185 @@ +#!/bin/sh +# Generate lists of all coreutils programs, to be fed both to Autoconf +# and Automake, and with further distinctions about how and when these +# programs should be built. This is useful to avoid duplicating the +# definitions of these list among several files ('configure.ac' and +# 'src/Makefile.am' at least); such duplication had proved a source of +# inconsistencies and bugs in the past. + +set -u +set -e + +# These are the names of programs that are neither built nor installed +# by default. This list is *not* intended for programs like 'who', +# 'nice', 'chroot', etc., that are built only when certain requisite +# system features are detected. +# If you would like to install programs from this list anyway, say A and B, +# use "--enable-install-program=A,B" when invoking configure. +disabled_by_default_progs=' + arch + hostname +' + +# Programs that can be built only when certain requisite system +# features are detected. These prerequisites will be looked for +# at configure runtime. +build_if_possible_progs=' + chroot + df + hostid + libstdbuf.so + nice + pinky + stdbuf + stty + uptime + users + who +' + +# All the other programs, to be built by default, and that should +# be buildable without problems on any target system. +normal_progs=' + [ + base64 + basename + cat + chcon + chgrp + chmod + chown + cksum + comm + cp + csplit + cut + date + dd + dir + dircolors + dirname + du + echo + env + expand + expr + factor + false + fmt + fold + ginstall + groups + head + id + join + kill + link + ln + logname + ls + md5sum + mkdir + mkfifo + mknod + mktemp + mv + nl + nproc + nohup + od + paste + pathchk + pr + printenv + printf + ptx + pwd + readlink + realpath + rm + rmdir + runcon + seq + sha1sum + sha224sum + sha256sum + sha384sum + sha512sum + shred + shuf + sleep + sort + split + stat + sum + sync + tac + tail + tee + test + timeout + touch + tr + true + truncate + tsort + tty + uname + unexpand + uniq + unlink + vdir + wc + whoami + yes +' + +me=`echo "$0" | sed 's,.*/,,'` +msg="Automatically generated by $me. DO NOT EDIT BY HAND!" + +case $#,$1 in + 1,--autoconf|1,--for-autoconf) + echo "dnl $msg" + for p in $normal_progs; do + test x"$p" = x"[" && p='@<:@' + echo "gl_ADD_PROG([optional_bin_progs], [$p])" + done + # Extra 'echo' to normalize whitespace. + echo "no_install_progs_default='`echo $disabled_by_default_progs`'" + sed 's/^ *//' <&2; exit 2 + ;; +esac + +exit 0 -- cgit v1.2.3-70-g09d2