summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5288f8187e6f0b2e42270ac26b35945e34074502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Maintainer:

_pkgname="mozillavpn"
pkgname="$_pkgname-git"
pkgver=2.23.1.r103.gedf3406
pkgrel=1
pkgdesc="Fast, secure, and easy to use VPN from the makers of Firefox"
url="https://github.com/mozilla-mobile/mozilla-vpn-client"
license=('MPL-2.0')
arch=('x86_64')

depends=(
  'dbus'
  'freetype2'
  'hicolor-icon-theme'
  'libtiff'
  'libxcb'
  'libxdmcp'
  'libxmu'
  'libxrender'
  'polkit'
  'qt6-5compat'
  'qt6-charts'
  'qt6-declarative'
  'qt6-imageformats'
  'qt6-networkauth'
  'qt6-shadertools'
  'qt6-svg'
  'qt6-websockets'
  'wireguard-tools'
)
makedepends=(
  'cargo'
  'clang'
  'cmake'
  'git'
  'go'
  'ninja'
  'python-glean-parser' # AUR
  'python-lxml'
  'python-yaml'
  'qt6-tools'
  'yamllint'
)
optdepends=(
  'qt6-wayland: for Wayland support'
)

install="$_pkgname.install"

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

_source_main() {
  _pkgsrc="$_pkgname"
  source=("$_pkgsrc"::"git+$url.git")
  sha256sums=('SKIP')
}

_source_mozillavpn() {
  source+=(
    #'adjust.android_sdk'::'git+https://github.com/adjust/android_sdk.git'
    #'adjust.ios_sdk'::'git+https://github.com/adjust/ios_sdk.git'
    'getsentry.sentry-native'::'git+https://github.com/getsentry/sentry-native.git'
    #'kdab.android_openssl'::'git+https://github.com/KDAB/android_openssl.git'
    'mozilla-l10n.mozilla-vpn-client-l10n'::'git+https://github.com/mozilla-l10n/mozilla-vpn-client-l10n.git'
    'mozilla.glean'::'git+https://github.com/mozilla/glean.git'
    'wireguard.wireguard-apple'::'git+https://github.com/WireGuard/wireguard-apple.git'
    'wireguard.wireguard-go'::'git+https://github.com/WireGuard/wireguard-go.git'
    'wireguard.wireguard-tools'::'git+https://github.com/WireGuard/wireguard-tools.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )
}

_source_getsentry_sentry_native() {
  source+=(
    'chromium.googlesource.com.linux-syscall-support'::'git+https://chromium.googlesource.com/linux-syscall-support.git'
    'getsentry.breakpad'::'git+https://github.com/getsentry/breakpad.git'
    'getsentry.crashpad'::'git+https://github.com/getsentry/crashpad.git'
    'getsentry.libunwindstack-ndk'::'git+https://github.com/getsentry/libunwindstack-ndk.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )
}

_prepare_mozillavpn() (
  cd "$srcdir/$_pkgsrc"
  local _submodules=(
    #'adjust.android_sdk'::'3rdparty/adjust-android-sdk'
    #'adjust.ios_sdk'::'3rdparty/adjust-ios-sdk'
    'getsentry.sentry-native'::'3rdparty/sentry'
    #'kdab.android_openssl'::'3rdparty/openSSL'
    'mozilla-l10n.mozilla-vpn-client-l10n'::'3rdparty/i18n'
    'mozilla.glean'::'3rdparty/glean'
    'wireguard.wireguard-apple'::'3rdparty/wireguard-apple'
    'wireguard.wireguard-go'::'3rdparty/wireguard-go'
    'wireguard.wireguard-tools'::'3rdparty/wireguard-tools'
  )
  _submodule_update
)

_prepare_getsentry_sentry_native() (
  cd "$srcdir/$_pkgsrc"
  cd "3rdparty/sentry"
  local _submodules=(
    'chromium.googlesource.com.linux-syscall-support'::'external/third_party/lss'
    'getsentry.breakpad'::'external/breakpad'
    'getsentry.crashpad'::'external/crashpad'
    'getsentry.libunwindstack-ndk'::'external/libunwindstack-ndk'
  )
  _submodule_update
)

_cargo_env() {
  : ${CARGO_HOME:=$SRCDEST/cargo-home}
  export CARGO_HOME
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  CFLAGS+=" -ffat-lto-objects"
}

_source_main
_source_mozillavpn
_source_getsentry_sentry_native

prepare() {
  _submodule_update() {
    local _module
    for _module in "${_submodules[@]}"; do
      git submodule init "${_module##*::}"
      git submodule set-url "${_module##*::}" "$srcdir/${_module%::*}"
      git -c protocol.file.allow=always submodule update "${_module##*::}"
      echo
    done
  }

  _prepare_mozillavpn
  _prepare_getsentry_sentry_native

  _cargo_env

  cd "$_pkgsrc"
  cargo update
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

pkgver() {
  cd "$_pkgsrc"
  local _tag=$(git tag | sort -rV | head -1)
  local _revision=$(git rev-list --count --cherry-pick $_tag...HEAD)
  local _hash=$(git rev-parse --short=7 HEAD)

  printf '%s.r%s.g%s' \
    "${_tag#v}" \
    "$_revision" \
    "$_hash"
}

build() {
  _cargo_env

  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX='/usr'
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}