Update github.com git:// SRC_URIs
[AGL/meta-agl-devel.git] / meta-speech-framework / meta-aac / recipes-apis / alexa-voiceagent-service / alexa-voiceagent-service / 0007-add-autobuild-scripts.patch
1 Add autobuild scripts
2
3 Add autobuild scripts and update .gitignore to not ignore them.
4 The autobuild/agl/autobuild script will be required for building widgets
5 in AGL, add the latest version to the voiceagent source tree.
6
7 Upstream-Status: Pending
8
9 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
10
11 diff --git a/.gitignore b/.gitignore
12 index b3c1108..edbf1b5 100644
13 --- a/.gitignore
14 +++ b/.gitignore
15 @@ -1,3 +1,2 @@
16 -autobuild/
17  build/
18  alexa-voiceagent-apidef.h
19 diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild
20 new file mode 100755
21 index 0000000..16181b8
22 --- /dev/null
23 +++ b/autobuild/agl/autobuild
24 @@ -0,0 +1,128 @@
25 +#!/usr/bin/make -f
26 +# Copyright (C) 2015 - 2018 "IoT.bzh"
27 +# Copyright (C) 2020 Konsulko Group
28 +# Author "Romain Forlot" <romain.forlot@iot.bzh>
29 +#
30 +# Licensed under the Apache License, Version 2.0 (the "License");
31 +# you may not use this file except in compliance with the License.
32 +# You may obtain a copy of the License at
33 +#
34 +#       http://www.apache.org/licenses/LICENSE-2.0
35 +#
36 +# Unless required by applicable law or agreed to in writing, software
37 +# distributed under the License is distributed on an "AS IS" BASIS,
38 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 +# See the License for the specific language governing permissions and
40 +# limitations under the License.
41 +
42 +THISFILE  := $(lastword $(MAKEFILE_LIST))
43 +ROOT_DIR := $(abspath $(dir $(THISFILE))/../..)
44 +
45 +# Build directories
46 +# Note that the debug/test/coverage directories are defined in relation
47 +# to the release directory (BUILD_DIR), this needs to be kept in mind
48 +# if over-riding it and building those widget types, the specific widget
49 +# type variable (e.g. BUILD_DIR_DEBUG) may also need to be specified
50 +# to yield the desired output hierarchy.
51 +BUILD_DIR = $(ROOT_DIR)/build
52 +BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug)
53 +BUILD_DIR_TEST = $(abspath $(BUILD_DIR)/../build-test)
54 +BUILD_DIR_COVERAGE = $(abspath $(BUILD_DIR)/../build-coverage)
55 +
56 +# Output directory variable for use in pattern rules.
57 +# This is intended for internal use only, hence the explicit override
58 +# definition.
59 +override OUTPUT_DIR = $(BUILD_DIR)
60 +
61 +# Final install directory for widgets
62 +DEST = $(OUTPUT_DIR)
63 +
64 +# Default build type for release/test builds
65 +BUILD_TYPE = RELEASE
66 +
67 +.PHONY: all help update install distclean
68 +.PHONY: clean clean-release clean-debug clean-test clean-coverage clean-all
69 +.PHONY: configure configure-release configure-debug configure-test configure-coverage
70 +.PHONY: build build-release build-debug build-test build-coverage build-all
71 +.PHONY: package package-release package-debug package-test package-coverage package-all
72 +
73 +help:
74 +       @echo "List of targets available:"
75 +       @echo ""
76 +       @echo "- all"
77 +       @echo "- help"
78 +       @echo "- clean"
79 +       @echo "- distclean"
80 +       @echo "- configure"
81 +       @echo "- build: compilation, link and prepare files for package into a widget"
82 +       @echo "- package: output a widget file '*.wgt'"
83 +       @echo "- install: install in your $(CMAKE_INSTALL_DIR) directory"
84 +       @echo ""
85 +       @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
86 +       @echo "Don't use your build dir as DEST as wgt file is generated at this location"
87 +
88 +all: package-all
89 +
90 +# Target specific variable over-rides so static pattern rules can be
91 +# used for the various type-specific targets.
92 +
93 +configure-test build-test package-test clean-test: OUTPUT_DIR = $(BUILD_DIR_TEST)
94 +
95 +configure-coverage build-coverage package-coverage clean-coverage: OUTPUT_DIR = $(BUILD_DIR_COVERAGE)
96 +configure-coverage build-coverage package-coverage: BUILD_TYPE = COVERAGE
97 +
98 +configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG)
99 +configure-debug build-debug package-debug: BUILD_TYPE = DEBUG
100 +
101 +clean-release clean-test clean-debug clean-coverage:
102 +       @if [ -d $(OUTPUT_DIR) ]; then \
103 +               $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \
104 +       else \
105 +               echo Nothing to clean; \
106 +       fi
107 +
108 +clean: clean-release
109 +
110 +clean-all: clean-release clean-test clean-debug clean-coverage
111 +
112 +distclean: clean-all
113 +
114 +configure-release configure-test configure-debug configure-coverage:
115 +       @mkdir -p $(OUTPUT_DIR)
116 +       @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \
117 +               (cd $(OUTPUT_DIR) && cmake -S $(ROOT_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) $(CONFIGURE_ARGS)); \
118 +       fi
119 +
120 +configure: configure-release
121 +
122 +build-release build-debug build-coverage: build-%: configure-%
123 +       @cmake --build $(OUTPUT_DIR) $(BUILD_ARGS) --target all
124 +
125 +# Kept for consistency, empty to avoid building everything for test widget
126 +build-test: configure-test
127 +
128 +build: build-release
129 +
130 +build-all: build-release build-debug build-test build-coverage
131 +
132 +package-release package-debug package-coverage: package-%: build-%
133 +       @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target widget
134 +       @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
135 +               mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
136 +       fi
137 +
138 +package-test: build-test
139 +       @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target test_widget
140 +       @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
141 +               mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
142 +       fi
143 +
144 +package: package-release
145 +
146 +package-all: package-release package-test package-coverage package-debug
147 +
148 +update: configure
149 +       @cmake --build $(BUILD_DIR) --target autobuild
150 +
151 +install: build
152 +       @cmake --build $(BUILD_DIR) $(INSTALL_ARGS) --target install
153 diff --git a/autobuild/linux/autobuild b/autobuild/linux/autobuild
154 new file mode 100755
155 index 0000000..16181b8
156 --- /dev/null
157 +++ b/autobuild/linux/autobuild
158 @@ -0,0 +1,128 @@
159 +#!/usr/bin/make -f
160 +# Copyright (C) 2015 - 2018 "IoT.bzh"
161 +# Copyright (C) 2020 Konsulko Group
162 +# Author "Romain Forlot" <romain.forlot@iot.bzh>
163 +#
164 +# Licensed under the Apache License, Version 2.0 (the "License");
165 +# you may not use this file except in compliance with the License.
166 +# You may obtain a copy of the License at
167 +#
168 +#       http://www.apache.org/licenses/LICENSE-2.0
169 +#
170 +# Unless required by applicable law or agreed to in writing, software
171 +# distributed under the License is distributed on an "AS IS" BASIS,
172 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
173 +# See the License for the specific language governing permissions and
174 +# limitations under the License.
175 +
176 +THISFILE  := $(lastword $(MAKEFILE_LIST))
177 +ROOT_DIR := $(abspath $(dir $(THISFILE))/../..)
178 +
179 +# Build directories
180 +# Note that the debug/test/coverage directories are defined in relation
181 +# to the release directory (BUILD_DIR), this needs to be kept in mind
182 +# if over-riding it and building those widget types, the specific widget
183 +# type variable (e.g. BUILD_DIR_DEBUG) may also need to be specified
184 +# to yield the desired output hierarchy.
185 +BUILD_DIR = $(ROOT_DIR)/build
186 +BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug)
187 +BUILD_DIR_TEST = $(abspath $(BUILD_DIR)/../build-test)
188 +BUILD_DIR_COVERAGE = $(abspath $(BUILD_DIR)/../build-coverage)
189 +
190 +# Output directory variable for use in pattern rules.
191 +# This is intended for internal use only, hence the explicit override
192 +# definition.
193 +override OUTPUT_DIR = $(BUILD_DIR)
194 +
195 +# Final install directory for widgets
196 +DEST = $(OUTPUT_DIR)
197 +
198 +# Default build type for release/test builds
199 +BUILD_TYPE = RELEASE
200 +
201 +.PHONY: all help update install distclean
202 +.PHONY: clean clean-release clean-debug clean-test clean-coverage clean-all
203 +.PHONY: configure configure-release configure-debug configure-test configure-coverage
204 +.PHONY: build build-release build-debug build-test build-coverage build-all
205 +.PHONY: package package-release package-debug package-test package-coverage package-all
206 +
207 +help:
208 +       @echo "List of targets available:"
209 +       @echo ""
210 +       @echo "- all"
211 +       @echo "- help"
212 +       @echo "- clean"
213 +       @echo "- distclean"
214 +       @echo "- configure"
215 +       @echo "- build: compilation, link and prepare files for package into a widget"
216 +       @echo "- package: output a widget file '*.wgt'"
217 +       @echo "- install: install in your $(CMAKE_INSTALL_DIR) directory"
218 +       @echo ""
219 +       @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
220 +       @echo "Don't use your build dir as DEST as wgt file is generated at this location"
221 +
222 +all: package-all
223 +
224 +# Target specific variable over-rides so static pattern rules can be
225 +# used for the various type-specific targets.
226 +
227 +configure-test build-test package-test clean-test: OUTPUT_DIR = $(BUILD_DIR_TEST)
228 +
229 +configure-coverage build-coverage package-coverage clean-coverage: OUTPUT_DIR = $(BUILD_DIR_COVERAGE)
230 +configure-coverage build-coverage package-coverage: BUILD_TYPE = COVERAGE
231 +
232 +configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG)
233 +configure-debug build-debug package-debug: BUILD_TYPE = DEBUG
234 +
235 +clean-release clean-test clean-debug clean-coverage:
236 +       @if [ -d $(OUTPUT_DIR) ]; then \
237 +               $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \
238 +       else \
239 +               echo Nothing to clean; \
240 +       fi
241 +
242 +clean: clean-release
243 +
244 +clean-all: clean-release clean-test clean-debug clean-coverage
245 +
246 +distclean: clean-all
247 +
248 +configure-release configure-test configure-debug configure-coverage:
249 +       @mkdir -p $(OUTPUT_DIR)
250 +       @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \
251 +               (cd $(OUTPUT_DIR) && cmake -S $(ROOT_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) $(CONFIGURE_ARGS)); \
252 +       fi
253 +
254 +configure: configure-release
255 +
256 +build-release build-debug build-coverage: build-%: configure-%
257 +       @cmake --build $(OUTPUT_DIR) $(BUILD_ARGS) --target all
258 +
259 +# Kept for consistency, empty to avoid building everything for test widget
260 +build-test: configure-test
261 +
262 +build: build-release
263 +
264 +build-all: build-release build-debug build-test build-coverage
265 +
266 +package-release package-debug package-coverage: package-%: build-%
267 +       @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target widget
268 +       @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
269 +               mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
270 +       fi
271 +
272 +package-test: build-test
273 +       @cmake --build $(OUTPUT_DIR) $(PACKAGE_ARGS) --target test_widget
274 +       @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \
275 +               mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \
276 +       fi
277 +
278 +package: package-release
279 +
280 +package-all: package-release package-test package-coverage package-debug
281 +
282 +update: configure
283 +       @cmake --build $(BUILD_DIR) --target autobuild
284 +
285 +install: build
286 +       @cmake --build $(BUILD_DIR) $(INSTALL_ARGS) --target install