?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #!/usr/bin/env bash
  2.  
  3. # "remote curl build" bash script to build latest stable release v1.19.0
  4. # Designed for the ZX Spectrum Next community, for the Raspberry Pi Zero
  5. # "accelerator" distro maintainer.
  6.  
  7. # do NOT run on local box unless you understand what this script is doing and how it
  8. # will affect your local linux box (by installing those extra packages and sjasmplus).
  9.  
  10. # It will download + build + install latest stable sjasmplus release (from github)
  11. # Will install packages: GNU make, GCC-6 and G++-6
  12. # After successful build it will install sjasmplus into: PREFIX=/usr
  13. # After successful install the test-runner bash scripts are launched, storing output
  14. # into log files. These are valuable for sjasmplus maintainers (in case of some bugs).
  15.  
  16. # expected usage (something like this):
  17. #  mkdir -p /tmp/sjasmplus
  18. #  cd /tmp/sjasmplus
  19. #  curl https://raw.githubusercontent.com/z00m128/sjasmplus/master/ContinuousIntegration/remote_curl_build.sh | sh -
  20.  
  21. # expected output:
  22. #  /usr/bin/sjasmplus
  23. #  /tmp/sjasmplus/path_to_binary.log
  24. #  /tmp/sjasmplus/tests.log
  25. #  /tmp/sjasmplus/examples.log
  26.  
  27. # download+extract the source tar.gz with curl:
  28. echo "# Downloading + extracing sjasmplus sources (stable release v1.19.0) from github..."
  29. curl -O -L https://github.com/z00m128/sjasmplus/archive/v1.19.0.tar.gz && \
  30. tar xf v*.tar.gz && \
  31. cd sjasmplus*
  32. SRC_RESULT=$?
  33. if [ $SRC_RESULT -ne 0 ]; then
  34.     echo "# Downloading + extracting failed:" $SRC_RESULT
  35.     exit $SRC_RESULT
  36. fi
  37.  
  38. # try to install tools required to build sjasmplus binary
  39. # (first version of script, so far using integrated copy of LUA inside the sources)
  40. echo "# Installing required packages for build: make gcc-6 g++-6 (+ their deps)"
  41. sudo apt -y install make gcc-6 g++-6
  42. APT_RESULT=$?
  43. if [ $APT_RESULT -ne 0 ]; then
  44.     echo "# Installing packages failed:" $APT_RESULT
  45.     exit $APT_RESULT
  46. fi
  47.  
  48. # try to build and install the binary
  49. echo "# Running make to build + install the binary"
  50. make CC=gcc-6 CXX=g++-6 && \
  51. sudo make PREFIX=/usr CC=gcc-6 CXX=g++-6 install && \
  52. make clean
  53. BUILD_RESULT=$?
  54. if [ $BUILD_RESULT -ne 0 ]; then
  55.     echo "# Build+install failed:" $BUILD_RESULT
  56.     exit $BUILD_RESULT
  57. else
  58.     echo "# 'which sjasmplus' = " `which sjasmplus`
  59.     which sjasmplus > ../path_to_binary.log
  60. fi
  61.  
  62. # try to run, collect all output to "../tests.log" and "../examples.log"
  63. echo "# Running the tests... output is in (tests|examples).log files"
  64. NOCOLOR=1 bash ContinuousIntegration/test_folder_tests.sh > ../tests.log 2>&1
  65. NOCOLOR=1 bash ContinuousIntegration/test_folder_examples.sh > ../examples.log 2>&1
  66.  
  67. # display summary of tests run...
  68. if [ -s ../tests.log ]; then
  69.     head -n 3 ../tests.log
  70.     echo " ..."
  71.     tail -n 2 ../tests.log
  72. else
  73.     echo "# ERROR: ../tests.log seems missing or empty"
  74. fi
  75. if [ -s ../examples.log ]; then
  76.     head -n 3 ../examples.log
  77.     echo " ..."
  78.     tail -n 2 ../examples.log
  79. else
  80.     echo "# ERROR: ../examples.log seems missing or empty"
  81. fi
  82.  
  83. # final cleanup
  84. cd ..
  85. #TODO ... really?# rm -rf sjasmplus*
  86. #TODO ... really?# rm *.tar.gz
  87. ls -la
  88.