# Building, testing and publishing ## What you need | For | Install | | --- | --- | | the native service | the [openlgtv buildroot NDK](https://github.com/openlgtv/buildroot-nc4/releases) — or Docker, see below | | packaging | `npm install` (ares-cli), or `npm install -g @webosose/ares-cli` | | the tests | a host C compiler, Python 3, Node (optional: `flatbuffers`, `jsdom`) | ### The toolchain The NDK is a **Linux** toolchain — there is no macOS or Windows build of it. On Linux, unpack and relocate it once: ```sh tar xf arm-webos-linux-gnueabi_sdk-buildroot-x86_64.tar.gz -C "$HOME" "$HOME/arm-webos-linux-gnueabi_sdk-buildroot/relocate-sdk.sh" ``` Everywhere else, build the native part in a container: ```sh ./tools/docker-build.sh # -> build/native/audiocap-service ``` That bakes the SDK into an image, so it downloads once and later builds start immediately. There are aarch64 and x86_64 SDK builds and the image picks whichever matches the container, so on Apple Silicon it runs natively rather than under emulation. Only the compile happens in the container; packaging and deployment run on the host, where the TV is reachable. Register the TV with ares once, using the Homebrew Channel's ssh (port 9922, root): ```sh ares-setup-device --add tv \ --info "{'host':'192.168.1.20','port':9922,'username':'root'}" ``` ## Build and deploy ```sh ./tools/build.sh # cross-compile, stage, package -> out/*.ipk ./tools/build.sh install # ares-install on device "tv" ./tools/build.sh launch ./tools/build.sh logs ``` With the container toolchain it is two steps, since `build.sh` only knows how to drive a local NDK: ```sh ./tools/docker-build.sh && ./tools/build.sh package ``` `DEVICE=livingroom ./tools/build.sh install` targets a different device; `WEBOS_SDK=/opt/webos-sdk ./tools/build.sh` a differently placed NDK. The same commands exist as npm scripts (`npm run build`, `npm run deploy`, …) if that is more your habit. `build.sh` puts `node_modules/.bin` on PATH first, so a local `npm install` of ares-cli is enough — no global install needed. ### What the packaging step does `ares-package` takes two directories: ```text build/stage/app frontend/, minus js/mock.js and its