-
Notifications
You must be signed in to change notification settings - Fork 6
/
travis-build.sh
executable file
·83 lines (73 loc) · 2.37 KB
/
travis-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
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
79
80
81
82
83
#!/bin/bash
REV_VAR="github.com/opensatelliteproject/SatHelperApp.RevString"
VERSION_VAR="github.com/opensatelliteproject/SatHelperApp.VersionString"
BUILD_DATE_VAR="github.com/opensatelliteproject/SatHelperApp.CompilationDate"
BUILD_TIME_VAR="github.com/opensatelliteproject/SatHelperApp.CompilationTime"
REPO_VERSION=$(git describe --always --dirty --tags)
REPO_REV=$(git rev-parse HEAD)
BUILD_DATE=$(date +"%d%m%Y")
BUILD_TIME=$(date +"%H%M%S")
GOBUILD_VERSION_ARGS="-ldflags \"-X '${REV_VAR}=${REPO_REV}' -X '${VERSION_VAR}=${REPO_VERSION}' -X '${BUILD_DATE_VAR}=${BUILD_DATE}' -X '${BUILD_TIME_VAR}=${BUILD_TIME}'\""
echo "REV_VAR=${REV_VAR}"
echo "VERSION_VAR=${VERSION_VAR}"
echo "BUILD_DATE_VAR=${BUILD_DATE_VAR}"
echo "BUILD_TIME_VAR=${BUILD_TIME_VAR}"
echo "REPO_VERSION=${REPO_VERSION}"
echo "REPO_REV=${REPO_REV}"
echo "BUILD_DATE=${BUILD_DATE}"
echo "BUILD_TIME=${BUILD_TIME}"
echo "GOBUILD_VERSION_ARGS=${GOBUILD_VERSION_ARGS}"
export GO111MODULE=on
TAG=`git describe --exact-match --tags HEAD 2>/dev/null`
if [[ $? -eq 0 ]];
then
echo "Releasing for tag ${TAG}"
ORIGINAL_FOLDER="`pwd`"
echo "I'm in `pwd`"
mkdir -p bins
mkdir -p zips
echo "Building RTLSDR"
git clone https://github.com/librtlsdr/librtlsdr.git
cd librtlsdr
mkdir -p build && cd build
cmake ..
make -j10
sudo make install
sudo ldconfig
cd ..
echo "Going back to $ORIGINAL_FOLDER"
cd "$ORIGINAL_FOLDER"
echo "Building Static LimeSuite"
git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite
git checkout stable
mkdir -p builddir && cd builddir
cmake ../ -DBUILD_SHARED_LIBS=OFF
make -j10
sudo make install
sudo ldconfig
cd ..
echo "Going back to $ORIGINAL_FOLDER"
cd "$ORIGINAL_FOLDER"
echo "Updating Code to have static libLimeSuite"
sed -i 's/-lLimeSuite/-l:libLimeSuite.a -l:libstdc++.a -static-libgcc -lm -lusb-1.0/g' $(GOPATH)/pkg/mod/github.com/myriadrf/limedrv*/limewrap/limewrap.go
echo "Building"
cd cmd
for i in *
do
echo "Building $i"
cd ${i}
echo go build ${GOBUILD_VERSION_ARGS} -o ../../bins/${i}
bash -c "go build ${GOBUILD_VERSION_ARGS} -o ../../bins/${i}"
echo "Zipping ${i}-${TAG}-linux-amd64.zip"
zip -r "../../zips/${i}-${TAG}-linux-amd64.zip" ../../bins/$i
cd ..
done
cd ..
echo "Binaries: "
ls -la bins
echo "Zip Files: "
ls -la zips
else
echo "No tags for current commit. Skipping releases."
fi