Skip to content

Commit

Permalink
improved build script, automatic version fetch from source
Browse files Browse the repository at this point in the history
  • Loading branch information
MightyPork committed Oct 3, 2017
1 parent 2796709 commit 6c1ab28
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
14 changes: 14 additions & 0 deletions get_version.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

void main() {
printf(FW_VERSION);
}
36 changes: 19 additions & 17 deletions ship.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"
Expand Down Expand Up @@ -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
5 changes: 3 additions & 2 deletions user/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"\""
Expand Down

0 comments on commit 6c1ab28

Please sign in to comment.