diff options
author | Carl Smedstad | 2023-11-19 18:12:16 +0100 |
---|---|---|
committer | Carl Smedstad | 2023-12-05 15:45:20 +0100 |
commit | 836423f63aafac8919cc49efd0c9d519f71d5c34 (patch) | |
tree | e88c8d83b63a3cef99bf48ddc0891fec4ccc9289 | |
parent | b0453964983c7d3763ecde2544b43f82c96971fd (diff) | |
download | aur-836423f63aafac8919cc49efd0c9d519f71d5c34.tar.gz |
Publish version 3.6.1-3 - Major refactoring
* Remove vcpkg dependency and dynamically link to system dependencies.
This massively reduces the build time as we don't have to build for
example curl & zlib from source.
* Depend on system Qt instead of bundling it. Brings installed package
size down to 30.18 MiB.
* Add a check() stage running the googletest suite and a subset of the
Go unit test suite.
* Set proper LDFLAGS for the Go build.
This PKGBUILD passes namcap without any warnings.
-rw-r--r-- | .SRCINFO | 43 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 168 | ||||
-rw-r--r-- | modern-icu.patch | 31 | ||||
-rw-r--r-- | protonmail-bridge.desktop | 8 | ||||
-rw-r--r-- | qt-dir.patch | 21 | ||||
-rw-r--r-- | remove-vcpkg-dependency.patch | 28 |
7 files changed, 181 insertions, 124 deletions
@@ -1,40 +1,33 @@ pkgbase = protonmail-bridge pkgdesc = Integrate ProtonMail paid account with any program that supports IMAP and SMTP pkgver = 3.6.1 - pkgrel = 2 - url = https://protonmail.com/bridge + pkgrel = 3 + url = https://github.com/ProtonMail/proton-bridge arch = x86_64 license = GPL3 - makedepends = go makedepends = cmake - makedepends = ninja - makedepends = zip - makedepends = qt6-base - makedepends = git - makedepends = python - makedepends = unzip + makedepends = go + depends = abseil-cpp + depends = gcc-libs + depends = glib2 + depends = glibc + depends = grpc depends = hicolor-icon-theme depends = libsecret - depends = libglvnd - depends = icu + depends = protobuf + depends = qt6-base depends = qt6-declarative depends = qt6-svg - depends = qt6-wayland - optdepends = org.freedesktop.secrets: Applications that support Freedesktop secrets api + depends = sentry-native optdepends = gnome-keyring: gnome-keyring support + optdepends = org.freedesktop.secrets: Applications that support Freedesktop secrets api optdepends = pass: pass support - conflicts = protonmail-bridge-bin - options = !emptydirs - options = !strip - source = git+https://github.com/ProtonMail/proton-bridge.git#tag=v3.6.1 - source = git+https://github.com/microsoft/vcpkg.git + optdepends = qt6-wayland: Wayland support + source = protonmail-bridge-3.6.1.tar.gz::https://github.com/ProtonMail/proton-bridge/archive/v3.6.1.tar.gz source = protonmail-bridge.desktop - source = qt-dir.patch - source = modern-icu.patch - sha256sums = SKIP - sha256sums = SKIP - sha256sums = 226bc140ec5c34cfdff42b33058d045446a4006518d2660db932c7f51632b48a - sha256sums = 60175b564bdf1f7e3e51933748019e4335054c72f08cdf4c453a00437fdc93a8 - sha256sums = 3adae43253c1e8a60f0e74df4592de280a1827a914514b46cbe7f36cea6856b2 + source = remove-vcpkg-dependency.patch + sha256sums = 2dd18b5460fff9c84edaf3eb7401357e8d311c3e63564db8c5adcb63e54877af + sha256sums = 404db600803b9be875365d84e0726c3f7aedceaf122a795ca2248ee9f005753b + sha256sums = 436a9a293424fb7d48a8fd61fff7d63985dec56d6170cd2fbae24fe03ef98136 pkgname = protonmail-bridge diff --git a/.gitignore b/.gitignore index 889c61a303b1..0f42ef7242c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ * +!.gitignore !PKGBUILD !.SRCINFO -!*.patch -!*.desktop -!*.install +!protonmail-bridge.desktop +!remove-vcpkg-dependency.patch @@ -1,58 +1,148 @@ +# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com> # Maintainer: Ali Molaei <ali dot molaei at protonmail dot com> # Maintainer: Ben Westover <me at benthetechguy dot net> # Contributor: Lenovsky <lenovsky at pm dot me> # Contributor: aimileus <me at aimileus dot nl> pkgname=protonmail-bridge +_name=proton-bridge pkgver=3.6.1 -pkgrel=2 +pkgrel=3 pkgdesc="Integrate ProtonMail paid account with any program that supports IMAP and SMTP" -arch=('x86_64') -url="https://protonmail.com/bridge" -license=('GPL3') -makedepends=('go' 'cmake' 'ninja' 'zip' 'qt6-base' 'git' 'python' 'unzip') -depends=('hicolor-icon-theme' 'libsecret' 'libglvnd' 'icu' 'qt6-declarative' 'qt6-svg' 'qt6-wayland') +arch=(x86_64) +url="https://github.com/ProtonMail/proton-bridge" +license=(GPL3) +depends=( + abseil-cpp + gcc-libs + glib2 + glibc + grpc + hicolor-icon-theme + libsecret + protobuf + qt6-base + qt6-declarative + qt6-svg + sentry-native +) +makedepends=( + cmake + go +) optdepends=( - 'org.freedesktop.secrets: Applications that support Freedesktop secrets api' - 'gnome-keyring: gnome-keyring support' - 'pass: pass support' + 'gnome-keyring: gnome-keyring support' + 'org.freedesktop.secrets: Applications that support Freedesktop secrets api' + 'pass: pass support' + 'qt6-wayland: Wayland support' +) + +source=( + "$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz" + "protonmail-bridge.desktop" + "remove-vcpkg-dependency.patch" +) +sha256sums=( + '2dd18b5460fff9c84edaf3eb7401357e8d311c3e63564db8c5adcb63e54877af' + '404db600803b9be875365d84e0726c3f7aedceaf122a795ca2248ee9f005753b' + '436a9a293424fb7d48a8fd61fff7d63985dec56d6170cd2fbae24fe03ef98136' ) -conflicts=('protonmail-bridge-bin') -options=('!emptydirs' '!strip') - -source=("git+https://github.com/ProtonMail/proton-bridge.git#tag=v${pkgver}" - "git+https://github.com/microsoft/vcpkg.git" - "protonmail-bridge.desktop" - "qt-dir.patch" - "modern-icu.patch") -sha256sums=('SKIP' - 'SKIP' - '226bc140ec5c34cfdff42b33058d045446a4006518d2660db932c7f51632b48a' - '60175b564bdf1f7e3e51933748019e4335054c72f08cdf4c453a00437fdc93a8' - '3adae43253c1e8a60f0e74df4592de280a1827a914514b46cbe7f36cea6856b2') + +_archive="$_name-$pkgver" prepare() { - cd proton-bridge - git submodule init - git config submodule.submodules/vcpkg.url "$srcdir/vcpkg" - git -c protocol.file.allow=always submodule update + cd "$_archive" - cat ../qt-dir.patch | patch -p1 - cat ../modern-icu.patch | patch -p1 + patch --forward --strip 1 --input "$srcdir/remove-vcpkg-dependency.patch" + + # Use system Qt rather than bundling it + rm internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake + touch internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake + + # Avoid downloading Go dependencies in build() by doing it here instead + go mod download -x } -build(){ - export PATH=$PATH:$(go env GOPATH)/bin/ - cd proton-bridge - make build +build() { + cd "$_archive" + + ( + cd ./utils/ + ./credits.sh bridge + ) + + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" + + _ld_flags=" \ + -X github.com/ProtonMail/proton-bridge/v3/internal/constants.Version=$pkgver \ + -X github.com/ProtonMail/proton-bridge/v3/internal/constants.Revision=NOGIT \ + -X github.com/ProtonMail/proton-bridge/v3/internal/constants.Tag=$pkgver \ + -X github.com/ProtonMail/proton-bridge/v3/internal/constants.BuildTime= \ + -X 'github.com/ProtonMail/proton-bridge/v3/internal/constants.FullAppName=Proton Mail Bridge' \ + -X 'github.com/ProtonMail/proton-bridge/v3/internal/constants.BuildEnv=Arch Linux' \ + " + + go build -v \ + -ldflags "$_ld_flags" \ + -o bridge \ + ./cmd/Desktop-Bridge/ + + cmake \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_SKIP_RPATH=YES \ + -Wno-dev \ + -DBRIDGE_APP_FULL_NAME='Proton Mail Bridge' \ + -DBRIDGE_VENDOR='Proton AG' \ + -DBRIDGE_REVISION=NOGIT \ + -DBRIDGE_TAG=$pkgver \ + -DBRIDGE_DSN_SENTRY= \ + -DBRIDGE_BUILD_ENV='Arch Linux' \ + -DBRIDGE_APP_VERSION=$pkgver \ + -S internal/frontend/bridge-gui/bridge-gui \ + -B build + cmake --build build +} + +check() { + cd "$_archive" + + cmake --build build --target bridgepp-test + ./build/bridgepp/bridgepp-test + + # Skip long-running tests or tests interacting with the keyring + _unit_tests=$( + go list ./internal/... ./pkg/... \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/app' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/bridge' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/dialer' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/services' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/user' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/usertypes' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/internal/vault' \ + | grep -v 'github.com/ProtonMail/proton-bridge/v3/pkg/keychain' \ + | sort + ) + + # shellcheck disable=SC2086 + go test -count=1 $_unit_tests } package() { - mkdir -p "${pkgdir}"/opt - mkdir -p "${pkgdir}"/usr/bin - cp -r proton-bridge/cmd/Desktop-Bridge/deploy/linux/ "${pkgdir}"/opt/protonmail-bridge - install -D -m644 "${pkgdir}"/opt/protonmail-bridge/LICENSE -t "${pkgdir}"/usr/share/licenses/"${pkgname}"/ - install -D -m644 "${pkgdir}"/opt/protonmail-bridge/logo.svg "${pkgdir}"/usr/share/icons/hicolor/scalable/apps/"${pkgname}".svg - install -D -m644 "${srcdir}"/protonmail-bridge.desktop -t "${pkgdir}"/usr/share/applications/ - ln -s "/opt/protonmail-bridge/proton-bridge" "$pkgdir/usr/bin/protonmail-bridge" + cd "$_archive" + + install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE + install -Dm644 -t "$pkgdir/usr/share/applications/" "$srcdir/protonmail-bridge.desktop" + install -Dm644 -t "$pkgdir/usr/share/doc/protonmail/bridge/" ./*.md + install -Dm644 dist/bridge.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/protonmail-bridge.svg" + + install -Dm755 bridge "$pkgdir/usr/lib/protonmail/bridge/bridge" + install -Dm755 build/bridge-gui "$pkgdir/usr/lib/protonmail/bridge/bridge-gui" + + install -dm755 "$pkgdir/usr/bin/" + ln -s /usr/lib/protonmail/bridge/bridge-gui "$pkgdir/usr/bin/protonmail-bridge" } diff --git a/modern-icu.patch b/modern-icu.patch deleted file mode 100644 index a942d5d287d8..000000000000 --- a/modern-icu.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Ben Westover <me@benthetechguy.net> -CMake is hard coded to look for libicu version 56, since their Windows -install of Qt6 is bundled with it. Since we're using system Qt, we can -use the system version of libicu. ---- - -diff --git a/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake b/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -index 10e1ea1..53a336a 100644 ---- a/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -+++ b/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -@@ -25,6 +25,7 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_BINDIR}" "${CMAKE_INSTALL_LIBDIR}" "." - install(DIRECTORY "${QT_DIR}/qml" "${QT_DIR}/plugins" - DESTINATION "${CMAKE_INSTALL_PREFIX}") - -+find_package(ICU 56.0 COMPONENTS i18n uc data REQUIRED) - macro( AppendLib LIB_NAME HINT_PATH) - string(TOUPPER ${LIB_NAME} UP_NAME) - -@@ -54,9 +55,9 @@ AppendQt6Lib("libQt6Gui.so.6") - AppendQt6Lib("libQt6Core.so.6") - AppendQt6Lib("libQt6QuickTemplates2.so.6") - AppendQt6Lib("libQt6DBus.so.6") --AppendQt6Lib("libicui18n.so.56") --AppendQt6Lib("libicuuc.so.56") --AppendQt6Lib("libicudata.so.56") -+AppendQt6Lib("libicui18n.so") -+AppendQt6Lib("libicuuc.so") -+AppendQt6Lib("libicudata.so") - AppendQt6Lib("libQt6XcbQpa.so.6") - AppendQt6Lib("libQt6WaylandClient.so.6") - AppendQt6Lib("libQt6WlShellIntegration.so.6") diff --git a/protonmail-bridge.desktop b/protonmail-bridge.desktop index de4a6ffc238f..ed77abf6a6cf 100644 --- a/protonmail-bridge.desktop +++ b/protonmail-bridge.desktop @@ -1,12 +1,10 @@ [Desktop Entry] Type=Application -Version=1.1 +Version=1.5 Name=ProtonMail Bridge -GenericName=ProtonMail Bridge for Linux Comment=The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer. -Icon=/opt/protonmail-bridge/logo.svg +Icon=/usr/share/icons/hicolor/scalable/apps/protonmail-bridge.svg Exec=/usr/bin/protonmail-bridge Terminal=false -Categories=Office;Email;Network +Categories=Email;Network StartupWMClass=protonmail-bridge - diff --git a/qt-dir.patch b/qt-dir.patch deleted file mode 100644 index 4c4045c6eee1..000000000000 --- a/qt-dir.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Ben Westover <me@benthetechguy.net> -$QT_DIR is set to the Qt install prefix, which works fine for bundled Qt, -but we're using a system Qt install, so everything is spread out. Correct -the path to the qml and plugin directories for a system install. ---- - -diff --git a/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake b/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -index 10e1ea16..8a116690 100644 ---- a/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -+++ b/internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake -@@ -22,8 +22,8 @@ cmake_minimum_required(VERSION 3.22) - #***************************************************************************************************************************************************** - - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_BINDIR}" "${CMAKE_INSTALL_LIBDIR}" "." "../lib") --install(DIRECTORY "${QT_DIR}/qml" "${QT_DIR}/plugins" -- DESTINATION "${CMAKE_INSTALL_PREFIX}") -+install(DIRECTORY "${QT_DIR}/lib/qt6/qml" "${QT_DIR}/lib/qt6/plugins" -+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/qt6") - - macro( AppendLib LIB_NAME HINT_PATH) - string(TOUPPER ${LIB_NAME} UP_NAME) diff --git a/remove-vcpkg-dependency.patch b/remove-vcpkg-dependency.patch new file mode 100644 index 000000000000..2ba40a79a589 --- /dev/null +++ b/remove-vcpkg-dependency.patch @@ -0,0 +1,28 @@ +diff --unified --recursive --text proton-bridge-3.6.1.orig/internal/frontend/bridge-gui/BridgeSetup.cmake proton-bridge-3.6.1/internal/frontend/bridge-gui/BridgeSetup.cmake +--- proton-bridge-3.6.1.orig/internal/frontend/bridge-gui/BridgeSetup.cmake 2023-11-21 15:03:10.865099608 +0100 ++++ proton-bridge-3.6.1/internal/frontend/bridge-gui/BridgeSetup.cmake 2023-11-21 15:03:34.591823916 +0100 +@@ -51,17 +51,6 @@ + # We rely on vcpkg for to get gRPC / Protobuf + # run build.sh / build.ps1 to get gRPC / Protobuf and dependencies installed. + +-set(VCPKG_ROOT "${BRIDGE_REPO_ROOT}/extern/vcpkg") +-message(STATUS "VCPKG_ROOT is ${VCPKG_ROOT}") +-if (WIN32) +- find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg.exe") +-else() +- find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg") +-endif() +-if (NOT VCPKG_EXE) +- message(FATAL_ERROR "vcpkg is not installed. Run build.sh (macOS/Linux) or build.ps1 (Windows) first.") +-endif() +- + # For now we support only a single architecture for macOS (ARM64 or x86_64). We need to investigate how to build universal binaries with vcpkg. + if (APPLE) + if (NOT DEFINED CMAKE_OSX_ARCHITECTURES) +@@ -86,5 +75,3 @@ + message(STATUS "Building for Intel x64 Windows computers") + set(VCPKG_TARGET_TRIPLET x64-windows) + endif() +- +-set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain") +\ No newline at end of file |