summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b21a4bcc6679920e7cef0206475bea5ad97b013d (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
# Maintainer zhanghua <zhanghua.00@qq.com>
# Contributor lyswhut <lyswhut@qq.com>
# Contributor taotieren <admin@taotieren.com>

pkgbase=lx-music-desktop-git
pkgname=(lx-music-desktop-git lx-music-desktop-electron-git)
pkgdesc=一个免费的音乐查找助手
pkgver=2.6.0.959e11b7
pkgrel=1
arch=(x86_64 aarch64 armv7l)
url=https://github.com/lyswhut/lx-music-desktop
licence=(Apache-2.0)
conflicts=('lx-music-desktop')
provides=('lx-music-desktop')
depends=('c-ares' 'ffmpeg' 'gtk3' 'http-parser' 'libevent' 'libvpx' 'libxslt' 'libxss' 'minizip' 'nss' 're2' 'snappy' 'libnotify' 'libappindicator-gtk3')
makedepends=(
	git
	npm)
source=(
	${pkgbase}::git+${url}
	lx-music-desktop.desktop
	lxmusic-url.desktop
	lx-music-desktop)
sha256sums=('SKIP'
            '34342d437c59c6ae352123272daa1819e275c843170bbb8b467cbbc1c4c63dac'
            '83083f9febee2332f9d038bcf5693128f3bde17b41ed094f005265eafe1eb94f'
            '47bc117b8137990e538ab4049f1b2d8b04d3d495432c4002c5343a9331dc59c7')
_electron=electron16

pkgver(){
	cd "${srcdir}/${pkgbase}"
	echo $(git describe --tags | sed s/v//).$(git rev-parse --short HEAD)
}

prepare(){
    git -C "${srcdir}/${pkgbase}" clean -dfx

	cd "${srcdir}/${pkgbase}"
	npm install
}

build(){
	cd "${srcdir}/${pkgbase}"
	npm run pack:dir
}

package_lx-music-desktop-git(){
	_arch=$(node -e "os=require('os'); console.log(os.arch());")-
	if [ ${_arch}==x64- ]
	then
		_arch=""
	fi
	cd "${srcdir}/${pkgbase}/build/linux-${_arch}unpacked"
	mkdir -p "${pkgdir}/opt/${pkgbase//-git/}"
	cp -r * "${pkgdir}/opt/${pkgbase//-git/}"
	mkdir -p "${pkgdir}/usr/bin"
	ln -s /opt/${pkgbase//-git/}/lx-music-desktop "${pkgdir}/usr/bin/lx-music-desktop"
	install -Dm644 "${srcdir}/lx-music-desktop.desktop" "${pkgdir}/usr/share/applications/${pkgbase//-git/}.desktop"
	for size in 16x16 32x32 48x48 64x64 128x128 256x256 512x512
	do
		install -Dm644 "${srcdir}/${pkgbase}/resources/icons/${size}.png" "${pkgdir}/usr/share/icons/hicolor/${size}/apps/${pkgbase//-git/}.png"
	done
	# Enable it when supports url sheme on Linux
	install -Dm644 "${srcdir}/lxmusic-url.desktop" "${pkgdir}/usr/share/applications/lxmusic-url.desktop"
}

package_lx-music-desktop-electron-git(){
	depends+=("${_electron}")
	conflicts+=("lx-music-desktop-electron")
	provides+=("lx-music-desktop-electron")
	pkgdesc+=" (with system electron)"
	_arch=$(node -e "os=require('os'); console.log(os.arch());")-
	if [ ${_arch}==x64- ]
	then
		_arch=""
	fi
	install -Dm644 "${srcdir}/${pkgbase}/build/linux-${_arch}unpacked/resources/app.asar" "${pkgdir}/usr/lib/${pkgbase//-git/}/lx-music-desktop.asar"
	install -Dm755 "${srcdir}/lx-music-desktop" "${pkgdir}/usr/bin/lx-music-desktop"
	sed -i "s/electron/${_electron}/" "${pkgdir}/usr/bin/lx-music-desktop"
	install -Dm644 "${srcdir}/lx-music-desktop.desktop" "${pkgdir}/usr/share/applications/${pkgbase//-git/}.desktop"
	for size in 16x16 32x32 48x48 64x64 128x128 256x256 512x512
	do
		install -Dm644 "${srcdir}/${pkgbase}/resources/icons/${size}.png" "${pkgdir}/usr/share/icons/hicolor/${size}/apps/${pkgbase//-git/}.png"
	done
	# Enable it when supports url sheme on Linux
	install -Dm644 "${srcdir}/lxmusic-url.desktop" "${pkgdir}/usr/share/applications/lxmusic-url.desktop"
}