summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 709b09211d3adfc50871173ebaa46086e7c30c5c (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
# Maintainer: Szentesi Botond
pkgname=powercord-git
_pkgname=powercord
patches=powercord-patches

pkgver=r1178.41cb7ce
pkgrel=1
pkgdesc="A lightweight discord client mod focused on simplicity and performance."
arch=("any")
url="https://github.com/powercord-org/$_pkgname"
license=('Parkord')
depends=('nodejs')
makedepends=('git' 'npm' 'jq')
source=("git+https://github.com/powercord-org/powercord#branch=v2"
	"git+https://github.com/botiapa/powercord-patches"
       )
md5sums=('SKIP'
         'SKIP'
        )
options=('!strip')

prepare() {
  patch -u ${srcdir}/${_pkgname}/injectors/index.js -i ${srcdir}/${patches}/index.js.patch
  patch -u ${srcdir}/${_pkgname}/injectors/main.js -i ${srcdir}/${patches}/main.js.patch
}

pkgver() {
  cd "${srcdir}/${_pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
	cd "${srcdir}/${_pkgname}"
	
	local install_dir="${pkgdir}/opt"
	install -d "${install_dir}"
	cp -a "${srcdir}/${_pkgname}" "${install_dir}"
	chmod 755 "${install_dir}/${_pkgname}"	
	
	cd "${install_dir}/${_pkgname}"
	npm install --only=prod
	
	install -m755 "${srcdir}/${_pkgname}/injectors/index.js"  ${install_dir}/${_pkgname}/injectors/index.js
	install -dm755 "${pkgdir}/usr/bin"
	ln -s "/opt/${_pkgname}/injectors/index.js" "${pkgdir}/usr/bin/powercord"
	
	find "${install_dir}" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
	
	local tmppackage="$(mktemp)"
	local pkgjson="${install_dir}/${_pkgname}/package.json"
	jq '.|=with_entries(select(.key|test("_.+")|not))' "${pkgjson}" > "${tmppackage}"
	mv "${tmppackage}" "${pkgjson}"
	chmod 644 "${pkgjson}"

	chown -R root:root "${install_dir}/${_pkgname}/"
	find "${pkgdir}/usr" -type d -exec chmod 755 {} +

	install -g 0 -o 0 -Dm 0644 "${srcdir}/${patches}/powercord.8" -t ${pkgdir}/usr/share/man/man8/
	gzip ${pkgdir}/usr/share/man/man8/powercord.8

	echo -e "\e[5m\e[101mWARNING"
	echo -e "\e[5m\e[101mWARNING\e[49m \e[91m \e[4mUsing this tool could get you banned. Read the whole disclaimer on the github page!\e[0m\e[39m"	
	echo -e "\e[5m\e[101mWARNING\e[39m\e[49m"
}