fe7a367125f17e78a6c322f12a586be950aaa340
[sim/o1-interface.git] / ntsimulator / deploy / base / build_ntsim-ng.sh
1 #!/bin/bash
2
3 # /*************************************************************************
4 # *
5 # * Copyright 2020 highstreet technologies GmbH and others
6 # *
7 # * Licensed under the Apache License, Version 2.0 (the "License");
8 # * you may not use this file except in compliance with the License.
9 # * You may obtain a copy of the License at
10 # *
11 # *     http://www.apache.org/licenses/LICENSE-2.0
12 # *
13 # * Unless required by applicable law or agreed to in writing, software
14 # * distributed under the License is distributed on an "AS IS" BASIS,
15 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # * See the License for the specific language governing permissions and
17 # * limitations under the License.
18 # ***************************************************************************/
19
20 files=(
21     "core/container.c"
22     "core/context.c"
23     "core/docker.c"
24     "core/framework.c"
25     "core/test.c"
26     "core/session.c"
27     "core/nc_config.c"
28     "core/app/supervisor.c"
29     "core/app/app_common.c"
30     "core/app/manager.c"
31     "core/app/manager_context.c"
32     "core/app/manager_operations.c"
33     "core/app/manager_actions.c"
34     "core/app/manager_sysrepo.c"
35     "core/app/network_function.c"
36     "core/app/blank.c"
37     "core/datastore/schema.c"
38     "core/datastore/generate.c"
39     "core/datastore/populate.c"
40     "core/faults/faults.c"
41     "core/faults/faults_counters.c"
42     "core/faults/faults_processing.c"
43     "core/faults/faults_logic.c"
44     "core/faults/faults_ves.c"
45     "utils/log_utils.c"
46     "utils/rand_utils.c"
47     "utils/type_utils.c"
48     "utils/sys_utils.c"
49     "utils/http_client.c"
50     "utils/nts_utils.c"
51     "utils/nc_client.c"
52     "features/ves_pnf_registration/ves_pnf_registration.c"
53     "features/ves_heartbeat/ves_heartbeat.c"
54     "features/ves_file_ready/ves_file_ready.c"
55     "features/manual_notification/manual_notification.c"
56     "features/netconf_call_home/netconf_call_home.c"
57     "features/web_cut_through/web_cut_through.c"
58     "main.c"
59 )
60
61 libs=(
62     "argp"
63     "m"
64     "yang"
65     "sysrepo"
66     "netconf2"
67     "cjson"
68     "curl"
69     "pthread"
70 )
71
72 sources=""
73 for i in ${files[@]}
74 do
75     sources="$sources source/$i"
76 done
77
78 libraries=""
79 for i in ${libs[@]}
80 do
81     libraries="$libraries -l$i"
82 done
83
84 output="ntsim-ng"
85
86 build="gcc -Wall -pedantic -Isource $sources $libraries -o$output"
87 if [[ -n "${BUILD_WITH_DEBUG}" ]]; then
88     build="gcc -g -Wall -pedantic -Isource $sources $libraries -o$output"
89 fi
90
91 echo "Building with command: $build"
92 $build
93 if [ "$?" -ne "0" ]; then
94   echo "Build failed"
95   exit 1
96 fi