diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index ab3e1d07f7..0a7fbbd6d9 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -52,106 +52,46 @@ jobs: name: Sources path: .tmp - ubuntu-focal: - name: Ubuntu Focal - needs: source-bundle - runs-on: ubuntu-20.04 - steps: - - name: Download Source Package - uses: actions/download-artifact@v2 - with: - name: Sources - - - name: Install Dependencies - run: | - # Add external PPA, latest version of QT is 5.12.x for Ubuntu 20.04 - sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal -y - sudo apt-get install debhelper devscripts equivs -y - pip3 install pyyaml - - for file in $(find focal/ -type f); do ln -s $file; done - dpkg-source -x mozillavpn_*.dsc - sudo mk-build-deps -ir mozillavpn-*/debian/control - - - name: Create package structure - shell: bash - run: | - (cd mozillavpn-* && dpkg-buildpackage --build=binary --no-sign) - mkdir packages - cp *.deb packages - - - name: Uploading - uses: actions/upload-artifact@v1 - with: - name: Focal Build - path: packages - - ubuntu-bionic: - name: Ubuntu Bionic - needs: source-bundle - runs-on: ubuntu-18.04 - steps: - - name: Download Source Package - uses: actions/download-artifact@v2 - with: - name: Sources - - - name: Install Dependencies - run: | - # Add external PPA, latest version of QT is 5.12.x for Ubuntu 18.04 - sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-bionic -y - sudo apt-get install debhelper devscripts equivs -y - pip3 install pyyaml - - for file in $(find bionic/ -type f); do ln -s $file; done - dpkg-source -x mozillavpn_*.dsc - sudo mk-build-deps -ir mozillavpn-*/debian/control - - - name: Create package structure - shell: bash - run: | - (cd mozillavpn-* && dpkg-buildpackage --build=binary --no-sign) - mkdir packages - cp *.deb packages - - - name: Uploading - uses: actions/upload-artifact@v1 - with: - name: Bionic Build - path: packages - - ubuntu-pbuilder: name: Ubuntu Packages needs: source-bundle strategy: matrix: config: - - { name: "Impish", dist: impish } - - { name: "Jammy", dist: jammy } + - { name: "Bionic", dist: bionic, ppa: "ppa:okirby/qt6-testing" } + - { name: "Focal", dist: focal, ppa: "ppa:okirby/qt6-testing" } + - { name: "Impish", dist: impish, ppa: "ppa:okirby/qt6-testing" } + - { name: "Jammy", dist: jammy, ppa: "" } runs-on: ubuntu-latest env: BASETGZ: /var/cache/pbuilder/ubuntu-buildd-${{ matrix.config.dist }}.tgz + QTPPA: ${{ matrix.config.ppa }} steps: - name: Download Source Package uses: actions/download-artifact@v2 with: name: Sources - + - name: Create base ${{ matrix.config.dist }} image run: | pip3 install pyyaml sudo apt-get update sudo apt-get install pbuilder debootstrap debhelper devscripts -y - sudo pbuilder create --distribution ${{ matrix.config.dist }} --basetgz $BASETGZ --debootstrapopts --variant=buildd + sudo pbuilder create --distribution ${{ matrix.config.dist }} --basetgz $BASETGZ \ + --othermirror "deb http://security.ubuntu.com/ubuntu ${{ matrix.config.dist }}-updates main restricted universe" \ + --debootstrapopts --variant=buildd --extrapackages "software-properties-common gpg-agent" + if [ ! -z "$QTPPA" ]; then + echo '#/bin/sh' > ppa-${{ matrix.config.dist }}-install.sh + echo "add-apt-repository ${QTPPA} -y" >> ppa-${{ matrix.config.dist }}-install.sh + sudo pbuilder execute --basetgz $BASETGZ --save-after-exec -- ppa-${{ matrix.config.dist }}-install.sh + fi - name: Building package shell: bash run: | mkdir packages - for file in $(find ${{matrix.config.dist}} -type f); do ln -s $file; done - sudo pbuilder build --basetgz $BASETGZ --buildresult $(pwd)/packages mozillavpn_*.dsc + sudo pbuilder build --basetgz $BASETGZ --buildresult $(pwd)/packages mozillavpn_*-${{matrix.config.dist}}[0-9].dsc - name: Uploading uses: actions/upload-artifact@v1 diff --git a/.github/workflows/wasm.yaml b/.github/workflows/wasm.yaml index daf08a4d60..c499798d30 100644 --- a/.github/workflows/wasm.yaml +++ b/.github/workflows/wasm.yaml @@ -14,6 +14,8 @@ jobs: wasmQt6: name: Wasm Qt6 runs-on: ubuntu-20.04 + env: + QTVERSION: 6.2.3 steps: - name: Clone repository @@ -31,15 +33,17 @@ jobs: run: | python3 -m pip install aqtinstall # qt6.2.3 for wasm needs the desktop linux installation - python3 -m aqt install-qt -O /opt linux desktop 6.2.3 - python3 -m aqt install-qt -O /opt linux desktop 6.2.3 wasm_32 -m qtcharts qtwebsockets qt5compat + python3 -m aqt install-qt -O /opt linux desktop $QTVERSION + python3 -m aqt install-qt -O /opt linux desktop $QTVERSION wasm_32 -m qtcharts qtwebsockets qt5compat - name: Patching Qt shell: bash run: | # see: https://wiki.qt.io/Qt_6.2_Known_Issues#WebAssembly - sed '/sse/,+5 d' /opt/6.2.3/wasm_32/mkspecs/features/wasm/wasm.prf > /tmp/wasm.prf - mv /tmp/wasm.prf /opt/6.2.3/wasm_32/mkspecs/features/wasm/wasm.prf + sed '/sse/,+5 d' /opt/$QTVERSION/wasm_32/mkspecs/features/wasm/wasm.prf > /tmp/wasm.prf + mv /tmp/wasm.prf /opt/$QTVERSION/wasm_32/mkspecs/features/wasm/wasm.prf + ln -s /opt/$QTVERSION/gcc_64/bin/lconvert /opt/$QTVERSION/wasm_32/bin/ + ln -s /opt/$QTVERSION/gcc_64/bin/lupdate /opt/$QTVERSION/wasm_32/bin/ - name: Install python dependencies shell: bash @@ -52,7 +56,7 @@ jobs: - name: Compiling shell: bash run: | - export PATH=/opt/6.2.3/wasm_32/bin:/opt/6.2.3/gcc_64/bin:$PATH + export PATH=/opt/$QTVERSION/wasm_32/bin:/opt/$QTVERSION/gcc_64/bin:$PATH ./scripts/wasm/compile.sh - name: Uploading diff --git a/linux/debian/control.bionic b/linux/debian/control.beineri similarity index 96% rename from linux/debian/control.bionic rename to linux/debian/control.beineri index fee5ac1f69..4fd7c0402e 100644 --- a/linux/debian/control.bionic +++ b/linux/debian/control.beineri @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9.20160709), cdbs, quilt, flex, - golang-1.13, + golang (>=2:1.13~) | golang-1.13, cargo, python3-yaml, qt515base (>=5.15.2-1basyskom4), @@ -37,7 +37,7 @@ Build-Depends: debhelper (>= 9.20160709), libxcb-xfixes0-dev, libxrender-dev, libxcb-shape0-dev, - libasound2-dev, + libasound2-dev [linux-any], libaudio-dev, libcups2-dev, libdbus-1-dev, @@ -78,9 +78,7 @@ Architecture: any Depends: libpolkit-gobject-1-0 (>=0.105-20), wireguard (>=1.0.20200513-1~18.04.2), wireguard-tools (>=1.0.20200513-1~18.04.2), - libicu60 (>=60.2-3ubuntu3), libxcb-xinerama0 (>=1.13-1), - resolvconf (>=1.79ubuntu10), qt515base (>=5.15.2-1basyskom4), qt515charts-no-lgpl (>=5.15.2-1basyskom1), qt515declarative (>= 5.15.2-1basyskom1), diff --git a/linux/debian/control.impish b/linux/debian/control.qt5 similarity index 97% rename from linux/debian/control.impish rename to linux/debian/control.qt5 index e12bf24233..7fd5b4cb33 100644 --- a/linux/debian/control.impish +++ b/linux/debian/control.qt5 @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9.20160709), cdbs, quilt, flex, - golang (>=1.13), + golang (>=2:1.13~) | golang-1.13, cargo, python3-yaml, libqt5charts5-dev (>=5.15.2), diff --git a/linux/debian/control.qt6 b/linux/debian/control.qt6 new file mode 100644 index 0000000000..4afa57c860 --- /dev/null +++ b/linux/debian/control.qt6 @@ -0,0 +1,61 @@ +Source: mozillavpn +Section: net +Priority: optional +Maintainer: mozilla +Build-Depends: debhelper (>= 9.20160709), + cdbs, + quilt, + flex, + golang (>=2:1.13~) | golang-1.13, + cargo, + python3-yaml, + libgl-dev, + libopengl-dev (>= 1.3.0~) | libglvnd-dev (<< 1.3.0~), + libqt6charts6-dev (>=6.2.0~), + libqt6core5compat6-dev (>=6.2.0~), + libqt6networkauth6-dev (>=6.2.0~), + libqt6opengl6-dev (>=6.2.0~), + libqt6svg6-dev (>=6.2.0~), + libqt6websockets6-dev (>=6.2.0~), + qmake6 (>=6.2.0~), + qt6-base-dev (>=6.2.0~), + qt6-base-dev-tools (>=6.2.0~), + qt6-declarative-dev (>=6.2.0~), + qt6-declarative-dev-tools (>=6.2.0~), + qt6-l10n-tools (>=6.2.0~), + qt6-tools-dev-tools (>=6.2.0~), + libpolkit-gobject-1-dev +Standards-Version: 4.4.1 +Homepage: https://vpn.mozilla.org/ +Vcs-Git: https://github.com/mozilla-mobile/mozilla-vpn-client + +Package: mozillavpn +Architecture: any +Depends: libpolkit-gobject-1-0 (>=0.105), + wireguard (>=1.0.20210424), + wireguard-tools (>=1.0.20210424), + libqt6charts6 (>=6.2.0~), + libqt6quick6 (>=6.2.0~), + libqt6widgets6 (>=6.2.0~), + libqt6gui6 (>=6.2.0~), + libqt6qml6 (>=6.2.0~), + libqt6network6 (>=6.2.0~), + libqt6networkauth6 (>=6.2.0~), + libqt6dbus6 (>=6.2.0~), + libqt6core6 (>=6.2.0~), + libqt6svg6 (>=6.2.0~), + libqt6websockets6 (>=6.2.0~), + libqt6test6 (>=6.2.0~), + qml6-module-qtcharts (>=6.2.0~), + qml6-module-qt5compat-graphicaleffects (>=6.2.0~), + qml6-module-qtquick (>=6.2.0~), + qml6-module-qtquick-controls (>=6.2.0~), + qml6-module-qtquick-layouts (>=6.2.0~), + qml6-module-qtquick-localstorage (>=6.2.0~), + qml6-module-qtquick-window (>=6.2.0~), + qml6-module-qtqml (>=6.2.0~), + qml6-module-qtqml-models (>=6.2.0~) +Description: A fast, secure and easy to use VPN. Built by the makers of Firefox. + Read more on https://vpn.mozilla.org + + diff --git a/linux/debian/rules.focal b/linux/debian/rules.beineri similarity index 73% rename from linux/debian/rules.focal rename to linux/debian/rules.beineri index 13f189fa31..af5f70bb2e 100755 --- a/linux/debian/rules.focal +++ b/linux/debian/rules.beineri @@ -8,6 +8,12 @@ export LD_LIBRARY_PATH := $(QTDIR)/lib:$(LD_LIBRARY_PATH) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_VERSION ?= $(shell dpkg-parsechangelog -SVersion) +GOLANG_NATIVE_VERSION := $(shell dpkg-query --showformat='${Version}' --show golang 2>/dev/null || echo 0) +ifneq (ok,$(dpkg --compare-versions $(GOLANG_NATIVE_VERSION) ge 2:1.13 && echo ok)) + export GODIR := /usr/lib/go-1.13 + export PATH := $(GODIR)/bin:$(PATH) +endif + %: dh $@ --with=systemd --warn-missing diff --git a/linux/debian/rules.impish b/linux/debian/rules.qt5 similarity index 70% rename from linux/debian/rules.impish rename to linux/debian/rules.qt5 index 30779f29ff..1c7c94c3c9 100755 --- a/linux/debian/rules.impish +++ b/linux/debian/rules.qt5 @@ -5,6 +5,12 @@ export DH_VERBOSE=1 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_VERSION ?= $(shell dpkg-parsechangelog -SVersion) +GOLANG_NATIVE_VERSION := $(shell dpkg-query --showformat='${Version}' --show golang 2>/dev/null || echo 0) +ifneq (ok,$(dpkg --compare-versions $(GOLANG_NATIVE_VERSION) ge 2:1.13 && echo ok)) + export GODIR := /usr/lib/go-1.13 + export PATH := $(GODIR)/bin:$(PATH) +endif + %: dh $@ --with=systemd --warn-missing diff --git a/linux/debian/rules.bionic b/linux/debian/rules.qt6 similarity index 59% rename from linux/debian/rules.bionic rename to linux/debian/rules.qt6 index e5217827e9..aa137da72a 100755 --- a/linux/debian/rules.bionic +++ b/linux/debian/rules.qt6 @@ -1,20 +1,22 @@ #!/usr/bin/make -f export DH_VERBOSE=1 -export QTDIR := /opt/qt515 -export GODIR := /usr/lib/go-1.13 -export PATH := $(QTDIR)/bin:$(GODIR)/bin:$(PATH) -export LD_LIBRARY_PATH := $(QTDIR)/lib:$(LD_LIBRARY_PATH) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_VERSION ?= $(shell dpkg-parsechangelog -SVersion) +GOLANG_NATIVE_VERSION := $(shell dpkg-query --showformat='${Version}' --show golang 2>/dev/null || echo 0) +ifneq (ok,$(dpkg --compare-versions $(GOLANG_NATIVE_VERSION) ge 2:1.13 && echo ok)) + export GODIR := /usr/lib/go-1.13 + export PATH := $(GODIR)/bin:$(PATH) +endif + %: dh $@ --with=systemd --warn-missing override_dh_auto_configure: python3 scripts/utils/import_languages.py - qmake CONFIG-=debug CONFIG+=release CONFIG-=debug_and_release QT+=svg BUILD_ID=$(DEB_VERSION) + qmake6 CONFIG-=debug CONFIG+=release CONFIG-=debug_and_release BUILD_ID=$(DEB_VERSION) CONFIG+=webextension override_dh_installdocs: diff --git a/scripts/linux/script.sh b/scripts/linux/script.sh index 01a9a52611..44465f13b3 100755 --- a/scripts/linux/script.sh +++ b/scripts/linux/script.sh @@ -7,7 +7,8 @@ . $(dirname $0)/../utils/commons.sh REVISION=1 -RELEASE=focal +RELEASE= +QTVERSION="qt6" SOURCEONLY=N PPA_URL= DPKG_SIGN="--no-sign" @@ -24,6 +25,9 @@ helpFunction() { print N "Build options:" print N " -r, --release DIST Build packages for distribution DIST" print N " -v, --version REV Set package revision to REV" + print N " --beineri Build using Stephan Binner's Qt5.15 PPA" + print N " --qt5 Build using Qt5 packages" + print N " --qt6 Build using Qt6 packages (default)" print N " --source Build source packages only (no binary)" print N " --ppa URL Upload source packages to PPA at URL (implies: --source)" print N "" @@ -46,7 +50,7 @@ while [[ $# -gt 0 ]]; do case $key in -r | --release) - RELEASE="$2" + RELEASE+=" $2" shift shift ;; @@ -55,7 +59,20 @@ while [[ $# -gt 0 ]]; do shift shift ;; + --beineri) + QTVERSION="beineri" + shift + ;; + --qt5) + QTVERSION="qt5" + shift + ;; + --qt6) + QTVERSION="qt6" + shift + ;; --source) + RELEASE="bionic focal impish jammy fedora" SOURCEONLY=Y shift ;; @@ -84,6 +101,12 @@ while [[ $# -gt 0 ]]; do esac done +# Fall back to the host operating system if no release was specified +if [ -z "$RELEASE" ]; then + . /etc/os-release + RELEASE="$VERSION_CODENAME" +fi + printn Y "Computing the version... " SHORTVERSION=$(cat version.pri | grep VERSION | grep defined | cut -d= -f2 | tr -d \ ) WORKDIR=mozillavpn-$SHORTVERSION @@ -147,8 +170,8 @@ build_deb_source() { rm -rf $WORKDIR/debian || die "Failed" cp -r ../linux/debian $WORKDIR || die "Failed" - mv $WORKDIR/debian/rules.$distro $WORKDIR/debian/rules - mv $WORKDIR/debian/control.$distro $WORKDIR/debian/control + mv $WORKDIR/debian/rules.$QTVERSION $WORKDIR/debian/rules + mv $WORKDIR/debian/control.$QTVERSION $WORKDIR/debian/control rm $WORKDIR/debian/control.* rm $WORKDIR/debian/rules.* @@ -161,56 +184,40 @@ build_deb_source() { (cd $WORKDIR && dpkg-buildpackage --build=source $DPKG_SIGN --no-check-builddeps) || die "Failed" } -## For source-only, build all the source bundles we can. -if [ "$SOURCEONLY" == "Y" ]; then - print Y "Configuring the DEB sources..." - (which dpkg-buildpackage > /dev/null) && for control in ../linux/debian/control.*; do - filename=$(basename $control) - distro=$(echo $filename | cut -d'.' -f2) - - build_deb_source $distro $buildtype - - mkdir $distro - mv mozillavpn_${SHORTVERSION}-*_source.buildinfo $distro/ || die "Failed" - mv mozillavpn_${SHORTVERSION}-*_source.changes $distro/ || die "Failed" - mv mozillavpn_${SHORTVERSION}-*.debian.tar.* $distro/ || die "Failed" - mv mozillavpn_${SHORTVERSION}-*.dsc $distro/ || die "Failed" - done - - print Y "Configuring the RPM spec..." - build_rpm_spec -## Otherwise, build the desired release. -else - case "$RELEASE" in - bionic|focal|impish|jammy) - build_deb_source $RELEASE - - print Y "Building Debian packages for $RELEASE" - (cd $WORKDIR && dpkg-buildpackage --build=binary $DPKG_SIGN) || die "Failed" - ;; - - fedora) +## Prepare the distribution's packaging sources +for distro in $RELEASE; do + case "$distro" in + fedora|rpm) + print Y "Building RPM packages for $distro" build_rpm_spec - - print Y "Building RPM packages for $RELEASE" rpmbuild --define "_topdir $(pwd)" --define "_sourcedir $(pwd)" -bs mozillavpn.spec - RPM=Y ;; *) - die "We support RELEASE focal, bionic, impish, jammy and fedora only" - ;; + print Y "Building Debian packages for $distro" + build_deb_source $distro + ;; esac -fi +done print Y "Cleaning up working directory..." rm -rf $WORKDIR || die "Failed" +## Handle PPA Uploads if [ ! -z "$PPA_URL" ]; then print Y "Uploading sources to $PPA_URL" - for dist in $(find . -type d -name); do - ln -s ../mozillavpn_${SHORTVERSION}.orig.tar.gz $dist/mozillavpn_${SHORTVERSION}.orig.tar.gz - dput "$PPA_URL" $dist/mozillavpn_${SHORTVERSION}-*_source.changes + for changeset in $(find . -type f -name '*_source.changes'); do + dput "$PPA_URL" $changeset + done +fi + +## Build Binary packages +if [ "$SOURCEONLY" != "Y" ]; then + for changeset in $(find . -type f -name '*_source.changes'); do + print Y "Building binary package from $changeset" + dpkg-source -x ${changeset%_source.changes}.dsc + (cd $WORKDIR && dpkg-buildpackage --build=binary $DPKG_SIGN) || die "Failed" + rm -rf $WORKDIR done fi diff --git a/scripts/utils/generate_strings.py b/scripts/utils/generate_strings.py index ccd5c9c3e9..dffa0fbf5d 100755 --- a/scripts/utils/generate_strings.py +++ b/scripts/utils/generate_strings.py @@ -108,7 +108,8 @@ def generateStrings(): ) with open( - os.path.join(translations_path, "generated", "l18nstrings.h"), "w" + os.path.join(translations_path, "generated", "l18nstrings.h"), "w", + encoding="utf-8" ) as output: output.write( """/* This Source Code Form is subject to the terms of the Mozilla Public @@ -157,7 +158,8 @@ class L18nStrings final : public QQmlPropertyMap { ) with open( - os.path.join(translations_path, "generated", "l18nstrings_p.cpp"), "w" + os.path.join(translations_path, "generated", "l18nstrings_p.cpp"), "w", + encoding="utf-8" ) as output: output.write( """/* This Source Code Form is subject to the terms of the Mozilla Public diff --git a/scripts/utils/import_languages.py b/scripts/utils/import_languages.py index 15144c88ff..8126338993 100755 --- a/scripts/utils/import_languages.py +++ b/scripts/utils/import_languages.py @@ -30,20 +30,30 @@ def title(a, b): print(f"\033[96m\033[1m{a}\033[0m: \033[97m{b}\033[0m") # Step 0 -title("Step 0", "Locate the lupdate and lconvert tools...") -lupdate = shutil.which('lupdate') -if lupdate is None: - lupdate = shutil.which('lupdate-qt5') -if lupdate is None: - print('Unable to locate lupdate tool.') +title("Step 0", "Find the Qt localization tools...") +def qtquery(qmake, propname): + try: + qtquery = os.popen(f'{qmake} -query {propname}') + qtpath = qtquery.read().strip() + if len(qtpath) > 0: + return qtpath + finally: + pass + return None + +qtbinpath = qtquery('qmake', 'QT_INSTALL_BINS') +if qtbinpath is None: + qtbinpath = qtquery('qmake6', 'QT_INSTALL_BINS') +if qtbinpath is None: + qtbinpath = qtquery('qmake5', 'QT_INSTALL_BINS') +if qtbinpath is None: + qtbinpath = qtquery('qmake-qt5', 'QT_INSTALL_BINS') +if qtbinpath is None: + print('Unable to locate qmake tool.') sys.exit(1) -lconvert = shutil.which('lconvert') -if lconvert is None: - lconvert = shutil.which('lconvert-qt5') -if lconvert is None: - print('Unable to locate lconvert tool.') - sys.exit(1) +lupdate = os.path.join(qtbinpath, 'lupdate') +lconvert = os.path.join(qtbinpath, 'lconvert') # Step 1 # Go through the i18n repo, check each XLIFF file and take