Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ci

on:
push:
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
with:
buildx-version: latest
qemu-version: latest

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Run Buildx
run: |
docker buildx build \
--platform linux/arm/v7 \
--load \
-t "screenly-ose-webview-builder" \
--file Dockerfile .

- name: Make artifacts folder
run: mkdir -p artifacts

- name: Run webviewer build
run: |
docker run \
-v $(pwd)/artifacts:/build \
screenly-ose-webview-builder build.sh

- uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: artifacts
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

28 changes: 22 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
FROM resin/rpi-raspbian:stretch
MAINTAINER Anton Molodykh <amolodykh@screenly.io>
FROM balenalib/rpi-raspbian:buster

RUN echo "deb-src http://archive.raspberrypi.org/debian buster main ui" >> /etc/apt/sources.list.d/raspi.list
RUN echo "deb-src http://archive.raspbian.org/raspbian buster main contrib non-free rpi firmware" >> /etc/apt/sources.list

RUN apt-get update && \
apt-get -y install \
apt-get -y install --no-install-recommends \
build-essential \
freetds-dev \
g++ \
git \
libinput-dev \
libqt5gui5 \
libqt5webkit5-dev \
libqt5x11extras5-dev \
libraspberrypi0 \
libraspberrypi-dev \
libts-dev \
libudev-dev \
libxcb-xinerama0 \
libxcb-xinerama0-dev \
make && \
apt-get build-dep libqt5gui5 && \
apt-get clean

WORKDIR /Screenly-webview

CMD ["bash", "build.sh"]
WORKDIR /build

RUN mkdir /src
COPY build_qtbase.sh /usr/local/bin/
COPY build.sh /usr/local/bin/
COPY . /src
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
# ScreenlyOSE-WebView

[![Build Status](https://travis-ci.org/Screenly/screenly-ose-webview.svg?branch=master)](https://travis-ci.org/Screenly/screenly-ose-webview)
# Screenly OSE WebView

## Building

Before building, you need to install the following packages:

```
libqt5webkit5-dev
gstreamer1.0-plugins-good
libdbus-glib-1-dev
```

Building:
The build process depends on cross compiling on Docker. You may need to enable the `buildx` functionality.

Build the docker container:
```
qmake
make
make install
$ docker buildx build \
--platform linux/arm/v6,linux/arm/v7 \
--load \
-t screenly/screenly-webview-build \
-f Dockerfile .
```

You can change the folder to build:

Build the actual web view
```
export PREFIX=/home/pi/webview_build/
$ docker run --rm \
-v $(pwd):/build \
screenly/screenly-webview-build
build.sh
```

Besides, you need to copy `res` folder to `/usr/local/bin/ScreenlyWebview/res`


To prepare for a release, use the docker container:

Build out the QT Base
```
$ docker run --rm \
-e VERSION=*version* \
-v $(pwd):/Screenly-webview \
-v $(pwd):/build \
screenly/screenly-webview-build
build_qtbase.sh
```

Note that this is done automatically on GitHub Actions, so there is usually no need to build this locally.

## Usage

DBus is used for communication.
Expand Down
10 changes: 8 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- sh-basic-offset: 4 -*-
set -euo pipefail

cd /src
/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake
make
make -j "$(nproc --all)"
make install
tar -zcvf "screenly-webview-${VERSION}.tar.gz" res ScreenlyWebview

tar -zcvf "/build/screenly-webview.tar.gz" res ScreenlyWebview
173 changes: 109 additions & 64 deletions build_qtbase.sh
Original file line number Diff line number Diff line change
@@ -1,69 +1,114 @@
#!/bin/bash -x

sudo sed -i -e 's/#deb-src/deb-src/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y build-dep libqt5gui5
sudo apt-get -y build-dep qt4-x11
sudo apt-get -y install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0

QT_FOLDER_1=/home/pi/src/qt5/pi_1 # For pi 1 and pi zero
QT_FOLDER_2=/home/pi/src/qt5/pi_2 # For pi 2
QT_FOLDER_3=/home/pi/src/qt5/pi_3 # For pi 3

set -x

if [ ! -d "$QT_FOLDER_1" ]; then
mkdir $QT_FOLDER_1
cd $QT_FOLDER_1
git clone git://code.qt.io/qt/qtbase.git -b 5.9
cd qtbase
./configure -release -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -release -make libs -prefix /usr/local/qt5pi -extprefix $QT_FOLDER_1/qt5pi -no-use-gold-linker
else
cd $QT_FOLDER_1/qtbase
fi
#!/bin/bash

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- sh-basic-offset: 4 -*-

set -euo pipefail

QT_PI_1=/src/qt5/pi_1 # For Pi 1 and Pi Zero
QT_PI_2=/src/qt5/pi_2 # For Pi 2
QT_PI_3=/src/qt5/pi_3 # For Pi 3
BUILD_TARGET=/build
QT_BRANCH="5.12"

mkdir -p "$BUILD_TARGET"

echo "Building QT Base version $QT_BRANCH."

if [ ! -f "$BUILD_TARGET/qtbase-pi1.tar.gz" ]; then
echo "Building QT Base for Pi 1"
mkdir -p "$QT_PI_1"
cd "$QT_PI_1"
git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH"
cd qtbase

# Patch QT as per https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
sed -i 's/-lEGL/-lbrcmEGL/' mkspecs/devices/linux-rasp-pi-g++/qmake.conf
sed -i 's/-lGLESv2/-lbrcmGLESv2/' mkspecs/devices/linux-rasp-pi-g++/qmake.conf

./configure \
-release \
-opengl es2 \
-device linux-rasp-pi-g++ \
-device-option CROSS_COMPILE=/usr/bin/ \
-opensource \
-confirm-license \
-make libs \
-prefix /usr/local/qt5pi \
-extprefix $QT_PI_1/qt5pi \
-no-use-gold-linker

make -j 4
make install
cp -r /usr/share/fonts/truetype/dejavu/ $QT_FOLDER_1/qt5pi/lib/fonts
cd $QT_FOLDER_1
tar -zcvf /home/pi/qtbase-pi1.tar.gz qt5pi
cd /home/pi
echo $(md5sum qtbase-pi1.tar.gz) > qtbase-pi1.tar.gz.md5


if [ ! -d "$QT_FOLDER_2" ]; then
mkdir $QT_FOLDER_2
cd $QT_FOLDER_2
git clone git://code.qt.io/qt/qtbase.git -b 5.9
cd qtbase
./configure -release -opengl es2 -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -release -make libs -prefix /usr/local/qt5pi -extprefix $QT_FOLDER_2/qt5pi -no-use-gold-linker
else
cd $QT_FOLDER_2/qtbase
make -j "$(nproc --all)"
make install
cp -r /usr/share/fonts/truetype/dejavu/ "$QT_PI_1/qt5pi/lib/fonts"
cd "$QT_PI_1"
tar -zcvf $BUILD_TARGET/qtbase-pi1.tar.gz qt5pi
cd "$BUILD_TARGET"
sha256sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.sha256
fi

make -j 4
make install
cp -r /usr/share/fonts/truetype/dejavu/ $QT_FOLDER_2/qt5pi/lib/fonts
cd $QT_FOLDER_2
tar -zcvf /home/pi/qtbase-pi2.tar.gz qt5pi
cd /home/pi
echo $(md5sum qtbase-pi2.tar.gz) > qtbase-pi2.tar.gz.md5


if [ ! -d "$QT_FOLDER_3" ]; then
mkdir $QT_FOLDER_3
cd $QT_FOLDER_3
git clone git://code.qt.io/qt/qtbase.git -b 5.9
cd qtbase
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -release -make libs -prefix /usr/local/qt5pi -extprefix $QT_FOLDER_3/qt5pi -no-use-gold-linker
else
cd $QT_FOLDER_3/qtbase

if [ ! -f "$BUILD_TARGET/qtbase-pi2.tar.gz" ]; then
echo "Building QT Base for Pi 2"
mkdir -p "$QT_PI_2"
cd "$QT_PI_2"
git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH"
cd qtbase

# Patch QT as per https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
sed -i 's/-lEGL/-lbrcmEGL/' mkspecs/devices/linux-rasp-pi2-g++/qmake.conf
sed -i 's/-lGLESv2/-lbrcmGLESv2/' mkspecs/devices/linux-rasp-pi2-g++/qmake.conf

./configure \
-release \
-opengl es2 \
-device linux-rasp-pi2-g++ \
-device-option CROSS_COMPILE=/usr/bin/ \
-opensource \
-confirm-license \
-make libs \
-prefix /usr/local/qt5pi \
-extprefix "$QT_PI_2/qt5pi" \
-no-use-gold-linker

make -j "$(nproc --all)"
make install
cp -r /usr/share/fonts/truetype/dejavu/ "$QT_PI_2/qt5pi/lib/fonts"
cd "$QT_PI_2"
tar -zcvf "$BUILD_TARGET/qtbase-pi2.tar.gz" qt5pi
cd "$BUILD_TARGET"
sha256sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.sha256
fi

make -j 4
make install
cp -r /usr/share/fonts/truetype/dejavu/ $QT_FOLDER_3/qt5pi/lib/fonts
cd $QT_FOLDER_3
tar -zcvf /home/pi/qtbase-pi3.tar.gz qt5pi
cd /home/pi
echo $(md5sum qtbase-pi3.tar.gz) > qtbase-pi3.tar.gz.md5
if [ ! -f "$BUILD_TARGET/qtbase-pi3.tar.gz" ]; then
echo "Building QT Base for Pi 3"
mkdir -p $QT_PI_3
cd "$QT_PI_3"
git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH"
cd qtbase

# Patch QT as per https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
sed -i 's/-lEGL/-lbrcmEGL/' mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
sed -i 's/-lGLESv2/-lbrcmGLESv2/' mkspecs/devices/linux-rasp-pi3-g++/qmake.conf

./configure \
-release \
-opengl es2 \
-device linux-rasp-pi3-g++ \
-device-option CROSS_COMPILE=/usr/bin/ \
-opensource \
-confirm-license \
-release \
-make libs \
-prefix /usr/local/qt5pi \
-extprefix "$QT_PI_3/qt5pi" \
-no-use-gold-linker

make -j "$(nproc --all)"
make install
cp -r /usr/share/fonts/truetype/dejavu/ "$QT_PI_3/qt5pi/lib/fonts"
cd "$QT_PI_3"
tar -zcvf "$BUILD_TARGET/qtbase-pi3.tar.gz" qt5pi
cd "$BUILD_TARGET"
sha256sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.sha256
fi