summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a7a94298567a2de90cec79d5e345b4313bbe5287 (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
# Contributor MYT1 <MYT1 @ YAHOO.com>

pkgname=linkandroid-git
_pkgname=LinkAndroid
pkgdesc="Link android to PC easily"
pkgver=20241123.05d1bea
pkgrel=1
arch=('x86_64' 'arm64')
url=https://linkandroid.com/
licence=(GPL-3.0)
depends=('hicolor-icon-theme'
    'gtk3'
    'libnotify'
    'nss'
    'libxss'
    'libxtst'
    'xdg-utils'
    'at-spi2-core'
    'util-linux-libs'
    'libsecret'
    'libappindicator-gtk3'
    "electron${_electronversion}"
    "ffmpeg")
makedepends=('asar'
    'npm'
    'nvm'
    'pnpm'
)
conflicts=("${pkgname%-git}"
    "${pkgname%-git}-bin"
)
source=("git+https://gitee.com/modstart-lib/linkandroid.git")
sha256sums=('SKIP')
_electronversion=33
_nodeversion=23

pkgver(){
    cd "${srcdir}/${pkgname%-git}"

    # Commit date + short rev
    echo $(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d HEAD).$(git rev-parse --short HEAD)
}

prepare(){
    npm config set registry https://registry.npmmirror.com
    git -C "${srcdir}/${pkgname%-git}" clean -dfx

	cd "${srcdir}/${pkgname%-git}"
	npm install
}

build(){
	cd "${srcdir}/${pkgname%-git}"
	gendesk -q -f -n --pkgname="${pkgname%-git}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${_pkgname}" --exec="${pkgname%-git} %U" --comment="Link android to PC easily" --icon="${pkgname%-git}"
	sed -i '114,120d' electron-builder.json5
	npm run build:linux --dir
}

package(){
	_arch=$(node -e "os=require('os'); console.log(os.arch());")-
	if [ ${_arch}==x64- ]
	then
		_arch=""
	fi
	cd "${srcdir}/${pkgname%-git}/dist-release/linux-unpacked"
	mkdir -p "${pkgdir}/opt/${pkgname%-git}"
	cp -r * "${pkgdir}/opt/${pkgname%-git}"
	mkdir -p "${pkgdir}/usr/bin"
	ln -s "/opt/${pkgname%-git}/${pkgname%-git}" "${pkgdir}/usr/bin/${pkgname%-git}"
	sed -i '5i\Name[zh_CN]=安卓投屏' "${srcdir}/${pkgname%-git}/${pkgname%-git}.desktop"
	install -Dm644 "${srcdir}/${pkgname%-git}/${pkgname%-git}.desktop" "${pkgdir}/usr/share/applications/${pkgname%-git}.desktop"
	install -Dm644 "${srcdir}/${pkgname%-git}/dist/logo.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/${pkgname%-git}.svg"
	install -Dm644 "${srcdir}/${pkgname%-git}/dist/logo-white.svg" "${pkgdir}/usr/share/pixmaps/${pkgname%-git}.svg"
}