summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ed798445b08b2f6eff63b160b36b834677edc62 (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
# Maintainer: Ruben Kharel <aur-at-rubenk-dot-dev>
# Contributor: Fabian Bornschein <fabiscafe-cat-mailbox-dog-org>

pkgname=chatgpt-desktop-git
_pkgname=ChatGPT
pkgver=1.1.0+r8+gfe4f231
pkgrel=1
pkgdesc="ChatGPT Desktop Application (Mac, Windows and Linux)"
arch=('x86_64'
      'i686' #ArchLinux32
      'armv7h' #ArchLinuxARM
      'aarch64') #ArchLinuxARM
url="https://github.com/lencx/ChatGPT"
license=("Apache")
provides=("chatgpt-desktop")
conflicts=("chatgpt-desktop")
makedepends=("imagemagick"
             "git"
			"cargo")
depends=("hicolor-icon-theme"
         "openssl"
         "webkit2gtk")

source=("git+https://github.com/lencx/ChatGPT.git"
        chat-gpt.desktop)
sha256sums=('SKIP' 'fe7aaba6e26b964adba2cbf87bd415cbe928ea06ebea5317d177cfa1576eb9f5')

pkgver() {
	cd "${_pkgname}"
	git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
	# Set CARGO_HOME to "${srcdir}/cargo"
	export CARGO_HOME="${srcdir}/cargo"
	if [ ! -d "${_pkgname}/dist" ]; then 
		mkdir "${_pkgname}/dist"
	fi
	
	# Download Rust dependencies
	cd "${_pkgname}"
	cargo fetch --locked
}

build() {
	cd "${_pkgname}"
	export RUSTUP_TOOLCHAIN=stable
  	export CARGO_TARGET_DIR=target
	cargo build --release --all-features # --frozen removed because some csv failed to download although everything required was already download
	# will debug later
}

package() {
	# Set CARGO_HOME to "${srcdir}/cargo"
	export CARGO_HOME="${srcdir}/cargo"

	# Install desktop file
	install -Dm644 "${srcdir}/chat-gpt.desktop" -t "${pkgdir}/usr/share/applications"

	# Install binary
	install -Dm755 "${srcdir}/${_pkgname}/target/release/chatgpt" \
		"${pkgdir}/usr/bin/chat-gpt"
	
	# Generate and install Icons
	for size in 8 16 20 22 24 32 48 64 96 128 192 256 512; do
		install -dm 755 "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps"

		convert -resize ${size}x${size} "${srcdir}/${_pkgname}/public/logo.png" \
			"${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/chat-gpt.png"
	done	
}