1
0

dist.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/usr/bin/env bash
  2. set -e
  3. #
  4. # Dist script for libopenmpt.
  5. #
  6. # This is meant to be run by the libopenmpt maintainers.
  7. #
  8. # WARNING: The script expects the be run from the root of an OpenMPT svn
  9. # checkout. It invests no effort in verifying this precondition.
  10. #
  11. # We want ccache
  12. export PATH="/usr/lib/ccache:$PATH"
  13. # Create bin directory
  14. mkdir -p bin
  15. # Check that the API headers are standard compliant
  16. echo "Checking C header ..."
  17. echo '#include <stddef.h>' > bin/empty.c
  18. echo '' > bin/headercheck.c
  19. echo '#include "libopenmpt/libopenmpt.h"' >> bin/headercheck.c
  20. echo 'int main() { return 0; }' >> bin/headercheck.c
  21. echo " cc"
  22. cc -pedantic -Wall -Wextra -Werror -I. bin/headercheck.c -o bin/headercheck.cc.out
  23. echo " cc 89"
  24. cc -std=c89 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.c -o bin/headercheck.cc89.out
  25. echo " cc 99"
  26. cc -std=c99 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.c -o bin/headercheck.cc99.out
  27. echo " cc 11"
  28. cc -std=c11 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.c -o bin/headercheck.cc11.out
  29. if cc -std=c18 -c bin/empty.c -o bin/empty.cc18.out > /dev/null 2>&1 ; then
  30. echo " cc 18"
  31. cc -std=c18 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.c -o bin/headercheck.cc18.out
  32. fi
  33. echo " gcc 89"
  34. gcc -std=c89 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.gcc89.out
  35. echo " gcc 99"
  36. gcc -std=c99 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.gcc99.out
  37. echo " gcc 11"
  38. gcc -std=c11 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.gcc11.out
  39. if gcc -std=c18 -c bin/empty.c -o bin/empty.gcc18.out > /dev/null 2>&1 ; then
  40. echo " gcc 18"
  41. gcc -std=c18 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.gcc18.out
  42. fi
  43. echo " clang 89"
  44. clang -std=c89 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.clang89.out
  45. echo " clang 99"
  46. clang -std=c99 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.clang99.out
  47. echo " clang 11"
  48. clang -std=c11 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.clang11.out
  49. if clang -std=c18 -c bin/empty.c -o bin/empty.clang18.out > /dev/null 2>&1 ; then
  50. echo " clang 18"
  51. clang -std=c18 -pedantic -Wall -Wextra -Wpedantic -Werror -I. bin/headercheck.c -o bin/headercheck.clang18.out
  52. fi
  53. if [ `uname -s` != "Darwin" ] ; then
  54. if [ `uname -m` == "x86_64" ] ; then
  55. echo " tcc"
  56. tcc -Wall -Wunusupported -Wwrite-strings -Werror -I. bin/headercheck.c -o bin/headercheck.tcc.out
  57. fi
  58. fi
  59. rm bin/headercheck.*.out
  60. rm bin/headercheck.c
  61. echo "Checking C++ header ..."
  62. echo '#include <array>' > bin/empty.cpp
  63. touch bin/empty.dummy.out
  64. echo '' > bin/headercheck.cpp
  65. echo '#include "libopenmpt/libopenmpt.hpp"' >> bin/headercheck.cpp
  66. echo 'int main() { return 0; }' >> bin/headercheck.cpp
  67. #echo " c++"
  68. #c++ -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.cpp.out
  69. echo " c++ 17"
  70. c++ -std=c++17 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.cpp17.out
  71. if c++ -std=c++20 -c bin/empty.cpp -o bin/empty.cpp20.out > /dev/null 2>&1 ; then
  72. echo " c++ 20"
  73. c++ -std=c++20 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.cpp20.out
  74. fi
  75. echo " g++ 17"
  76. g++ -std=c++17 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.gpp17.out
  77. if g++ -std=c++20 -c bin/empty.cpp -o bin/empty.gpp20.out > /dev/null 2>&1 ; then
  78. echo " g++ 20"
  79. g++ -std=c++20 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.gpp20.out
  80. fi
  81. echo " clang++ 17"
  82. clang++ -std=c++17 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.clangpp17.out
  83. if clang++ -std=c++20 -c bin/empty.cpp -o bin/empty.clangpp20.out > /dev/null 2>&1 ; then
  84. echo " clang++ 20"
  85. clang++ -std=c++20 -pedantic -Wall -Wextra -Werror -I. bin/headercheck.cpp -o bin/headercheck.clangpp20.out
  86. fi
  87. rm bin/headercheck.*.out
  88. rm bin/headercheck.cpp
  89. rm bin/empty.*.out
  90. rm bin/empty.cpp
  91. rm bin/empty.c
  92. echo "Checking version helper ..."
  93. c++ -Wall -Wextra -I. -Isrc -Icommon build/auto/helper_get_openmpt_version.cpp -o bin/helper_get_openmpt_version
  94. rm bin/helper_get_openmpt_version
  95. # Clean dist
  96. make NO_SDL=1 NO_SDL2=1 clean-dist
  97. # Check the build
  98. make NO_SDL=1 NO_SDL2=1 STRICT=1 clean
  99. make NO_SDL=1 NO_SDL2=1 STRICT=1
  100. make NO_SDL=1 NO_SDL2=1 STRICT=1 check
  101. make NO_SDL=1 NO_SDL2=1 STRICT=1 clean
  102. # Build Unix-like tarball, Windows zipfile and docs tarball
  103. if `svn info . > /dev/null 2>&1` ; then
  104. make NO_SDL=1 NO_SDL2=1 SILENT_DOCS=1 dist
  105. fi
  106. # Clean
  107. make NO_SDL=1 NO_SDL2=1 clean
  108. # Build autoconfiscated tarball
  109. ./build/autotools/autoconfiscate.sh
  110. # Test autotools tarball
  111. ./build/autotools/test_tarball.sh