build.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. BUILD_ENV="1.0.8"
  3. SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
  4. LANGUAGES=$1
  5. if [ ! -d "build-env" ]; then
  6. mkdir build-env || exit 1
  7. fi
  8. cd build-env || exit 2
  9. if [ ! -d "../../PF-build-env-$BUILD_ENV-build" ]; then
  10. if [ ! -f "PF-build-env-Linux64-$BUILD_ENV.zip" ]; then
  11. #wget https://github.com/3d-gussner/PF-build-env-1/releases/download/$BUILD_ENV-Linux64/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3
  12. wget https://github.com/prusa3d/PF-build-env/releases/download/$BUILD_ENV-Linux64/PF-build-env-Linux64-$BUILD_ENV.zip || exit 3
  13. fi
  14. unzip -q PF-build-env-Linux64-$BUILD_ENV.zip -d ../../PF-build-env-$BUILD_ENV-build || exit 4
  15. fi
  16. cd ../../PF-build-env-$BUILD_ENV-build || exit 5
  17. BUILD_ENV_PATH="$( pwd -P )"
  18. cd ..
  19. if [ ! -d "Prusa-Firmware-build" ]; then
  20. mkdir Prusa-Firmware-build || exit 6
  21. fi
  22. cd Prusa-Firmware-build || exit 7
  23. BUILD_PATH="$( pwd -P )"
  24. if [ ! -f "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then
  25. cp $SCRIPT_PATH/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 8
  26. fi
  27. if [[ ! -z $LANGUAGES && $LANGUAGES == "EN_FARM" ]]; then
  28. echo "English only language firmware will be built"
  29. sed -i -- "s/^#define LANG_MODE *1/#define LANG_MODE 0/g" $SCRIPT_PATH/Firmware/config.h
  30. else
  31. sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h
  32. fi
  33. $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
  34. export ARDUINO=$BUILD_ENV_PATH
  35. if [ -z $LANGUAGES ]; then
  36. cd $SCRIPT_PATH/lang
  37. ./fw-build.sh || exit 10
  38. fi
  39. #Reset lang_mode
  40. sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h