-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-gse.sh
executable file
·78 lines (69 loc) · 2.48 KB
/
compile-gse.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash -e
## module
MODULE=gse
## load defaults
. ./common.sh "$@" -forcecopy
## print
echo "** Compiling $MODULE"
## delete whole compile sources and start from new
if [ -n "$SW_CLEANUP" ]; then
echo -n "Deleting old sources ... "
rm -rf $COMPILEDIR/$MODULE
echo done
fi
## copy source to temp compile path
if [ ! -d $COMPILEDIR/$MODULE ] || [ -n "$SW_FORCECOPY" ]; then
echo -n "Copying new sources ... "
rsync -a $INTSRCDIR/$MODULE $COMPILEDIR/
echo done
fi
## get build release
DEBRELEASE=$(awk -F' ' '{if($1=="Release:") print $2}' $SCRIPTDIR/debian.template/control)
if [ -n "$SW_DEBUG" ]; then
DEBRELEASE=${DEBRELEASE}d
elif [ -n "$SW_SYMBOLS" ]; then
## Note: this could also be done using the "objdump --file-headers" command
DEBRELEASE=${DEBRELEASE}s
fi
BUILDDATE=$(date -u)
BUILDKERNELNAME=$(uname)
BUILDKERNELRELEASE=$(uname -r)
BUILDKERNELVERSION=$(uname -v)
BUILDNODENAME=$(uname -n)
BUILDMACHINE=$(uname -m)
if [ -z "$WINDIR" ]; then
BUILDOS=$(lsb_release -sd)
BUILDOS="${BUILDOS//\"}"
else
BUILDOS=$(uname -s)
BUILDOS=${BUILDOS#*_}
fi
GITHASH=$(git log -n 1 --pretty=format:%H)
GCCVERSION=$(gcc --version | head -1 | grep -o "[0-9][.][0-9]*[.][0-9]*[.-]*[0-9]*" | head -1)
## replace the specific variables in gse package
sed -i "s|%tcl_release%|$DEBRELEASE|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_os%|$BUILDOS|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_kernelname%|$BUILDKERNELNAME|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_kernelrelease%|$BUILDKERNELRELEASE|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_kernelversion%|$BUILDKERNELVERSION|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_nodename%|$BUILDNODENAME|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_machine%|$BUILDMACHINE|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%build_date%|$BUILDDATE|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%git_hash%|$GITHASH|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
sed -i "s|%gcc_version%|$GCCVERSION|g" $COMPILEDIR/$MODULE/pkgIndex.tcl
## get gse version number
echo -n "Loading $MODULE package ... "
cd $COMPILEDIR/$MODULE
echo "source pkgIndex.tcl" > ./info.tcl
echo "puts [package re gse]" >> ./info.tcl
echo "exit" >> ./info.tcl
VERSION=$($INSTALLDIR/bin/$TCLSH ./info.tcl)
rm ./info.tcl
echo done
## now copy to release
echo -n "Installing ... "
mkdir -p $INSTALLDIR/lib/$MODULE$VERSION
rsync -a $COMPILEDIR/$MODULE/* $INSTALLDIR/lib/$MODULE$VERSION/
echo done
## fini
echo "** Finished compile-$MODULE"