summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8b2d2293bc9df01747230cbc34d527ebc4c2a44d (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# SPDX-License-Identifier: AGPL-3.0
#
# Maintainer: Truocolo <truocolo@aol.com>
# Maintainer: Pellegrino Prevete <pellegrinoprevete@gmail.com>

# shellcheck disable=SC2034
_git="false"
_pkg="metamask"
_browsers=(
  "chrome"
  "firefox"
  # "opera"
)
_pkgbase="${_pkg}"
pkgbase="${_pkg}-git"
_pkgname="${_pkg}-extension"
pkgname=()
for _browser \
  in "${_browsers[@]}"; do
  pkgname+=(
    "${_pkg}-${_browser}-git"
  )
done
_addon_id="2e742fd4-1e66-4604-89a2-b99cc03f171a"
_branch="develop"
_pkgver=10.25.0
pkgver=10.32.0
pkgrel=1
_pkgdesc() {
  local \
    _browser="${1}" \
    _desc=()
  _desc=(
    "${_browser} extension that enables"
    "interacting with Ethereum Virtual Machine"
    "networks enabled websites"
  )
  echo \
    "${_desc[@]}"
}
pkgdesc="$( \
  _pkgdesc \
    "Browser")"
_http="https://github.com"
_ns="MetaMask"
url="${_http}/${_ns}/${_pkgname}"
license=(
  'custom:consensys'
)
arch=(
  'any'
)
depends=()
provides=(
  "${_pkg}=${pkgver}"
)
conflicts=(
  "${_pkg}"
)
makedepends=(
  'nodejs>=20.0'
  'sentry-cli'
  'yarn'
  'typescript'
)
source=(
  "${_pkg}_policy.json"
)
sha512sums=(
  '912bc9a9ac604b8603bbc34bbc7793caaad4b796ecd3fe59dea2e2e53e22de9573fb9f84e5b2e3601bf2d9193d71f858b066e4a086a8818d9a97cb8fc8d141e4'
  'SKIP'
)
[[ "${_git}" == true ]] && \
  makedepends+=(
    "git"
  ) && \
  source+=(
    "${_pkgname}-${_branch}::git+${url}.git"
  )
[[ "${_git}" == false ]] && \
  source+=(
    "${url}/archive/refs/heads/${_branch}.zip"
  )

_parse_ver() {
  local \
    _pkgver="${1}" \
    _out="" \
    _ver \
    _rev \
    _commit
  _ver="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $1}')"
  _rev="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $2}')"
  _commit="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $3}')"
  _out=${_ver}
  if [[ "${_rev}" != "" ]]; then
    _out+=".r${_rev}"
  fi
  if [[ "${_commit}" != "" ]]; then
    _out+=".${_commit}"
  fi
  echo \
    "${_out}"
}

__pkgver() {
  local \
    _pkgver
  cd \
    "${_pkgname}-${_branch}"
  _pkgver="$( \
    git \
      describe \
      --tags | \
      sed \
        's/-/+/g')"
  _parse_ver \
    "${_pkgver}"
}

build() {
  export \
    SENTRYCLI_USE_LOCAL=1
  cd \
    "${srcdir}/${_pkgname}-${_branch}"
  ls \
    -a
  echo \
    "running 'yarn'"
  yarn # setup
  echo \
    "running 'yarn install'"
  cp \
    ".${_pkg}rc.dist" \
    ".${_pkg}rc"
  sed \
    -i \
    -e \
    's/00000000000/2f8ebfee0f81453d83fe6219b9a59754/g' \
    ".${_pkg}rc"
  yarn \
    dist
}

package_metamask-chrome-git() {
  local \
    _browser="chromium"
  pkgdesc="$( \
    _pkgdesc \
      "Chrome")"
  depends+=(
    "${_browser}"
  )
  provides=(
    "${_pkg}-${_browser}=${pkgver}"
    "${_pkg}-chrome=${pkgver}"
  )
  conflicts=(
    "${_pkg}-${_browser}"
    "${_pkg}-chrome"
  )
  install \
    -Dm644 \
    "${srcdir}/${_pkg}_policy.json" \
    "${pkgdir}/etc/${_browser}/policies/managed/${_pkg}_policy.json"
}

package_metamask-firefox-git() {
  local \
    _browser="firefox"
  pkgdesc="$( \
    _pkgdesc \
      "Firefox")"
  depends+=(
    "${_browser}"
  )
  provides=(
    "${_pkg}-${_browser}=${pkgver}"
  )
  conflicts=(
    "${_pkg}-${_browser}"
  )
  extensions_dir="${pkgdir}/usr/lib/${_browser}/browser/extensions"
  install \
    -Dm644 \
    "${srcdir}/${_pkgname}-${_branch}/builds/${_pkg}-${_browser}-${_pkgver}.zip" \
    "${extensions_dir}/webextension@${_pkg}.io.xpi"
}

# vim:set sw=2 sts=-1 et: