make-dist.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. #
  3. # This file creates dist tarball.
  4. # Optional autotools patches are applied for better toolchains
  5. # compatibility.
  6. #
  7. # Based on Debian SID baseline files as of April 2023.
  8. #
  9. if ! grep -Eq -e '^PRETTY_NAME="Debian GNU/Linux 12 \(bookworm\)"$' /etc/os-release
  10. then
  11. echo "Only Debian 'bookworm' is supported by this script." >&2
  12. exit 1
  13. fi
  14. if ! autoconf --version | head -1 | grep -Eq -e ' 2\.71$' -
  15. then
  16. echo "The only supported autoconf version is 2.71." >&2
  17. exit 1
  18. fi
  19. tooldir=$(dirname $BASH_SOURCE) || exit 2
  20. test -n "$tooldir" || exit 2
  21. cd "$tooldir" || exit 2
  22. tooldir="$PWD" || exit 2
  23. cd "${tooldir}/.." || exit 2
  24. rootsrcdir="$PWD" || exit 2
  25. # Cleanup sources
  26. echo ''
  27. echo '*** Performing initial cleanup...'
  28. echo ''
  29. if [[ ! -f 'Makefile' ]] || ! make maintainer-clean
  30. then
  31. # Makefile needed for initial cleanup
  32. if [[ ! -f 'Makefile.in' ]] || [[ ! -f 'configure' ]] || ! ./configure || ! make maintainer-clean
  33. then
  34. rm -f po/Makefile || exit 3
  35. # Build 'configure' to build Makefile for initial cleanup
  36. autoreconf -fvi || exit 3
  37. ./configure || exit 3
  38. make maintainer-clean || exit 3
  39. fi
  40. fi
  41. echo ''
  42. echo '** Initial cleanup completed.'
  43. echo ''
  44. # Copy latest autotools files
  45. echo ''
  46. echo '*** Copying autotools files...'
  47. echo ''
  48. autoreconf -fvi || exit 4
  49. echo ''
  50. echo '*** Performing intermediate cleanup...'
  51. echo ''
  52. ./configure || exit 4
  53. make distclean || exit 4
  54. rm -f ./configure ./aclocal.m4 || exit 4
  55. rm -rf ./autom4te.cache || exit 4
  56. echo ''
  57. echo '** Intermediate cleanup completed.'
  58. echo ''
  59. # Patching local autotools files
  60. echo ''
  61. echo '*** Performing patching of local autotools files...'
  62. echo ''
  63. "$tooldir/fixes-libtool/apply-all.sh" || exit 5
  64. "$tooldir/fixes-autoconf/apply-all.sh" || exit 5
  65. echo ''
  66. echo '** Local autotools files patched.'
  67. echo ''
  68. # Build the configure and the related files with patches
  69. echo ''
  70. echo '*** Building patched configure and related files...'
  71. echo ''
  72. autoreconf -v || exit 6
  73. echo ''
  74. echo '** Patched build system ready.'
  75. echo ''
  76. # Build the configure and the related files with patches
  77. echo ''
  78. echo '*** Building dist tarball...'
  79. echo ''
  80. ./configure || exit 7
  81. make dist || exit 7
  82. echo ''
  83. echo '** Dist tarball ready.'
  84. echo ''
  85. exit 0