gen-lists-of-programs.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #!/bin/sh
  2. # Generate lists of all coreutils programs, to be fed both to Autoconf
  3. # and Automake, and with further distinctions about how and when these
  4. # programs should be built. This is useful to avoid duplicating these
  5. # list definitions among several files ('configure.ac' and
  6. # 'src/local.mk' at least); such duplication had proved a source of
  7. # inconsistencies and bugs in the past.
  8. set -u
  9. set -e
  10. # These are the names of programs that are neither built nor installed
  11. # by default. This list is *not* intended for programs like 'who',
  12. # 'nice', 'chroot', etc., that are built only when certain requisite
  13. # system features are detected.
  14. # If you would like to install programs from this list anyway, say A and B,
  15. # use "--enable-install-program=A,B" when invoking configure.
  16. disabled_by_default_progs='
  17. arch
  18. coreutils
  19. hostname
  20. '
  21. # Programs that can be built only when certain requisite system
  22. # features are detected at configure time.
  23. build_if_possible_progs='
  24. chroot
  25. df
  26. hostid
  27. libstdbuf.so
  28. nice
  29. pinky
  30. stdbuf
  31. stty
  32. timeout
  33. uptime
  34. users
  35. who
  36. '
  37. # All the other programs, to be built by default, and that should
  38. # be buildable without problems on any target system.
  39. normal_progs='
  40. [
  41. b2sum
  42. base64
  43. base32
  44. basename
  45. cat
  46. chcon
  47. chgrp
  48. chmod
  49. chown
  50. cksum
  51. comm
  52. cp
  53. csplit
  54. cut
  55. date
  56. dd
  57. dir
  58. dircolors
  59. dirname
  60. du
  61. echo
  62. env
  63. expand
  64. expr
  65. factor
  66. false
  67. fmt
  68. fold
  69. ginstall
  70. groups
  71. head
  72. id
  73. join
  74. kill
  75. link
  76. ln
  77. logname
  78. ls
  79. md5sum
  80. mkdir
  81. mkfifo
  82. mknod
  83. mktemp
  84. mv
  85. nl
  86. nproc
  87. nohup
  88. numfmt
  89. od
  90. paste
  91. pathchk
  92. pr
  93. printenv
  94. printf
  95. ptx
  96. pwd
  97. readlink
  98. realpath
  99. rm
  100. rmdir
  101. runcon
  102. seq
  103. sha1sum
  104. sha224sum
  105. sha256sum
  106. sha384sum
  107. sha512sum
  108. shred
  109. shuf
  110. sleep
  111. sort
  112. split
  113. stat
  114. sum
  115. sync
  116. tac
  117. tail
  118. tee
  119. test
  120. touch
  121. tr
  122. true
  123. truncate
  124. tsort
  125. tty
  126. uname
  127. unexpand
  128. uniq
  129. unlink
  130. vdir
  131. wc
  132. whoami
  133. yes
  134. '
  135. me=`echo "$0" | sed 's,.*/,,'`
  136. msg="Automatically generated by $me. DO NOT EDIT BY HAND!"
  137. case $#,$1 in
  138. 1,--autoconf|1,--for-autoconf)
  139. echo "dnl $msg"
  140. for p in $normal_progs; do
  141. test x"$p" = x"[" && p='@<:@'
  142. echo "gl_ADD_PROG([optional_bin_progs], [$p])"
  143. done
  144. # Extra 'echo' to normalize whitespace.
  145. echo "no_install_progs_default='`echo $disabled_by_default_progs`'"
  146. sed 's/^ *//' <<END
  147. # Given the name of a variable containing a space-separated
  148. # list of install-by-default programs and the actual list of
  149. # do-not-install-by-default programs, modify the former variable
  150. # to reflect any "do-install" and "don't-install" requests.
  151. # That is, add any program specified via --enable-install-program,
  152. # and remove any program specified via --enable-no-install-program.
  153. # Note how the second argument below is a literal, with ","
  154. # separators. That is required due to the way the macro works,
  155. # and since the corresponding ./configure option argument is
  156. # comma-separated on input.
  157. gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [`\
  158. echo $disabled_by_default_progs \
  159. | sed 's/ /,/g'`])
  160. END
  161. ;;
  162. 1,--automake|1,--for-automake)
  163. echo "## $msg"
  164. progsdir=src
  165. echo no_install__progs =
  166. for p in $disabled_by_default_progs; do
  167. echo no_install__progs += $progsdir/$p
  168. done
  169. echo build_if_possible__progs =
  170. for p in $build_if_possible_progs; do
  171. echo build_if_possible__progs += $progsdir/$p
  172. done
  173. echo default__progs =
  174. for p in $normal_progs; do
  175. echo default__progs += $progsdir/$p
  176. done
  177. ;;
  178. 1,--list-progs)
  179. for p in $disabled_by_default_progs $build_if_possible_progs \
  180. $normal_progs; do
  181. echo $p
  182. done
  183. ;;
  184. *)
  185. echo "$0: invalid usage" >&2; exit 2
  186. ;;
  187. esac
  188. exit 0