From 79f04903741408cb03d05b0c43bb6e5b0e8cf18c Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 11:41:21 +0000 Subject: [PATCH 01/13] WIP - overhaul build process --- .github/workflows/ci.yaml | 21 +++++++ Dockerfile | 21 +++++-- README.md | 29 ++------- build.sh | 8 ++- build_qtbase.sh | 121 ++++++++++++++++++++++---------------- 5 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1071633 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,21 @@ +name: ci + +on: + push: + +jobs: + buildx: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true + - + name: Build + run: | + docker build --platform linux/arm/v7 . # will run buildx diff --git a/Dockerfile b/Dockerfile index 17d1930..58338b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,28 @@ -FROM resin/rpi-raspbian:stretch -MAINTAINER Anton Molodykh +FROM balenalib/rpi-raspbian:buster +RUN sed -i -e 's/#deb-src/deb-src/' /etc/apt/sources.list RUN apt-get update && \ apt-get -y install \ build-essential \ g++ \ + git \ + libinput-dev \ + libqt5gui5 \ libqt5webkit5-dev \ + libqt5x11extras5-dev \ + libts-dev \ + libudev-dev \ + libxcb-xinerama0 \ + libxcb-xinerama0-dev \ make && \ apt-get clean -WORKDIR /Screenly-webview +WORKDIR /build -CMD ["bash", "build.sh"] +RUN mkdir /src +COPY build_qtbase.sh /usr/local/bin/ +COPY build.sh /usr/local/bin/ +COPY . /src +RUN build_qtbase.sh +RUN build.sh diff --git a/README.md b/README.md index cad4c2d..db9522c 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,19 @@ -# 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 -``` +You can build the release locally by running: -Building: -``` -qmake -make -make install -``` -You can change the folder to build: +To prepare for a release, use the docker container: ``` -export PREFIX=/home/pi/webview_build/ +$ docker buildx build \ + --platform linux/arm/v7 \ + -t screenly/screenly-webview-build . ``` -Besides, you need to copy `res` folder to `/usr/local/bin/ScreenlyWebview/res` - - -To prepare for a release, use the docker container: - ``` $ docker run --rm \ -e VERSION=*version* \ diff --git a/build.sh b/build.sh index bacaf4f..3bc947f 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,8 @@ -#!/bin/bash +#!/bin/bash -ex +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 diff --git a/build_qtbase.sh b/build_qtbase.sh index 32d077f..989e833 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -1,69 +1,90 @@ -#!/bin/bash -x +#!/bin/bash -ex -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_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 +QT_PI_4=/src/qt5/pi_4 # For Pi 4 +BUILD_TARGET=/build +QT_BRANCH="5.9" -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 +mkdir -p "$BUILD_TARGET" -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 +if [ ! -d "$QT_PI_1" ]; then + mkdir -p "$QT_PI_1" + cd "$QT_PI_1" + git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" 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 + ./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 fi -make -j 4 +make -j "$(nproc --all)" 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 +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" +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 +if [ ! -d "$QT_PI_2" ]; then + mkdir -p "$QT_PI_2" + cd "$QT_PI_2" + git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" 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 + ./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 fi -make -j 4 +make -j "$(nproc --all)" 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 +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" +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 +if [ ! -d "$QT_PI_3" ]; then + mkdir -p $QT_PI_3 + cd "$QT_PI_3" + git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" 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 + ./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 fi -make -j 4 +make -j "$(nproc --all)" 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 +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" +md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 From b334e3013c77db38b78c606f40ed3e4621c9181d Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 11:56:07 +0000 Subject: [PATCH 02/13] Fixes to build flow --- .github/workflows/ci.yaml | 17 ++++++++++++----- .travis.yml | 22 ---------------------- Dockerfile | 2 +- 3 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1071633..5b686c2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,6 @@ name: ci on: push: - jobs: buildx: runs-on: ubuntu-latest @@ -11,11 +10,19 @@ jobs: name: Checkout uses: actions/checkout@v2 - - uses: docker/setup-buildx-action@v1 + name: Set up Docker Buildx id: buildx + uses: crazy-max/ghaction-docker-buildx@v3 with: - install: true + buildx-version: latest + qemu-version: latest + - + name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} - - name: Build + name: Run Buildx run: | - docker build --platform linux/arm/v7 . # will run buildx + docker buildx build \ + --platform linux/arm/v6,linux/arm/v7 \ + --output "type=image,push=false" \ + --file ./test/Dockerfile ./test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eeab62d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: cpp -sudo: required -services: - - docker - -script: - - "/bin/true" - -before_deploy: - - docker run --rm --privileged multiarch/qemu-user-static:register --reset - - docker build . -t screenly/screenly-webview-build - - docker run --rm -t --name screenly-webview-build -e VERSION=$TRAVIS_TAG -v $TRAVIS_BUILD_DIR:/Screenly-webview screenly/screenly-webview-build - -deploy: - provider: releases - api_key: - secure: uNFv3HpZEr6HIPBxD0KJnoEtS0uGcIP1z0mOXn0VbQxKrSIX9D2W1QZ40+u9wV8viEOgcL7c2o9UD4kFY3jLG3sjdUVWhoZ0hkb2QKbGUQp66gf3mRm1VWjwHHyd4E5sZEByrn4DksFMWoaD7S5QDWmacpgTfY2GQ1KVHB+dCzSGU++ejTIaDWgeKguXc1u9mH3/XbSfFdh3MwlG9zwH7CRJa761FmVzn7G5q/4JiHzeGFuOVPo/u0JfpO70Ctgt4UVNLhi+hpz6O6Hg+Zpp6O913rv040653PQjr7mFQZtSPAYmrO98Qu2SVdOd7BKRWESA/dP+n3FNDBstvJQWdwM+Ivy6szhgbRVyRq9xTcUrJibZe8CMEaRuMR2cLPKmgs+XNuMm4AzsfEmyzlsHfsHB108+uJFUPNleXBYVdvA1tn7z7SIT8dc1QgTcJi9wf1gS2Xu3xqqKJZYIlyrXIFJt0jzN93UktrmOdf5I7jHV9BdIpQbRwU31vrF2hnjg3BxmGzDeA2xS+UEnJNk8JT3SxaYwSIjea/ZNDJ8VlxXi9hN9PuVeXJ9/bvwypfUqVFgAdrM/84TIj6c/KNSDaUvQD6odhmR8zbw1aERSi+tSO2ECPxGfpbbvcqPoTekVgYLCXMqLjlp/BWAzzwL2o/oYB/5fnfkvEcGRSiMkovk= - file: screenly-webview-${TRAVIS_TAG}.tar.gz - skip_cleanup: true - on: - repo: Screenly/screenly-ose-webview - tags: true diff --git a/Dockerfile b/Dockerfile index 58338b8..d3a4ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM balenalib/rpi-raspbian:buster RUN sed -i -e 's/#deb-src/deb-src/' /etc/apt/sources.list RUN apt-get update && \ - apt-get -y install \ + apt-get -y install --no-install-recommends \ build-essential \ g++ \ git \ From 9f5fcff0ec369120a49376a9d683104e4609f01e Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 11:57:14 +0000 Subject: [PATCH 03/13] Fixes paths --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5b686c2..eee7bed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,4 +25,4 @@ jobs: docker buildx build \ --platform linux/arm/v6,linux/arm/v7 \ --output "type=image,push=false" \ - --file ./test/Dockerfile ./test + --file .Dockerfile . From 66a8e1a07ff01c491070c511cd6ab3e96e857a25 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 11:58:19 +0000 Subject: [PATCH 04/13] Yet another path fix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eee7bed..d508065 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,4 +25,4 @@ jobs: docker buildx build \ --platform linux/arm/v6,linux/arm/v7 \ --output "type=image,push=false" \ - --file .Dockerfile . + --file Dockerfile . From 984d03eb144975a20942c30600ab2327ff3ff732 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 16:16:43 +0000 Subject: [PATCH 05/13] Build fixes --- build_qtbase.sh | 150 +++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 71 deletions(-) diff --git a/build_qtbase.sh b/build_qtbase.sh index 989e833..52c99bd 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -1,4 +1,9 @@ -#!/bin/bash -ex +#!/bin/bash -e + +# 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 @@ -9,82 +14,85 @@ QT_BRANCH="5.9" mkdir -p "$BUILD_TARGET" -if [ ! -d "$QT_PI_1" ]; then - mkdir -p "$QT_PI_1" - cd "$QT_PI_1" - git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" - cd qtbase - ./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 +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 + ./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 "$(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" + md5sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.md5 fi -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" -md5sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.md5 +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 + ./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 -if [ ! -d "$QT_PI_2" ]; then - mkdir -p "$QT_PI_2" - cd "$QT_PI_2" - git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" - cd qtbase - ./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" + md5sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.md5 fi -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" -md5sum qtbase-pi2.tar.gz > qtbase-pi2.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 + ./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 -if [ ! -d "$QT_PI_3" ]; then - mkdir -p $QT_PI_3 - cd "$QT_PI_3" - git clone git://code.qt.io/qt/qtbase.git -b "$QT_BRANCH" - 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_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" + md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 fi -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" -md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 From 22044785d15401f72d75320470d04bd7e9e07875 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 17:24:35 +0000 Subject: [PATCH 06/13] More build tweaks --- .github/workflows/ci.yaml | 9 ++- Dockerfile | 3 - build.sh | 19 +++-- build_qtbase.sh | 160 ++++++++++++++++++++------------------ 4 files changed, 104 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d508065..c6d8439 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,5 +24,12 @@ jobs: run: | docker buildx build \ --platform linux/arm/v6,linux/arm/v7 \ - --output "type=image,push=false" \ + -t "screenly-ose-webview-builder" \ + --output "type=image,push=false,load=true" \ --file Dockerfile . + - + name: Run webviewer build + run: | + docker run \ + -v $(pwd):/build \ + screenly-ose-webview-builder build.sh diff --git a/Dockerfile b/Dockerfile index d3a4ce3..f2c324e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,3 @@ RUN mkdir /src COPY build_qtbase.sh /usr/local/bin/ COPY build.sh /usr/local/bin/ COPY . /src - -RUN build_qtbase.sh -RUN build.sh diff --git a/build.sh b/build.sh index 3bc947f..d8d4af2 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,15 @@ -#!/bin/bash -ex +#!/bin/bash -cd /src -/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake -make -j "$(nproc --all)" -make install +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# -*- sh-basic-offset: 4 -*- -tar -zcvf "/build/screenly-webview.tar.gz" res ScreenlyWebview +# Only build on ARMv7 +if [ "$(arch)" = "armv7l" ]; then + + cd /src + /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake + make -j "$(nproc --all)" + make install + + tar -zcvf "/build/screenly-webview.tar.gz" res ScreenlyWebview +fi diff --git a/build_qtbase.sh b/build_qtbase.sh index 52c99bd..e09542a 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -1,98 +1,104 @@ -#!/bin/bash -e +#!/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_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 -QT_PI_4=/src/qt5/pi_4 # For Pi 4 BUILD_TARGET=/build QT_BRANCH="5.9" mkdir -p "$BUILD_TARGET" -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 - ./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 +# For ARMv6 +if [ "$(arch)" = "armv6l" ]; then + 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 + ./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 "$(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" + md5sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.md5 + fi - 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" - md5sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.md5 fi +# For ARMv7 +if [ "$(arch)" = "armv7l" ]; then -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 - ./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 + 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 + ./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" - md5sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.md5 -fi + 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" + md5sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.md5 + fi -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 - ./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 + 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 + ./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" - md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 + 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" + md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 + fi fi - From fdf0aa140e06aa9a20047288b1e60c2c7d48e73a Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 17:30:44 +0000 Subject: [PATCH 07/13] Fixes build steps..hopfully --- .github/workflows/ci.yaml | 3 ++- README.md | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c6d8439..eaaf463 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,9 @@ jobs: run: | docker buildx build \ --platform linux/arm/v6,linux/arm/v7 \ + --load \ -t "screenly-ose-webview-builder" \ - --output "type=image,push=false,load=true" \ + --output "type=image,push=false" \ --file Dockerfile . - name: Run webviewer build diff --git a/README.md b/README.md index db9522c..8e3677e 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,34 @@ ## Building -You can build the release locally by running: - - - -To prepare for a release, use the docker container: +The build process depends on cross compiling on Docker. You may need to enable the `buildx` functionality. +Build the docker container: ``` $ docker buildx build \ - --platform linux/arm/v7 \ - -t screenly/screenly-webview-build . + --platform linux/arm/v6,linux/arm/v7 \ + --load \ + -t screenly/screenly-webview-build \ + -f Dockerfile . ``` +Build the actual web view ``` $ docker run --rm \ - -e VERSION=*version* \ - -v $(pwd):/Screenly-webview \ + -v $(pwd):/build \ screenly/screenly-webview-build + build.sh +``` + +Build out the QT Base ``` +$ docker run --rm \ + -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 From 1a8131077827e6d194a269ea3f281b63e76871d9 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 17:35:10 +0000 Subject: [PATCH 08/13] More build attempts --- .github/workflows/ci.yaml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eaaf463..d76de68 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,31 +6,37 @@ jobs: buildx: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2 - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx id: buildx uses: crazy-max/ghaction-docker-buildx@v3 with: buildx-version: latest qemu-version: latest - - - name: Available platforms + + - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} - - - name: Run Buildx + + - name: Run Buildx run: | docker buildx build \ --platform linux/arm/v6,linux/arm/v7 \ --load \ -t "screenly-ose-webview-builder" \ - --output "type=image,push=false" \ --file Dockerfile . - - - name: Run webviewer build + + - name: Make artifacts folder + run: mkdir -p artifacts + + - name: Run webviewer build run: | docker run \ - -v $(pwd):/build \ + -v $(pwd)/artifacts:/build \ screenly-ose-webview-builder build.sh + + - uses: actions/upload-artifact@v2 + with: + name: build-artifacts + path: artifacts From 92276a966b924537770c3c85b1cb836cedb5e339 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 18:23:05 +0000 Subject: [PATCH 09/13] We can't comibine multiple --platform and --load apparently --- .github/workflows/ci.yaml | 2 +- build_qtbase.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d76de68..3ca1c7e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: - name: Run Buildx run: | docker buildx build \ - --platform linux/arm/v6,linux/arm/v7 \ + --platform linux/arm/v7 \ --load \ -t "screenly-ose-webview-builder" \ --file Dockerfile . diff --git a/build_qtbase.sh b/build_qtbase.sh index e09542a..fd0ff5c 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -9,10 +9,12 @@ 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.9" +QT_BRANCH="5.15" mkdir -p "$BUILD_TARGET" +echo "Building QT Base version $QT_BRANCH." + # For ARMv6 if [ "$(arch)" = "armv6l" ]; then if [ ! -f "$BUILD_TARGET/qtbase-pi1.tar.gz" ]; then From 2f416b913d1f0103fd99b42c8b1fed2bb7aa9aae Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Tue, 10 Nov 2020 18:40:25 +0000 Subject: [PATCH 10/13] removes hybrid build. --- build.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index d8d4af2..fb244c5 100755 --- a/build.sh +++ b/build.sh @@ -2,14 +2,11 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # -*- sh-basic-offset: 4 -*- +set -euo pipefail -# Only build on ARMv7 -if [ "$(arch)" = "armv7l" ]; then +cd /src +/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake +make -j "$(nproc --all)" +make install - cd /src - /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake - make -j "$(nproc --all)" - make install - - tar -zcvf "/build/screenly-webview.tar.gz" res ScreenlyWebview -fi +tar -zcvf "/build/screenly-webview.tar.gz" res ScreenlyWebview From 9b047a4c3f214aee7f1e8161f5dd9ef2c74ce926 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Fri, 13 Nov 2020 12:01:07 +0000 Subject: [PATCH 11/13] More dependency fixes --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f2c324e..a6405e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,25 @@ FROM balenalib/rpi-raspbian:buster -RUN sed -i -e 's/#deb-src/deb-src/' /etc/apt/sources.list +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 --no-install-recommends \ build-essential \ + freetds-dev \ g++ \ git \ libinput-dev \ libqt5gui5 \ libqt5webkit5-dev \ libqt5x11extras5-dev \ + libraspberrypi0 \ libts-dev \ libudev-dev \ libxcb-xinerama0 \ libxcb-xinerama0-dev \ make && \ + apt-get build-dep libqt5gui5 && \ apt-get clean WORKDIR /build From 298f5c89c6d7d3eb5608cf9c6377150ff40929f7 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Fri, 13 Nov 2020 17:35:55 +0000 Subject: [PATCH 12/13] More partial changes --- Dockerfile | 1 + build_qtbase.sh | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6405e0..a01978c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN apt-get update && \ libqt5webkit5-dev \ libqt5x11extras5-dev \ libraspberrypi0 \ + libraspberrypi-dev \ libts-dev \ libudev-dev \ libxcb-xinerama0 \ diff --git a/build_qtbase.sh b/build_qtbase.sh index fd0ff5c..3085abf 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -9,7 +9,7 @@ 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.15" +QT_BRANCH="5.12" mkdir -p "$BUILD_TARGET" @@ -41,7 +41,7 @@ if [ "$(arch)" = "armv6l" ]; then cd "$QT_PI_1" tar -zcvf $BUILD_TARGET/qtbase-pi1.tar.gz qt5pi cd "$BUILD_TARGET" - md5sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.md5 + sha256sum qtbase-pi1.tar.gz > qtbase-pi1.tar.gz.sha256 fi fi @@ -55,6 +55,11 @@ if [ "$(arch)" = "armv7l" ]; then 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 \ @@ -73,7 +78,7 @@ if [ "$(arch)" = "armv7l" ]; then cd "$QT_PI_2" tar -zcvf "$BUILD_TARGET/qtbase-pi2.tar.gz" qt5pi cd "$BUILD_TARGET" - md5sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.md5 + sha256sum qtbase-pi2.tar.gz > qtbase-pi2.tar.gz.sha256 fi if [ ! -f "$BUILD_TARGET/qtbase-pi3.tar.gz" ]; then @@ -101,6 +106,6 @@ if [ "$(arch)" = "armv7l" ]; then cd "$QT_PI_3" tar -zcvf "$BUILD_TARGET/qtbase-pi3.tar.gz" qt5pi cd "$BUILD_TARGET" - md5sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.md5 + sha256sum qtbase-pi3.tar.gz > qtbase-pi3.tar.gz.sha256 fi fi From f61b328ae204b015ca259240cdfef34bb9567667 Mon Sep 17 00:00:00 2001 From: Viktor Petersson Date: Sat, 14 Nov 2020 09:43:20 +0000 Subject: [PATCH 13/13] Fixes build step --- build_qtbase.sh | 183 ++++++++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 90 deletions(-) diff --git a/build_qtbase.sh b/build_qtbase.sh index 3085abf..f6fdd3a 100755 --- a/build_qtbase.sh +++ b/build_qtbase.sh @@ -15,97 +15,100 @@ mkdir -p "$BUILD_TARGET" echo "Building QT Base version $QT_BRANCH." -# For ARMv6 -if [ "$(arch)" = "armv6l" ]; then - 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 - ./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 "$(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 +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 "$(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 -# For ARMv7 -if [ "$(arch)" = "armv7l" ]; then - - 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 - - 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 - ./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 + +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 + +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