-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·38 lines (32 loc) · 900 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
mkdir -p bin
if [ -e gitver.inc ]; then
function const () { eval $@; }
source gitver.inc
let ++VER_BUILD
else
VER_BUILD=0
fi
#get information from git
githash=$(git rev-parse HEAD)
gittag=$(git describe --always --abbrev=0 --match 'v[0-9]*')
gitcnt=$(git rev-list --count $gittag..HEAD)
gitbranch=$(git symbolic-ref --quiet --short HEAD)
if git diff-index --quiet HEAD --
then gitclean=true; else gitclean=false; fi
ver1=${gittag#v}; ver1=${ver1%%-*};
echo Git version: $ver1 $gitbranch $gitcnt $USER $VER_BUILD
#create gitver.inc
echo "const VER_CLEAN=$gitclean;
const VER_HASH='$githash';
const VER_BRANCH='$gitbranch';
const VER_USER='$USER@$HOSTNAME';
const VER_MINOR=$ver1;
const VER_PATCH=$gitcnt;
const VER_BUILD=$VER_BUILD;" >gitver.inc
make -C alg
fpc @fpopt.cfg -a brodnetd.pas
fpc @fpopt.cfg bnc.pas
fpc @fpopt.cfg bnedit.pas
echo Built version: $gitver