diff --git a/repo/vdhcoapp-git/PKGBUILD b/repo/vdhcoapp-git/PKGBUILD index 9c67da3..4a85500 100644 --- a/repo/vdhcoapp-git/PKGBUILD +++ b/repo/vdhcoapp-git/PKGBUILD @@ -1,92 +1,52 @@ # Maintainer: +: ${CARGO_HOME:=$SRCDEST/cargo-home} +: ${_nodeversion:=18} + _pkgname="vdhcoapp" pkgname="$_pkgname-git" -pkgver=2.0.19.r4.g0b40d3e -pkgrel=4 +pkgver=2.0.20.r4.gf8cc614 +pkgrel=1 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') -makedepends=( - 'esbuild' - 'jq' - 'yq' +_source_vdhcoapp() { + makedepends=( + 'esbuild' + 'jq' + 'nvm' # AUR + 'yq' + ) - # AUR - 'nvm' -) + options=('emptydirs' '!strip' '!debug') + install="$_pkgname.install" -options=('emptydirs' '!strip' '!debug') -install="$_pkgname.install" + provides=("$_pkgname=${pkgver%%.r*}") + conflicts=("$_pkgname") -provides=("$_pkgname=${pkgver%%.r*}") -conflicts=("$_pkgname") - -_pkgsrc="$_pkgname" -source=("$_pkgsrc"::"git+$url.git") -sha256sums=('SKIP') - -pkgver() { - cd "$_pkgsrc" - git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' + _pkgsrc="$_pkgname" + source=("$_pkgsrc"::"git+$url.git") + sha256sums=('SKIP') } -# filepicker -depends+=( - 'at-spi2-core' - 'gdk-pixbuf2' - 'gtk3' - 'pango' -) -makedepends+=( - 'cargo' - 'git' -) +_source_filepicker() { + depends+=( + 'gtk3' + ) + makedepends+=( + 'cargo' + 'git' + ) -_filepicker_url="https://github.com/paulrouget/static-filepicker" -_filepicker_pkgsrc="vdhcoapp-filepicker" -source+=("$_filepicker_pkgsrc"::"git+$_filepicker_url.git") -sha256sums+=('SKIP') - -_cargo_env() { - export CARGO_HOME="$SRCDEST/cargo-home" - export RUSTUP_TOOLCHAIN=stable - export CARGO_TARGET_DIR=target + _filepicker_url="https://github.com/paulrouget/static-filepicker" + _filepicker_pkgsrc="vdhcoapp-filepicker" + source+=("$_filepicker_pkgsrc"::"git+$_filepicker_url.git") + sha256sums+=('SKIP') } -_nvm_env() { - : ${_nodeversion:=18} - - 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 -} - -_filepicker_prepare() { - _cargo_env - - cd "$srcdir/$_filepicker_pkgsrc" - cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" -} - -_filepicker_build() { - _cargo_env - - cd "$srcdir/$_filepicker_pkgsrc" - cargo build --frozen --release --all-features -} - -_filepicker_package() { - install -Dm755 "$srcdir/$_filepicker_pkgsrc/$CARGO_TARGET_DIR/release/filepicker" -t "$pkgdir/usr/bin/" -} - -prepare() { +_prepare_vdhcoapp() ( cd "$_pkgsrc" mv -f app/* . @@ -94,19 +54,24 @@ prepare() { tomlq . ./config.toml \ | jq '.target.os = "linux"' \ | jq '.target.arch = "amd64"' \ + | jq ".meta.version = \"${pkgver%%.r*}\"" \ > src/config.json # fix path to config.json sed -E -i src/main.js src/native-autoinstall.js \ -e 's&^(const config = require\('\'')(config.json'\''\);)$&\1./\2&' +) - _filepicker_prepare -} +_prepare_filepicker() ( + _cargo_env -build() { + cd "$_filepicker_pkgsrc" + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" +) + +_build_vdhcoapp() ( _nvm_env - # build cd "$_pkgsrc" npm install --no-package-lock --no-audit --no-fund --prefer-offline @@ -134,21 +99,68 @@ build() { ) ./node_modules/.bin/pkg "${_pkg_options[@]}" +) - _filepicker_build -} +_build_filepicker() ( + _cargo_env -package() { - depends+=('ffmpeg') + cd "$_filepicker_pkgsrc" + cargo build --frozen --release --all-features +) +_package_vdhcoapp() ( 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/" +) - _filepicker_package +_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') + + _package_vdhcoapp + _package_filepicker } diff --git a/repo/vdhcoapp-git/PKGBUILD.filepicker b/repo/vdhcoapp-git/PKGBUILD.filepicker index 7a0b69b..2b7767a 100644 --- a/repo/vdhcoapp-git/PKGBUILD.filepicker +++ b/repo/vdhcoapp-git/PKGBUILD.filepicker @@ -1,6 +1,8 @@ # Maintainer: -_pkgname=vdhcoapp-filepicker +: ${CARGO_HOME:=$SRCDEST/cargo-home} + +_pkgname="vdhcoapp-filepicker" pkgname="$_pkgname" pkgver=1.0.1 pkgrel=1 @@ -10,10 +12,7 @@ license=('GPL-2.0-or-later') arch=('x86_64') depends=( - 'at-spi2-core' - 'gdk-pixbuf2' 'gtk3' - 'pango' ) makedepends=( 'cargo' @@ -25,8 +24,8 @@ source=("$_pkgsrc"::"git+$url.git#tag=v$pkgver") sha256sums=('SKIP') _cargo_env() { - export CARGO_HOME="${CARGO_HOME:-$SRCDEST/cargo-home}" - export RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN:-stable} + export CARGO_HOME + export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target } @@ -45,5 +44,6 @@ build() { } package() { + _cargo_env install -Dm755 "$_pkgsrc/$CARGO_TARGET_DIR/release/filepicker" -t "$pkgdir/usr/bin/" }