From d2edcd7fd56b7a6fd3f885d53f45d0b21553e456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Tue, 3 Oct 2017 00:59:21 +0200 Subject: [PATCH] added new release system --- CMakeLists.txt | 1 + Makefile | 20 +++++--------- front-end | 2 +- rel-tpl/README.txt | 21 +++++++++++++++ rel-tpl/flash.sh | 26 ++++++++++++++++++ release/.gitignore | 1 + ship.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++ user/user_main.c | 2 +- 8 files changed, 123 insertions(+), 16 deletions(-) create mode 100644 rel-tpl/README.txt create mode 100644 rel-tpl/flash.sh create mode 100755 ship.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 9214dff..8e65181 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,7 @@ add_definitions( -DICACHE_FLASH_ATTR= -DICACHE_RODATA_ATTR= -DFLAG_GZIP=2 + -DESP_LANG="en" -DGIT_HASH_BACKEND="asdf" -DGIT_HASH_FRONTEND="asdf" diff --git a/Makefile b/Makefile index 56be03c..474bb3a 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,10 @@ LIBS = c gcc hal phy pp net80211 wpa main lwip crypto #Add in esphttpd lib LIBS += esphttpd +ifndef ESP_LANG +ESP_LANG = en +endif + # compiler flags using during compilation of source files -ggdb CFLAGS = -Os -std=gnu99 -Werror -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inline-functions \ -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH \ @@ -69,7 +73,7 @@ CFLAGS = -Os -std=gnu99 -Werror -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inli CFLAGS += -DGIT_HASH_BACKEND='"$(shell git rev-parse --short HEAD)"' CFLAGS += -DGIT_HASH_FRONTEND='"$(shell cd front-end && git rev-parse --short HEAD)"' -CFLAGS += -D__TIMEZONE__='"$(shell date +%Z)"' +CFLAGS += -D__TIMEZONE__='"$(shell date +%Z)"' -DESP_LANG='"$(ESP_LANG)"' ifdef GLOBAL_CFLAGS CFLAGS += $(GLOBAL_CFLAGS) @@ -211,19 +215,7 @@ all: checkdirs $(Q) make actual_all -j4 -B release: - ESP_LANG=cs make web - make actual_all -j4 - cp firmware/0x00000.bin release/0x00000.bin - cp firmware/0x40000.bin release/0x40000-CS.bin - - ESP_LANG=en make web - make actual_all -j4 - cp firmware/0x40000.bin release/0x40000-EN.bin - - ESP_LANG=de make web - make actual_all -j4 - cp firmware/0x40000.bin release/0x40000-DE.bin - + $(Q) ./release.sh actual_all: parser $(TARGET_OUT) $(FW_BASE) diff --git a/front-end b/front-end index 69e5b77..2e64f0e 160000 --- a/front-end +++ b/front-end @@ -1 +1 @@ -Subproject commit 69e5b774475fc78c6244d3e14ade7a677760a731 +Subproject commit 2e64f0e20b2e82d9ada540639764e163467ea4be diff --git a/rel-tpl/README.txt b/rel-tpl/README.txt new file mode 100644 index 0000000..dc039ea --- /dev/null +++ b/rel-tpl/README.txt @@ -0,0 +1,21 @@ +This is a release archive of ESPTerm, +the VT100 terminal emulator for ESP8266. + +-------------------------------------------- +Version: %VERS% +Locale : %LANG% +Built : %DATETIME% +-------------------------------------------- + +Source repository: + https://github.com/espterm/espterm-firmware + +Report any bugs to our bug-tracker at + https://github.com/espterm/espterm-firmware/issues +or send them to out mailing list + espterm-dev@googlegroups.com + +On-line demo is available at + https://espterm.github.io/term.html + +[EOF] diff --git a/rel-tpl/flash.sh b/rel-tpl/flash.sh new file mode 100644 index 0000000..4a92a28 --- /dev/null +++ b/rel-tpl/flash.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# The parameters ESPTOOL, ESPPORT and ESPBAUD can be customized +# - export your preferred values in .bashrc + +echo -e "\e[32;1mFlashing ESPTerm %VERS% (%LANG%)\e[0m" + +if [ -z ${ESPTOOL} ]; then + ESPTOOL='esptool' + which ${ESPTOOL} &>/dev/null + if [ $? -ne 0 ]; then + ESPTOOL='esptool.py' + which ${ESPTOOL} &>/dev/null + if [ $? -ne 0 ]; then + echo -e '\e[31;1mesptool not found!\e[0m' + exit 1 + fi + fi +fi + +[ -z ESPPORT ] && ESPPORT=/dev/ttyUSB0 +[ -z ESPBAUD ] && ESPBAUD=460800 + +set -x +${ESPTOOL} --port ${ESPPORT} --baud ${ESPBAUD} \ + write_flash 0x00000 '%FILE0%' 0x40000 '%FILE4%' diff --git a/release/.gitignore b/release/.gitignore index d6b7ef3..3814986 100644 --- a/release/.gitignore +++ b/release/.gitignore @@ -1,2 +1,3 @@ * !.gitignore +!flash-tpl.sh diff --git a/ship.sh b/ship.sh new file mode 100755 index 0000000..36e0d12 --- /dev/null +++ b/ship.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +echo -n -e "\e[1;36m Version number (for file names): \e[0m" +read vers +echo + +if [ -z "$vers" ] + then + echo -e "\e[0;31m Aborted.\e[0m" + echo + exit +fi + +function buildlang() { + lang=$1 + + echo -e "\n\e[33;1m------ Building \"${lang}\" package ------\e[0m\n" + + ESP_LANG=${lang} make web + ESP_LANG=${lang} make actual_all -B -j4 + + cp firmware/0x00000.bin release/0x00000.bin + cp firmware/0x40000.bin release/0x40000.bin + cd release + + destdir="$vers-$lang" + file0=${vers}-0x00000-${lang}.bin + file4=${vers}-0x40000-${lang}.bin + [ -e ${destdir} ] && rm -r ${destdir} + mkdir ${destdir} + cp ../firmware/0x00000.bin ${destdir}/${file0} + cp ../firmware/0x40000.bin ${destdir}/${file4} + + flashsh=${destdir}/flash.sh + cp ../rel-tpl/flash.sh ${flashsh} + sed -i s/%FILE0%/${file0}/ ${flashsh} + sed -i s/%FILE4%/${file4}/ ${flashsh} + sed -i s/%VERS%/${vers}/ ${flashsh} + sed -i s/%LANG%/${lang}/ ${flashsh} + chmod +x ${flashsh} + + readmefil=${destdir}/README.txt + cp ../rel-tpl/README.txt ${readmefil} + sed -i s/%VERS%/${vers}/ ${readmefil} + sed -i s/%LANG%/${lang}/ ${readmefil} + dt=$(LC_TIME=en_US.UTF-8 date '+%c %Z') + sed -i "s#%DATETIME%#${dt}#" ${readmefil} + unix2dos ${readmefil} + + cd ${destdir} + sha256sum ${file0} ${file4} README.txt flash.sh > checksums.txt + cd .. + + targetfile=espterm-${vers}-${lang}.zip + [[ -e ${targetfile}.zip ]] && rm ${targetfile}.zip + pwd + zip -9 ${targetfile} ${destdir}/* + #rm -r ${destdir} + + rm 0x00000.bin 0x40000.bin + cd .. +} + +buildlang cs +buildlang en +buildlang de diff --git a/user/user_main.c b/user/user_main.c index dc277d0..62afe2e 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -114,7 +114,7 @@ void ICACHE_FLASH_ATTR user_init(void) banner_info(); banner_info(TERMINAL_GITHUB_REPO_NOPROTO); banner_info(); - banner_info("Version "FW_VERSION", code name "FW_CODENAME_QUOTED); + banner_info("Version "FW_VERSION" ("ESP_LANG"), code name "FW_CODENAME_QUOTED); banner_info(" back-end #"GIT_HASH_BACKEND" front-end #"GIT_HASH_FRONTEND); banner_info(" built "__DATE__" at "__TIME__" "__TIMEZONE__); banner_info();