summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a029d619f3f6e7f6677cf6e3d71960376483bafd (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
# Contributor: dreieck (https://aur.archlinux.org/account/dreieck)

_pkgname=edgegpt
pkgname="${_pkgname}-git"
pkgver=0.3.8+1.r325.20230512.f464c62
pkgrel=1
pkgdesc="The reverse engineering the chat feature of the new version of Bing."
arch=(
  'any'
)
url="https://github.com/acheong08/EdgeGPT"
license=('custom: public domain')
depends=(
  'python>=3'
  'python-httpx'
  'python-prompt_toolkit'
  'python-regex'
  'python-requests'
  'python-rich'
  'python-tls-client'
  'python-websockets'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  # 'python-setuptools'
  'python-wheel'
)
provides=(
  "${_pkgname}=${pkgver}"
  "python-edgegpt=${pkgver}"
  "python-edgegpt-git=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  "python-edgegpt"
)
replaces=()
source=(
  "${_pkgname}::git+${url}.git"
  'edgegpt.sh'
)
sha256sums=(
  'SKIP'
  'ede2493e322666e51e97462c9ad5542f9f618fadb371672e4c2526f400e984b7'
)

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Could not determine version."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

prepare() {
  cd "${srcdir}/${_pkgname}"

  git log > "${srcdir}/git.log"
}

build() {
  cd "${srcdir}/${_pkgname}"

  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pkgname}"

  export PYTHONHASHSEED=0
  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -D -v -m755 "${srcdir}/edgegpt.sh"          "${pkgdir}/usr/bin/edgegpt"

  install -D -v -m644 LICENSE                       "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  for _docfile in example.env README.md; do
    install -D -v -m644 "${_docfile}"               "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  ln -svf "/usr/share/licenses/${pkgname}/LICENSE"  "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE"
}