summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e61902d1a579d2c0d24b6bb883993c528a141fac (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
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname=bilibili-manga-downloader-bin
_pkgname="Bilibili Manga Downloader"
_zhsname="哔哩哔哩漫画下载器"
pkgver=3.2.2
_electronversion=21
pkgrel=2
pkgdesc="基于现代GUI的跨平台哔哩哔哩漫画下载器(支持特典下载)"
arch=("x86_64")
url="https://github.com/MOMOYATW/bilibili_manga_downloader"
license=('MIT')
provides=("${pkgname%-bin}=${pkgver}")
conflicts=("${pkgname%-bin}")
depends=(
    "electron${_electronversion}"
)
makedepends=(
    'gendesk'
    'asar'
)
options=(
    '!emptydirs'
)
source=(
    "${pkgname%-bin}-${pkgver}.tar.gz::${url}/releases/download/v${pkgver}/${pkgname%-bin}_${pkgver}_linux_amd64.tar.gz"
    "LICENSE-${pkgver}::https://raw.githubusercontent.com/MOMOYATW/bilibili_manga_downloader/main/LICENSE"
    "${pkgname%-bin}.sh"
)
sha256sums=('841cc1c8310d8d83d73ddab34864869e4b74c69f5a35bbbc8fb9a5d668ebd815'
            '9d60cfeddb5c57bfa82b7ece15cc0b270badb5d00cbfbf4d66945a77ee28e662'
            '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051')
build() {
    sed -e "s|@electronversion@|${_electronversion}|" \
        -e "s|@appname@|${pkgname%-bin}|g" \
        -e "s|@runname@|app.asar|g" \
        -e "s|@cfgdirname@|${pkgname%-bin}|g" \
        -e "s|@options@||g" \
        -i "${srcdir}/${pkgname%-bin}.sh"
    gendesk -q -f -n --categories="AudioVideo" --name="${_pkgname}" --exec="${pkgname%-bin} %U"
    sed "3i\Name[zh_CN]=${_zhsname}" -i "${srcdir}/${pkgname%-bin}.desktop"
    asar e "${srcdir}/linux-unpacked/resources/app.asar" "${srcdir}/app.asar.unpacked"
    sed "s|process.resourcesPath|\"\/usr\/lib\/${pkgname%-bin}\"|g" -i "${srcdir}/app.asar.unpacked/app/background.js"
    asar p "${srcdir}/app.asar.unpacked" "${srcdir}/app.asar"
}
package() {
   install -Dm755 "${srcdir}/${pkgname%-bin}.sh" "${pkgdir}/usr/bin/${pkgname%-bin}"
   install -Dm644 "${srcdir}/app.asar" -t "${pkgdir}/usr/lib/${pkgname%-bin}"
   cp -r "${srcdir}/linux-unpacked/resources/"{app.asar.unpacked,static}  "${pkgdir}/usr/lib/${pkgname%-bin}"
   install -Dm644 "${srcdir}/LICENSE-${pkgver}" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
   install -Dm644 "${srcdir}/linux-unpacked/resources/static/icon-64.png" "${pkgdir}/usr/share/pixmaps/${pkgname%-bin}.png"
   install -Dm644 "${srcdir}/${pkgname%-bin}.desktop" -t "${pkgdir}/usr/share/applications"
}