summaryrefslogtreecommitdiff
path: root/test/poi-service/script/build.sh
blob: 2e2a8b9473d35db287fa90fa33294631be967a6b (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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash

###########################################################################
# @licence app begin@
# SPDX-License-Identifier: MPL-2.0
#
# Component Name: poi-service
# Author: Philippe Colliot <philippe.colliot@mpsa.com>
#
# Copyright (C) 2013-2014, PCA Peugeot Citroen
# 
# License:
# This Source Code Form is subject to the terms of the
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
# this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# @licence end@
###########################################################################
TOP_DIR=$PWD/..
TOP_BIN_DIR=$TOP_DIR/bin

POI_COMMON=poi-common
POI_COMMON_SRC_DIR=$TOP_DIR/$POI_COMMON

POI_CLIENT=poi-client
POI_CLIENT_SRC_DIR=$TOP_DIR/$POI_CLIENT
POI_CLIENT_BIN_DIR=$TOP_BIN_DIR/$POI_CLIENT

POI_CONTENTACCESS_MODULE=poi-contentaccess-module
POI_CONTENTACCESS_MODULE_SRC_DIR=$TOP_DIR/$POI_CONTENTACCESS_MODULE
POI_CONTENTACCESS_MODULE_BIN_DIR=$TOP_BIN_DIR/$POI_CONTENTACCESS_MODULE

POI_SUPPLIER=poi-supplier
POI_SUPPLIER_SRC_DIR=$TOP_DIR/$POI_SUPPLIER
POI_SUPPLIER_BIN_DIR=$TOP_BIN_DIR/$POI_SUPPLIER

NAVIGATION_SERVICE_API_DIR=$TOP_DIR/../../api

POI_SERVER_TOP_DIR=$TOP_DIR/../../src/poi-service
POI_SERVER_SRC_DIR=$POI_SERVER_TOP_DIR/poi-server
POI_SERVER_BIN_DIR=$POI_SERVER_TOP_DIR/bin
POI_SERVER_SCRIPT_DIR=$POI_SERVER_TOP_DIR/script
POI_SERVER_BUILD_SCRIPT=./build.sh

API_DIR=$TOP_DIR/../../api

NAVIGATION_CORE=navigation-core
MAP_VIEWER=map-viewer
POI_SERVICE=poi-service

#--------------------------------------------------------------------------
# Compiler Flags
#--------------------------------------------------------------------------
# modify the following flags as needed:

#--------------------------------------------------------------------------

usage() {
    echo "Usage: ./build.sh Build poi-service"
    echo "   or: ./build.sh [command]"
    echo
    echo "command:"
    echo "  make            Build"
    echo "  clean           Clean"
    echo "  src-clean       Clean the cloned sources"
    echo "  help            Print Help"
    echo
    echo
}

build() {
    echo ''
    echo 'Building poi-service'

    echo 'Generate DBus include files'

	cmake $API_DIR/$NAVIGATION_CORE
	cmake $API_DIR/$MAP_VIEWER
	cmake $API_DIR/$POI_SERVICE

    echo 'Check and build poi-server if needed'
    cd $POI_SERVER_SCRIPT_DIR && bash $POI_SERVER_BUILD_SCRIPT make

    cd $TOP_DIR 
    mkdir -p bin

    cd $TOP_BIN_DIR
    mkdir -p $POI_CLIENT
    cd $POI_CLIENT_BIN_DIR 
    cmake $POI_CLIENT_SRC_DIR && make

    cd $TOP_BIN_DIR
    mkdir -p $POI_SUPPLIER
    cd $POI_SUPPLIER_BIN_DIR 
    cmake $POI_SUPPLIER_SRC_DIR && make

    cd $TOP_BIN_DIR
    mkdir -p $POI_CONTENTACCESS_MODULE
    cd $POI_CONTENTACCESS_MODULE_BIN_DIR 
    cmake $POI_CONTENTACCESS_MODULE_SRC_DIR && make

}

clean() {
    cd $POI_SERVER_SCRIPT_DIR && bash $POI_SERVER_BUILD_SCRIPT clean
	echo 'delete' $TOP_BIN_DIR 
	rm -rf $TOP_BIN_DIR
	echo 'delete qm generated files'
	rm -f $POI_COMMON_SRC_DIR/*.qm 
}

src-clean() {
    cd $POI_SERVER_SCRIPT_DIR && bash $POI_SERVER_BUILD_SCRIPT src-clean
	echo 'delete' $TOP_BIN_DIR 
	rm -rf $TOP_BIN_DIR
	echo 'delete qm generated files'
	rm -f $POI_COMMON_SRC_DIR/*.qm 
}


set -e

if [ $# -ge 1 ]; then
    if [ $1 = help ]; then
        usage
    elif [ $1 = make ]; then
        build
    elif [ $1 = clean ]; then
        clean
    elif [ $1 = src-clean ]; then
        src-clean
    else
        usage
    fi
elif [ $# -eq 0 ]; then
    build
else
    usage
fi