build.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. echo "***************************************************"
  3. echo "WARNING: build.sh will be removed soon, do not use!"
  4. echo "Switch your build to cmake or use PF-build.sh "
  5. echo "***************************************************"
  6. BUILD_ENV="1.0.8"
  7. SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
  8. LANGUAGES=$1
  9. if [ ! -d "build-env" ]; then
  10. mkdir build-env || exit 1
  11. fi
  12. cd build-env || exit 2
  13. if [ ! -d "../../PF-build-env/$BUILD_ENV-build" ]; then
  14. if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then
  15. #wget https://github.com/3d-gussner/PF-build-env-1/releases/download/$BUILD_ENV-Linux64/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3
  16. wget https://github.com/prusa3d/PF-build-env/releases/download/$BUILD_ENV-Linux64/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3
  17. fi
  18. unzip -q PF-build-env-Linux64-$BUILD_ENV.zip -d ../../PF-build-env/$BUILD_ENV-build || exit 4
  19. fi
  20. cd ../../PF-build-env/$BUILD_ENV-build || exit 5
  21. BUILD_ENV_PATH="$( pwd -P )"
  22. cd ..
  23. if [ ! -d "Prusa-Firmware-build" ]; then
  24. mkdir Prusa-Firmware-build || exit 6
  25. fi
  26. cd Prusa-Firmware-build || exit 7
  27. BUILD_PATH="$( pwd -P )"
  28. if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then
  29. cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8
  30. fi
  31. if [[ ! -z $LANGUAGES && $LANGUAGES == "EN_FARM" ]]; then
  32. echo "English only language firmware will be built"
  33. sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE 0/g" $SCRIPT_PATH/Firmware/config.h
  34. else
  35. sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h
  36. fi
  37. $BUILD_ENV_PATH/arduino $SCRIPT_PATH/Firmware/Firmware.ino --verify --board PrusaResearch:avr:prusa_einsy_rambo --pref build.path=$BUILD_PATH --pref compiler.warning_level=all || exit 9
  38. export ARDUINO=$BUILD_ENV_PATH
  39. export OUTDIR=$BUILD_PATH
  40. if [ -z $LANGUAGES ]; then
  41. cd $SCRIPT_PATH/lang
  42. ./fw-build.sh || exit 10
  43. fi
  44. #Reset lang_mode
  45. sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h