2024-03-23 14:32:32 +00:00
|
|
|
# Maintainer:
|
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
: ${CARGO_HOME:=$SRCDEST/cargo-home}
|
|
|
|
: ${_nodeversion:=18}
|
|
|
|
|
2024-03-23 14:32:32 +00:00
|
|
|
_pkgname="vdhcoapp"
|
2024-03-28 04:07:04 +00:00
|
|
|
pkgname="$_pkgname-git"
|
2024-12-20 16:12:11 +00:00
|
|
|
pkgver=2.0.20.r4.gf8cc614
|
2024-12-20 23:04:24 +00:00
|
|
|
pkgrel=8
|
2024-03-23 14:32:32 +00:00
|
|
|
pkgdesc="Companion application for Video DownloadHelper browser add-on"
|
|
|
|
url="https://github.com/aclap-dev/vdhcoapp"
|
|
|
|
license=('GPL-2.0-or-later')
|
|
|
|
arch=('x86_64')
|
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_source_vdhcoapp() {
|
|
|
|
makedepends=(
|
|
|
|
'esbuild'
|
|
|
|
'jq'
|
|
|
|
'nvm' # AUR
|
|
|
|
'yq'
|
|
|
|
)
|
2024-05-30 23:03:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
options=('emptydirs' '!strip' '!debug')
|
|
|
|
install="$_pkgname.install"
|
2024-05-30 23:03:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
provides=("$_pkgname=${pkgver%%.r*}")
|
|
|
|
conflicts=("$_pkgname")
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_pkgsrc="$_pkgname"
|
|
|
|
source=("$_pkgsrc"::"git+$url.git")
|
|
|
|
sha256sums=('SKIP')
|
2024-03-23 14:32:32 +00:00
|
|
|
}
|
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_source_filepicker() {
|
|
|
|
depends+=(
|
|
|
|
'gtk3'
|
|
|
|
)
|
|
|
|
makedepends+=(
|
|
|
|
'cargo'
|
|
|
|
'git'
|
|
|
|
)
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_filepicker_url="https://github.com/paulrouget/static-filepicker"
|
|
|
|
_filepicker_pkgsrc="vdhcoapp-filepicker"
|
|
|
|
source+=("$_filepicker_pkgsrc"::"git+$_filepicker_url.git")
|
|
|
|
sha256sums+=('SKIP')
|
2024-03-23 14:32:32 +00:00
|
|
|
}
|
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_prepare_vdhcoapp() (
|
2024-03-23 14:32:32 +00:00
|
|
|
cd "$_pkgsrc"
|
|
|
|
mv -f app/* .
|
|
|
|
|
|
|
|
# create config.json
|
|
|
|
tomlq . ./config.toml \
|
|
|
|
| jq '.target.os = "linux"' \
|
|
|
|
| jq '.target.arch = "amd64"' \
|
2024-12-20 16:12:11 +00:00
|
|
|
| jq ".meta.version = \"${pkgver%%.r*}\"" \
|
2024-05-30 23:03:32 +00:00
|
|
|
> src/config.json
|
2024-03-23 14:32:32 +00:00
|
|
|
|
|
|
|
# fix path to config.json
|
|
|
|
sed -E -i src/main.js src/native-autoinstall.js \
|
|
|
|
-e 's&^(const config = require\('\'')(config.json'\''\);)$&\1./\2&'
|
2024-12-20 16:12:11 +00:00
|
|
|
)
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_prepare_filepicker() (
|
|
|
|
_cargo_env
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
cd "$_filepicker_pkgsrc"
|
|
|
|
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
|
|
|
|
)
|
|
|
|
|
|
|
|
_build_vdhcoapp() (
|
2024-05-30 23:03:32 +00:00
|
|
|
_nvm_env
|
2024-03-23 14:32:32 +00:00
|
|
|
|
|
|
|
cd "$_pkgsrc"
|
|
|
|
|
|
|
|
npm install --no-package-lock --no-audit --no-fund --prefer-offline
|
|
|
|
npm install pkg --no-package-lock --no-audit --no-fund --prefer-offline
|
|
|
|
|
|
|
|
local _esbuild_options=(
|
|
|
|
src/main.js
|
|
|
|
--target=esnext
|
|
|
|
"--banner:js=const _importMetaUrl=require('url').pathToFileURL(__filename)"
|
|
|
|
"--define:import.meta.url=_importMetaUrl"
|
|
|
|
--format=cjs
|
|
|
|
--bundle
|
|
|
|
--platform=node
|
|
|
|
--tree-shaking=true
|
|
|
|
--alias:electron=electron2
|
|
|
|
--outfile=bundled.js
|
|
|
|
)
|
|
|
|
|
|
|
|
esbuild "${_esbuild_options[@]}"
|
|
|
|
|
|
|
|
local _pkg_options=(
|
|
|
|
bundled.js
|
|
|
|
--target "node$_nodeversion-linux-x64"
|
|
|
|
--output vdhcoapp
|
|
|
|
)
|
|
|
|
|
|
|
|
./node_modules/.bin/pkg "${_pkg_options[@]}"
|
2024-12-20 16:12:11 +00:00
|
|
|
)
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_build_filepicker() (
|
|
|
|
_cargo_env
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
cd "$_filepicker_pkgsrc"
|
|
|
|
cargo build --frozen --release --all-features
|
|
|
|
)
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_package_vdhcoapp() (
|
2024-03-23 14:32:32 +00:00
|
|
|
cd "$_pkgsrc"
|
|
|
|
install -Dm755 vdhcoapp -t "$pkgdir/usr/bin/"
|
|
|
|
|
|
|
|
install -dm755 "$pkgdir/usr/lib/mozilla/native-messaging-hosts/"
|
|
|
|
install -dm755 "$pkgdir/etc/opt/chrome/native-messaging-hosts/"
|
|
|
|
install -dm755 "$pkgdir/etc/chromium/native-messaging-hosts/"
|
|
|
|
install -dm755 "$pkgdir/etc/opt/edge/native-messaging-hosts/"
|
2024-12-20 16:12:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
_package_filepicker() (
|
|
|
|
_cargo_env
|
|
|
|
install -Dm755 "$_filepicker_pkgsrc/$CARGO_TARGET_DIR/release/filepicker" -t "$pkgdir/usr/bin/"
|
|
|
|
)
|
|
|
|
|
|
|
|
_cargo_env() {
|
|
|
|
export CARGO_HOME
|
|
|
|
export RUSTUP_TOOLCHAIN=stable
|
|
|
|
export CARGO_TARGET_DIR=target
|
|
|
|
}
|
|
|
|
|
|
|
|
_nvm_env() {
|
|
|
|
export HOME="$SRCDEST/node-home"
|
|
|
|
export NVM_DIR="$SRCDEST/node-nvm"
|
|
|
|
|
|
|
|
# set up nvm
|
|
|
|
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
|
|
|
|
nvm install $_nodeversion
|
|
|
|
nvm use $_nodeversion
|
|
|
|
}
|
|
|
|
|
|
|
|
_source_vdhcoapp
|
|
|
|
_source_filepicker
|
|
|
|
|
|
|
|
prepare() {
|
|
|
|
_prepare_vdhcoapp
|
|
|
|
_prepare_filepicker
|
|
|
|
}
|
|
|
|
|
|
|
|
pkgver() {
|
|
|
|
cd "$_pkgsrc"
|
|
|
|
git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
|
|
|
|
| sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
_build_vdhcoapp
|
|
|
|
_build_filepicker
|
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
|
|
|
depends+=('ffmpeg')
|
2024-03-23 14:32:32 +00:00
|
|
|
|
2024-12-20 16:12:11 +00:00
|
|
|
_package_vdhcoapp
|
|
|
|
_package_filepicker
|
2024-03-23 14:32:32 +00:00
|
|
|
}
|