summaryrefslogtreecommitdiff
path: root/scripts/build_linux.sh
blob: af3ad317c0eb0a80510301585b675702d0a11c11 (plain)
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
#!/bin/bash
set -e

COVERITY_VERSION="2017.07"
BUILD_PATH="linux"

cmake_opts="-Dgraphics/qt_qpainter:BOOL=FALSE -Dgui/qml:BOOL=FALSE -DSVG2PNG:BOOL=FALSE -DSAMPLE_MAP=n -Dgraphics/gtk_drawing_area:BOOL=TRUE"

[ -d $BUILD_PATH ] || mkdir -p $BUILD_PATH
pushd $BUILD_PATH

if [[ "${CIRCLE_PROJECT_USERNAME}" == "navit-gps" && "${CIRCLE_BRANCH}" == "trunk" ]]; then
	# If we are building the official trunk code, push an update to coverity
    echo "Pushing an update to coverity as we are building the official trunk code."
    echo "Downloading coverity..."
	curl \
	    -X POST --data "token=${COVERITY_TOKEN}&project=${CIRCLE_PROJECT_USERNAME}" \
	    -o /tmp/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz -s \
	    https://scan.coverity.com/download/linux64

    echo "Unpacking coverity..."
	tar xfz /tmp/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz --no-same-owner -C /usr/local/share/
	export PATH=/usr/local/share/cov-analysis-linux64-${COVERITY_VERSION}/bin:$PATH

    echo "Building with coverity..."
	cmake ${cmake_opts} ../
	cov-build --dir cov-int make -j $(nproc --all)
	tar czvf navit.tgz cov-int

	curl --form token=$COVERITY_TOKEN \
  --form email=$COVERITY_EMAIL \
  --form file=@navit.tgz \
  --form version="${CIRCLE_BRANCH}-$CIRCLE_SHA1" \
  --form description="${CIRCLE_BRANCH}-$CIRCLE_SHA1" \
  https://scan.coverity.com/builds?project=$CIRCLE_PROJECT_USERNAME

        make package

	# Then update the translation template on launchpad
	echo "Updating the translation template on launchpad..."
	sed -i '/INTEGER/d' po/navit.pot
	cp po/navit.pot $CIRCLE_ARTIFACTS/
	curl "https://translations.launchpad.net/navit/${CIRCLE_BRANCH}/+translations-upload" -H "$lp_cookie" -H "Referer: https://translations.launchpad.net/navit/${CIRCLE_BRANCH}/+translations-upload" -F file=@po/navit.pot | grep title

else
    echo "Not on the official trunk branch, building without coverity..."
	cmake ${cmake_opts} ../
	make -j $(nproc --all)
	make package
fi

if [[ "$CIRCLE_ARTIFACTS" != "" ]]; then
	echo "Copying icons to artifacts..."
	cp -r navit/icons $CIRCLE_ARTIFACTS
fi