-
-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: write scripts for building a Pi 5 WebView (#2164)
- Loading branch information
1 parent
c101927
commit 389f1cc
Showing
5 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
builder: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile.pi5 | ||
environment: | ||
- GIT_HASH=${GIT_HASH} | ||
tty: true | ||
stdin_open: true | ||
volumes: | ||
- "~/tmp-pi5/build:/build:Z" | ||
- "./examples:/src/examples" | ||
- "./:/webview:ro" | ||
- "./scripts/build_pi5_webview.sh:/scripts/build_pi5_webview.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# vim:ft=dockerfile | ||
|
||
FROM balenalib/raspberrypi5-debian:bookworm | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Build dependencies for the Qt 6 app | ||
RUN apt-get -y update && apt-get install -y \ | ||
build-essential \ | ||
cmake \ | ||
qt6-base-dev \ | ||
qt6-webengine-dev | ||
|
||
RUN mkdir -p /scripts /src | ||
|
||
WORKDIR /build | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Building WebView for Raspberry Pi 5 | ||
|
||
## Prerequisites | ||
|
||
> [!NOTE] | ||
> At this time, you can only build the WebView from a Raspberry Pi 5 device. | ||
> You need to have the following installed and set up on your Raspberry Pi 5: | ||
> - Docker (arm64) | ||
> - Code editor of your choice (e.g., Visual Studio Code, Neovim, etc.) | ||
## Building the WebView | ||
|
||
Clone the repository: | ||
|
||
```bash | ||
$ git clone https://github.com/Screenly/Anthias.git | ||
``` | ||
|
||
Navigate to the `webview` directory: | ||
|
||
```bash | ||
$ cd /path/to/Anthias/webview | ||
``` | ||
|
||
Start the builder container with the following command: | ||
|
||
```bash | ||
docker compose -f docker-compose.pi5.yml up -d --build | ||
``` | ||
|
||
You should now be able to invoke a run executing either of the following commands: | ||
|
||
```bash | ||
$ docker compose -f docker-compose.pi5.yml exec builder /webview/build_pi5.sh | ||
``` | ||
|
||
```bash | ||
$ docker compose -f docker-compose.pi5.yml exec builder bash | ||
|
||
# Once you're in the container, run the following command: | ||
$ /scripts/build_pi5_webview.sh | ||
``` | ||
|
||
The resulting files will be placed in `~/tmp-pi5/build/release`. | ||
|
||
When you're done, you can stop and remove the container with the following commands: | ||
|
||
```bash | ||
$ docker compose -f docker-compose.pi5.yml down | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
DEBIAN_VERSION='bookworm' | ||
QT_MAJOR='6' | ||
QT_MINOR='4' | ||
QT_PATCH='2' | ||
QT_VERSION="${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}" | ||
CORE_COUNT="$(expr $(nproc) - 2)" | ||
|
||
function create_webview_archive() { | ||
local ARCHIVE_NAME="webview-${QT_VERSION}-${DEBIAN_VERSION}-pi5-$GIT_HASH.tar.gz" | ||
local ARCHIVE_DESTINATION="/build/release/${ARCHIVE_NAME}" | ||
|
||
mkdir -p /build/release | ||
|
||
cp -rf /webview /build | ||
cd /build/webview | ||
qmake6 | ||
make -j${CORE_COUNT} | ||
make install | ||
|
||
mkdir -p fakeroot/bin fakeroot/share/ScreenlyWebview | ||
mv ScreenlyWebview fakeroot/bin/ | ||
cp -rf /webview/res fakeroot/share/ScreenlyWebview/ | ||
|
||
cd fakeroot | ||
|
||
tar cfz ${ARCHIVE_DESTINATION} . | ||
cd /build/release | ||
sha256sum ${ARCHIVE_NAME} > ${ARCHIVE_DESTINATION}.sha256 | ||
} | ||
|
||
create_webview_archive |