summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorsukanka2022-10-20 09:52:24 +0800
committersukanka2022-10-20 09:52:24 +0800
commita39d86ca5fdf430259d76def2218d9375cda46ec (patch)
tree8307488a32fa455de46222c05fb94f8181c320e9
parent0106e2051e3ef705664a35699b1150a8402d1889 (diff)
downloadaur-a39d86ca5fdf430259d76def2218d9375cda46ec.tar.gz
optimize PKGBUILD
-rwxr-xr-x.SRCINFO18
-rwxr-xr-x.gitignore3
-rwxr-xr-xPKGBUILD51
-rw-r--r--listen1.desktop12
-rw-r--r--listen1.sh3
5 files changed, 52 insertions, 35 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d1287a97761f..433e6100b855 100755
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,19 +1,23 @@
pkgbase = listen1-desktop
pkgdesc = One for all free music in China (Build from source)
pkgver = 2.26.2
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/listen1/listen1_desktop
- arch = x86_64
- arch = i686
+ arch = any
license = MIT
makedepends = npm
- makedepends = git
- depends = electron13-bin
+ makedepends = jq
+ makedepends = moreutils
+ depends = electron13
provides = listen1
conflicts = listen1
source = listen1-desktop-2.26.2.src.tar.gz::https://github.com/listen1/listen1_desktop/archive/v2.26.2.tar.gz
- source = git+https://github.com/listen1/listen1_chrome_extension.git#commit=48c61747768a7b7ee99498cc33930fdf639c0bc8
+ source = chrome_extension-2.26.2.tar.gz::https://github.com/listen1/listen1_chrome_extension/archive/refs/tags/v2.26.2.tar.gz
+ source = listen1.sh
+ source = listen1.desktop
sha256sums = b0c78cc08b69730930919cdf604e1767f9b9796a7676cfc3c31b5ce4a509878d
- sha256sums = SKIP
+ sha256sums = 7bf4e4ba07797bb4183a413e7c1df144671da4727829d2862ea1e831edafea7f
+ sha256sums = 6e13f2757600659fe5d48ba88bc24ae632049c2f4c3f1a8c95eac75fba4e38d2
+ sha256sums = 4fb54621e98ddd1cfe8d10619d193256fd0702b58ab01736aec512765f43d9df
pkgname = listen1-desktop
diff --git a/.gitignore b/.gitignore
index b49d0e2cecd9..19d37e443dcc 100755
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ src
pkg
*.src.tar.gz
*.pkg.tar.zst
-listen1_chrome_extension \ No newline at end of file
+listen1_chrome_extension
+*.tar.gz
diff --git a/PKGBUILD b/PKGBUILD
index cc36c98e8de1..c82c1344f8d8 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,34 +3,45 @@
# Contributor: Bruce Zhang
pkgname=listen1-desktop
pkgver=2.26.2
-pkgrel=1
-listen1_commit=48c61747768a7b7ee99498cc33930fdf639c0bc8
+_electron=electron13
+pkgrel=2
pkgdesc="One for all free music in China (Build from source)"
-arch=('x86_64' 'i686')
+arch=('any')
url="https://github.com/listen1/listen1_desktop"
license=('MIT')
-depends=('electron13-bin')
-makedepends=('npm' 'git')
+depends=("${_electron}")
+makedepends=('npm' 'jq' 'moreutils')
provides=('listen1')
conflicts=('listen1')
source=(
- "$pkgname-$pkgver.src.tar.gz::$url/archive/v$pkgver.tar.gz"
- "git+https://github.com/listen1/listen1_chrome_extension.git#commit=$listen1_commit"
+ "$pkgname-$pkgver.src.tar.gz::https://github.com/listen1/listen1_desktop/archive/v$pkgver.tar.gz"
+ "chrome_extension-${pkgver}.tar.gz::https://github.com/listen1/listen1_chrome_extension/archive/refs/tags/v${pkgver}.tar.gz"
+ "listen1.sh"
+ "listen1.desktop"
)
sha256sums=('b0c78cc08b69730930919cdf604e1767f9b9796a7676cfc3c31b5ce4a509878d'
- 'SKIP')
+ '7bf4e4ba07797bb4183a413e7c1df144671da4727829d2862ea1e831edafea7f'
+ '6e13f2757600659fe5d48ba88bc24ae632049c2f4c3f1a8c95eac75fba4e38d2'
+ '4fb54621e98ddd1cfe8d10619d193256fd0702b58ab01736aec512765f43d9df')
prepare() {
cd "${pkgname/-/_}-$pkgver"
- electronDist="\/usr\/lib\/electron13"
- electronVersion="tail /usr/lib/electron13/version"
- sed -i "s#\"productName\": \"Listen1\",/\"productName\": \"Listen1\",\"electronDist\": \"$electronDist\",\"electronVersion\": \"$electronVersion\",##" package.json
- rmdir app/listen1_chrome_extension
- cp -r "$srcdir/listen1_chrome_extension" app/listen1_chrome_extension
+
+ local electronDist="/usr/lib/${_electron}"
+ local electronVersion="$(< $electronDist/version)"
+ jq ".devDependencies.electron = \"$electronVersion\"" package.json | sponge package.json
+ jq ".build.electronDist = \"$electronDist\"" package.json | sponge package.json
+ jq ".build.electronVersion = \"$electronVersion\"" package.json | sponge package.json
+
+ cp -rf "$srcdir/listen1_chrome_extension-$pkgver"/* app/listen1_chrome_extension
+
+ sed -i "s|__ELECTRON__|${_electron}|g" ${srcdir}/listen1.sh
+ sed -i "s|__PKGVER__|${pkgver}|g" ${srcdir}/listen1.desktop
}
build() {
cd "${pkgname/-/_}-$pkgver"
+ export HOME=${srcdir}
npm install
npm run dist:linux64 -- --dir
}
@@ -42,23 +53,9 @@ package() {
install -Dm644 resources/app.asar "$pkgdir/usr/share/listen1/app.asar"
# Install start script
- echo "#!/usr/bin/env sh
-exec /usr/lib/electron13/electron /usr/share/listen1/app.asar" > "$srcdir/listen1.sh"
install -Dm755 "$srcdir/listen1.sh" "$pkgdir/usr/bin/listen1"
# Install desktop file
- echo "[Desktop Entry]
-Name=Listen1
-Comment=One for all free music in China
-Exec=/usr/bin/listen1
-Terminal=false
-Type=Application
-Icon=listen1
-StartupWMClass=Listen1
-X-AppImage-Version=2.26.2
-Categories=Utility;
-X-AppImage-BuildId=1HvKDJ3EUJMJwm6YxKB8wQfQx3p
-" > "$srcdir/listen1.desktop"
install -Dm644 "$srcdir/listen1.desktop" "$pkgdir/usr/share/applications/listen1.desktop"
# Install icons
diff --git a/listen1.desktop b/listen1.desktop
new file mode 100644
index 000000000000..1e3f74b04a09
--- /dev/null
+++ b/listen1.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=Listen1
+Comment=One for all free music in China
+Exec=listen1 %U
+Terminal=false
+Type=Application
+Icon=listen1
+StartupWMClass=Listen1
+# DO NOT modify __PKGVER__ here, it's updated in PKGBUILD
+X-AppImage-Version=__PKGVER__
+Categories=Utility;
+X-AppImage-BuildId=1HvKDJ3EUJMJwm6YxKB8wQfQx3p
diff --git a/listen1.sh b/listen1.sh
new file mode 100644
index 000000000000..8b0f2743692f
--- /dev/null
+++ b/listen1.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+# DO NOT modify __ELECTRON__ here, it's updated in PKGBUILD
+exec __ELECTRON__ /usr/share/listen1/app.asar