apply-all.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. #
  3. # This file applies optional Autoconf patches for better MSys2 and new
  4. # compiler compatibility.
  5. #
  6. # Based on Debian SID baseline files as of April 2023.
  7. #
  8. patchesdir=$(dirname $BASH_SOURCE) || exit 2
  9. test -n "$patchesdir" || exit 2
  10. cd "$patchesdir" || exit 2
  11. patchesdir=$(pwd) || exit 2
  12. patches=(
  13. # No patches currently
  14. )
  15. failed=( )
  16. cd "${patchesdir}/../.." || exit 1
  17. patch_params="-Nf -p1 --no-backup-if-mismatch -r - --read-only=fail"
  18. for patch in ${patches[@]}; do
  19. patchfile="${patchesdir}/${patch}"
  20. echo "*** Applying $patch..."
  21. if echo "$patch_data" | patch $patch_params -i "$patchfile"
  22. then
  23. echo "** $patch successfully applied."
  24. else
  25. echo "** $patch failed."
  26. failed+=("$patch")
  27. fi
  28. unset patch_data
  29. done
  30. addl_file="c_backported.m4"
  31. echo "*** Copying $addl_file"
  32. cp -fT "${patchesdir}/$addl_file" "m4/$addl_file" || exit 2
  33. echo "$addl_file copied."
  34. echo ''
  35. if [[ -n "${failed[@]}" ]]; then
  36. printf '* Failed patch: %s\n' "${failed[@]}" >&2
  37. exit 2
  38. else
  39. echo "* All patches have been successfully applied."
  40. fi
  41. exit 0