Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build_main.sh 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. # Check dependencies
  3. deperrors=''
  4. for depend in realpath rsync xsltproc xmllint sed find egrep grep wc make tee date iconv wget; do
  5. if ! which "$depend" >/dev/null 2>&1; then
  6. deperrors="$depend $deperrors"
  7. fi
  8. done
  9. if [ -n "$deperrors" ]; then
  10. printf '\033[1;31m'
  11. cat <<-EOF
  12. The build script depends on some other programs to function.
  13. Not all of those programs could be located on your system.
  14. Please use your package manager to install the following programs:
  15. EOF
  16. printf '\n\033[0;31m%s\n' "$deperrors"
  17. exit 1
  18. fi >>/dev/stderr
  19. basedir="${0%/*}/.."
  20. [ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
  21. readonly start_time="$(date +%s)"
  22. . "$basedir/build/arguments.sh"
  23. if [ -n "$statusdir" ]; then
  24. mkdir -p "$statusdir"
  25. [ ! -w "$statusdir" -o ! -d "$statusdir" ] && \
  26. die "Unable to set up status directory in \"$statusdir\",\n" \
  27. "either select a status directory that exists and is writable,\n" \
  28. "or run the build script without output to a status directory"
  29. fi
  30. readonly statusdir="${statusdir:+$(realpath "$statusdir")}"
  31. buildpids=$(
  32. ps -eo command \
  33. | egrep "[s]h ${0} .*" \
  34. | wc -l
  35. )
  36. if [ $command = "build_into" -o $command = "git_build_into" -o $command = "svn_build_into" ] && [ "$buildpids" -gt 2 ]; then
  37. debug "build script is already running"
  38. exit 0
  39. fi
  40. [ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
  41. [ -z "$inc_buildrun" ] && . "$basedir/build/buildrun.sh"
  42. [ -z "$inc_languages" ] && . "$basedir/build/languages.sh"
  43. [ -z "$inc_makerules" ] && . "$basedir/build/makerules.sh"
  44. [ -z "$inc_processor" ] && . "$basedir/build/processor.sh"
  45. [ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
  46. [ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
  47. [ -z "$inc_stirrups" ] && . "$basedir/build/stirrups.sh"
  48. case "$command" in
  49. git_build_into) if [ "${statusdir}/full_build" -nt "${statusdir}/index.cgi" ]; then
  50. debug "discovered flag file, performing full build"
  51. build_into
  52. else
  53. git_build_into
  54. fi ;;
  55. svn_build_into) if [ "${statusdir}/full_build" -nt "${statusdir}/index.cgi" ]; then
  56. debug "discovered flag file, performing full build"
  57. build_into
  58. else
  59. svn_build_into
  60. fi ;;
  61. build_into) build_into ;;
  62. map_tags) map_tags "$@";;
  63. process_file) process_file "$workfile" "$processor" "$olang" ;;
  64. build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" "$olang" ;;
  65. tree_maker) tree_maker "$tree" "$target" ;;
  66. sourceglobs) sourceglobs "$sourcesfile" ;;
  67. lang_sources) lang_sources "$sourceglobfile" "$lang" ;;
  68. cast_refglobs) cast_refglobs "$globfile" "$reffile" ;;
  69. wakeup_news) wakeup_news "$today" ;;
  70. esac