# Maintainer: zxp19821005 pkgname=jlivertool _pkgname=JLiverTool pkgver=2.1.3 _electronversion=26 pkgrel=1 pkgdesc="Bilibili 弹幕机" arch=('x86_64') url="https://github.com/Xinrea/JLiverTool" license=('MIT') provides=("${pkgname}") conflicts=("${pkgname}") depends=( "electron${_electronversion}" 'java-runtime' ) makedepends=( 'npm' 'nodejs' 'gendesk' 'curl' ) source=( "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz" "${pkgname}.sh" ) sha256sums=('cd9475ba1bbfefa1d22628b16a8528fcd68571d05d9931262c14bbc1f478bdb7' '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051') build() { sed -e "s|@electronversion@|${_electronversion}|" \ -e "s|@appname@|${pkgname}|g" \ -e "s|@runname@|app.asar|g" \ -e "s|@cfgdirname@|${pkgname}|g" \ -e "s|@options@||g" \ -i "${srcdir}/${pkgname}.sh" gendesk -q -f -n --pkgname="${pkgname}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${_pkgname}" --exec="${pkgname} %U" cd "${srcdir}/${_pkgname}-${pkgver}" export npm_config_build_from_source=true export npm_config_cache="${srcdir}/.npm_cache" export ELECTRON_SKIP_BINARY_DOWNLOAD=1 #export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')" #export npm_config_target="${SYSTEM_ELECTRON_VERSION}" #export ELECTRONVERSION="${_electronversion}" HOME="${srcdir}/.electron-gyp" if [ `curl -s ipinfo.io/country | grep CN | wc -l ` -ge 1 ];then export npm_config_registry=https://registry.npmmirror.com export npm_config_disturl=https://registry.npmmirror.com/-/binary/node/ export npm_config_electron_mirror=https://registry.npmmirror.com/-/binary/electron/ export npm_config_electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ else echo "Your network is OK." fi sed "s|--linux|-l --dir|g" -i package.json npm install npm run build-linux } package() { install -Dm755 "${srcdir}/${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" install -Dm644 "${srcdir}/${_pkgname}-${pkgver}/dist/linux-"*/resources/app.asar -t "${pkgdir}/usr/lib/${pkgname}" cp -r "${srcdir}/${_pkgname}-${pkgver}/dist/linux-"*/resources/app.asar.unpacked "${pkgdir}/usr/lib/${pkgname}" install -Dm644 "${srcdir}/${pkgname}.desktop" -t "${pkgdir}/usr/share/applications" install -Dm644 "${srcdir}/${_pkgname}-${pkgver}/LICENSE.md" -t "${pkgdir}/usr/share/licenses/${pkgname}" }