From 6c1ab28e75962ef85eecb7925aed5d29fb4d8961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Tue, 3 Oct 2017 20:30:53 +0200 Subject: [PATCH] improved build script, automatic version fetch from source --- front-end | 2 +- get_version.c | 14 ++++++++++++++ ship.sh | 36 +++++++++++++++++++----------------- user/version.h | 5 +++-- 4 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 get_version.c diff --git a/front-end b/front-end index 2bd1673..0114846 160000 --- a/front-end +++ b/front-end @@ -1 +1 @@ -Subproject commit 2bd167304c20f985a41f55cee55100283a6b7896 +Subproject commit 01148465b71b640892a50ec825205ae581d6dca7 diff --git a/get_version.c b/get_version.c new file mode 100644 index 0000000..0809451 --- /dev/null +++ b/get_version.c @@ -0,0 +1,14 @@ +// +// Created by MightyPork on 2017/10/03. +// +// helper for building release packages +// +// Run with `tcc -run` +// + +#include "user/version.h" +#include + +void main() { + printf(FW_VERSION); +} diff --git a/ship.sh b/ship.sh index 446a87d..6b419bf 100755 --- a/ship.sh +++ b/ship.sh @@ -1,16 +1,19 @@ #!/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 +if [ -z "$1" ]; then + vers=$(tcc -run get_version.c) +else + vers=$1 fi +git pull + +echo -n -e "\e[1;36mBuilding packages for version $vers\e[0m" + +cd front-end +git pull +cd .. + function buildlang() { lang=$1 @@ -20,8 +23,6 @@ function buildlang() { 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" @@ -56,12 +57,13 @@ function buildlang() { [[ -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 +if [ -z "$ESP_LANG" ]; then + buildlang cs + buildlang en + buildlang de +else + buildlang ${ESP_LANG} +fi diff --git a/user/version.h b/user/version.h index 85c0d0f..1bd6e06 100644 --- a/user/version.h +++ b/user/version.h @@ -5,12 +5,13 @@ #ifndef ESP_VT100_FIRMWARE_VERSION_H #define ESP_VT100_FIRMWARE_VERSION_H -#include "helpers.h" +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) #define FW_V_MAJOR 2 #define FW_V_MINOR 1 #define FW_V_PATCH 0 -#define FW_V_SUFFIX "-beta2" +#define FW_V_SUFFIX "-beta3" //#define FW_V_SUFFIX "" #define FW_CODENAME "Anthill" // 2.1.0 #define FW_CODENAME_QUOTED "\""FW_CODENAME"\""