5 Applications based on the AGL framework should have a
6 full build and packaging solution that is independent of the
7 [Yocto Project](https://www.yoctoproject.org) workflow.
9 You can create a script named **autobuild** to control applications
11 AGL provides a BitBake class file (`aglwgt.bbclass`) that calls the
12 **autobuild** script for all operations.
13 The class file is located at the top level of the application repository.
15 You can write the **autobuild** script using any of the following languages:
21 The script executes directly after applying a `chmod()` command.
22 The caller, which can be the `aglwgt.bbclass`, a Jenkins job, or an actual person,
23 must make the **autobuild** executable before calling it.
24 To facilitate direct execution, you need to start the script with a
25 [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) sequence:
27 * '#!/usr/bin/make -f' for Makefile format
28 * '#!/usr/bin/bash' for Bash format
30 The calling convention is similar to the convention used in `make`.
31 To pass arguments, use environment variables.
33 **NOTE:** For Bash, an evaluation of the arguments
34 sets the environment variables correctly.
36 The following format shows the generic call:
39 autobuild/agl/autobuild <command> [ARG1="value1" [ARG2="value2" ... ]]
42 The **autobuild** script can be invoked from any directory
43 with all paths considered to be relative to the
45 For makefile scripts, this is the usual behavior.
46 For Bash scripts, a `cd $(dirname $0)` command must be run at
47 the beginning of the script.
49 At build time, the following calls must be made in the following order:
51 1. Initialize the build environment (e.g if the application uses
52 `cmake` the configure step runs CMake).
55 autobuild/agl/autobuild configure CONFIGURE_ARGS="..."
58 2. Build the application (i.e. compile, link binaries, assembles javascript,
62 autobuild/agl/autobuild build BUILD_ARGS="...."
65 3. Create the widget package(s) in the specified destination path
66 prepared by the caller.
69 autobuild/agl/autobuild package PACKAGE_ARGS="..." DEST=<path-for-resulting-wgt-files>
72 4. Create the test widget package(s) in the specified destination path
73 prepared by the caller.
76 autobuild/agl/autobuild package-test PACKAGE_ARGS="..." DEST=<path-for-resulting-wgt-files>
79 5. Clean the built files by removing the result of the **autobuild** build.
82 autobuild/agl/autobuild clean CLEAN_ARGS="..."
85 6. Clean everything by removing the result of the **autobuild** build
86 and the **autobuild** configure.
89 autobuild/agl/autobuild distclean DISTCLEAN_ARGS="..."
92 ## Integrating **autobuild** into the Yocto Project Workflow
94 If you want to integrate the **autobuild** script into the Yocto Project
95 workflow, you need to generate the script.
96 To generate the script, use the `autobuild` target.
98 The following commands create the **autobuild** script in the
99 `autobuild/agl` directory:
104 cmake .. && make autobuild
109 Following are the targets available from the **autobuild** script:
111 - **clean**: Removes all the object files and target results generated by Makefile.
112 - **clean-{release,debug,coverage,test}**: Removes all the object files and target results generated by Makefile for the specified build type.
113 - **clean-all**: Deletes the build directories for all build types.
114 - **distclean**: Deletes the build directories for all build types.
115 - **configure**: Generates the project Makefile from the `CMakeLists.txt` files for the release build type.
116 - **configure-{release,debug,coverage,test}**: Generates the project Makefile from the `CMakeLists.txt` files for the specified build type.
117 - **build**: Compiles all project targets for the release build type.
118 - **build-{release,debug,coverage,test}**: Compiles all project targets for the specified build type.
119 - **build-all**: Compiles all project targets for all specified build types.
120 - **package**: Builds the widget (**wgt**) package for the release build type.
121 - **package-{release,debug,coverage}**: Builds the widget (**wgt**) package for the specified build type.
122 - **package-test**: Builds the test **wgt** package.
123 - **package-all**: Builds the widget (**wgt**) packages for all build types.
124 - **install**: Installs the project into your filesystem.
126 Note that `aglwgt.bbclass` only will use the **package-{coverage,test}** targets (and thus the **build-{coverage,test}**, etc. targets) for service bindings by default, so **autobuild** scripts for applications may omit support for those.
128 Specifying the following variables lets you modify compilation behavior:
130 - **CLEAN_ARGS**: Variable used at **clean** time.
131 - **CONFIGURE_ARGS**: Variable used at **configure** time.
132 - **BUILD_ARGS**: Variable used at **build** time.
133 - **BUILD_DIR**: Build directory for release type build.
134 The default value is a "build" directory in the root of the project.
135 - **BUILD_DIR_DEBUG**: Build directory for debug type build.
136 The default value is a "build-debug" directory in the root of the project.
137 - **BUILD_DIR_TEST**: Build directory for test type build.
138 The default value is a "build-test" directory in the root of the project.
139 - **BUILD_DIR_COVERAGE**: Build directory for coverage type build.
140 The default value is a "build-coverage" directory in the root of the project.
141 - **DEST**: Directory in which to place the created ***wgt*** file(s).
142 The default directory is the build root directory.
144 Note that the values of **BUILD_DIR_{DEBUG,TEST,COVERAGE}** are defined based on the value of **BUILD_DIR**, so this needs to be kept in mind if over-riding it and building those other widget types.
146 When you provide a variable, use the CMake format (i.e.
147 BUILD_ARGS="-DC_FLAGS='-g -O2'").
148 Following is an example:
151 ./autobuild/agl/autobuild package DEST=/tmp