summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiota2024-01-12 08:21:08 -0800
committerxiota2024-01-12 08:21:35 -0800
commit4fc77b2a01659a44d77fef999418218ee24ef2f2 (patch)
treec727644cc317cfc6792ea559f64965751a50fcf2
parentfd2befa4fde1779c8698d83be446e9969c2cacd0 (diff)
downloadaur-4fc77b2a01659a44d77fef999418218ee24ef2f2.tar.gz
2.0.11.r3
-rw-r--r--.SRCINFO24
-rw-r--r--PKGBUILD193
-rw-r--r--vdhcoapp-fix-paths.patch13
-rw-r--r--vdhcoapp-install.hook10
-rw-r--r--vdhcoapp-remove.hook9
-rw-r--r--vdhcoapp.install11
6 files changed, 155 insertions, 105 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 9382573917ef..96934dfe5239 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,26 +1,22 @@
pkgbase = vdhcoapp-git
pkgdesc = Companion application for Video DownloadHelper browser add-on
- pkgver = 1.6.3.r36.gedad10d
- pkgrel = 2
+ pkgver = 2.0.11.r3.gfb9d8d2
+ pkgrel = 1
url = https://github.com/aclap-dev/vdhcoapp
+ install = vdhcoapp.install
arch = x86_64
- license = GPL2
- makedepends = gulp
- makedepends = nodejs
- makedepends = npm
+ license = GPL-2.0-or-later
+ makedepends = esbuild
+ makedepends = jq
makedepends = yq
+ makedepends = nvm
makedepends = git
- provides = vdhcoapp
+ provides = vdhcoapp=2.0.11
conflicts = vdhcoapp
options = !strip
- source = vdhcoapp-install.hook
- source = vdhcoapp-remove.hook
- source = vdhcoapp::git+https://github.com/aclap-dev/vdhcoapp#commit=edad10ddb80dc7e0c9312eb079531a40dd6246db
- source = vdhcoapp-fix-paths.patch
- sha256sums = cd9b85b365f4ba005d382475655a9bb8a59c3d6f23bf490e64dba9f73aae65e0
- sha256sums = 5e256cccaf7a6dff80807b3fdf93f93bce986e3336fc76ea2e67bd4b37c1f98a
+ options = emptydirs
+ source = vdhcoapp::git+https://github.com/aclap-dev/vdhcoapp.git
sha256sums = SKIP
- sha256sums = 83c1e4807232cde3200db85fe31374a327cf6e8f0648f309fd7e560e008b3e6d
pkgname = vdhcoapp-git
depends = ffmpeg
diff --git a/PKGBUILD b/PKGBUILD
index 4c1cdb62596e..928424b13f7e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,94 +1,169 @@
-# Maintainer: xiota / aur.chaotic.cx
+# Maintainer:
-if [ x"$SRCDEST" == "x" ] ; then
- : ${YARN_CACHE_FOLDER:=$startdir/yarn}
+## options
+if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then
+ : ${_autoupdate:=false}
else
- : ${YARN_CACHE_FOLDER:=$SRCDEST/yarn}
+ : ${_autoupdate:=true}
fi
+: ${_build_git:=true}
+
+[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git"
+
+## basic info
_pkgname="vdhcoapp"
-pkgname="$_pkgname-git"
-pkgver=1.6.3.r36.gedad10d
-pkgrel=2
+pkgname="$_pkgname${_pkgtype:-}"
+pkgver=2.0.11.r3.gfb9d8d2
+pkgrel=1
pkgdesc="Companion application for Video DownloadHelper browser add-on"
-arch=('x86_64')
url="https://github.com/aclap-dev/vdhcoapp"
-license=('GPL2')
-depends=()
-makedepends=(
- 'gulp'
- 'nodejs'
- 'npm'
- 'yq'
-)
-
-options=(!strip)
-
-source=(
- "vdhcoapp-install.hook"
- "vdhcoapp-remove.hook"
-)
-sha256sums=(
- 'cd9b85b365f4ba005d382475655a9bb8a59c3d6f23bf490e64dba9f73aae65e0'
- '5e256cccaf7a6dff80807b3fdf93f93bce986e3336fc76ea2e67bd4b37c1f98a'
-)
-
-if [ x"$_pkgname" != x"$pkgname" ] ; then
+license=('GPL-2.0-or-later')
+arch=('x86_64')
+
+_main_package() {
+ makedepends=(
+ 'esbuild'
+ 'jq'
+ 'yq'
+
+ # AUR
+ 'nvm'
+ )
+
+ options=(!strip emptydirs)
+ install="$_pkgname.install"
+
+ if [ "${_build_git::1}" != "t" ] ; then
+ _main_stable
+ else
+ _main_git
+ fi
+}
+
+# stable package
+_main_stable() {
+ _update_version
+
+ _pkgsrc="$_pkgname-${_pkgver:?}"
+ _pkgext="tar.gz"
+ source+=("$_pkgsrc.$_pkgext"::"$url/archive/v$_pkgver.$_pkgext")
+ sha256sums+=('SKIP')
+
+ pkgver() {
+ echo "${_pkgver:?}"
+ }
+}
+
+# git package
+_main_git() {
makedepends+=('git')
- provides=("$_pkgname")
+ provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")
_pkgsrc="$_pkgname"
- _commit='edad10ddb80dc7e0c9312eb079531a40dd6246db'
-
- source+=(
- "$_pkgsrc"::"git+$url#commit=$_commit"
- "vdhcoapp-fix-paths.patch"
- )
- sha256sums+=(
- 'SKIP'
- '83c1e4807232cde3200db85fe31374a327cf6e8f0648f309fd7e560e008b3e6d'
- )
+ source+=("$_pkgsrc"::"git+$url.git")
+ sha256sums+=('SKIP')
pkgver() {
- cd "$srcdir/$_pkgname"
+ cd "$_pkgsrc"
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
-fi
-
+}
+# common functions
prepare() {
- cd "$srcdir/$_pkgsrc"
-
- for patch in "$srcdir"/*.patch ; do
- if [ -f "$patch" ] ; then
- printf 'Applying patch: %s\n' "${patch##*/}"
- patch -Np1 -F100 -i "$patch"
- fi
- done
+ cd "$_pkgsrc"
+ mv -f app/* .
+
+ # create config.json
+ tomlq . ./config.toml \
+ | jq '.target.os = "linux"' \
+ | jq '.target.arch = "amd64"' \
+ > 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&'
}
build() {
- cd "$srcdir/$_pkgsrc"
+ : ${_nodeversion:=18}
+
+ export HOME="$srcdir/node-home"
+ export NVM_DIR="${SRCDEST:-${startdir:-$srcdir}}/node-nvm"
+
+ # set up nvm
+ source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
+ nvm install $_nodeversion
+ nvm use $_nodeversion
+
+ # build
+ 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
+ )
- npm install
+ esbuild "${_esbuild_options[@]}"
- gulp
+ local _pkg_options=(
+ bundled.js
+ --target "node$_nodeversion-linux-x64"
+ --output vdhcoapp
+ )
+
+ ./node_modules/.bin/pkg "${_pkg_options[@]}"
}
package() {
depends+=('ffmpeg')
- cd "$srcdir/$_pkgsrc"
+ cd "$_pkgsrc"
- install -Dm755 bin/net.downloadhelper.coapp-* "$pkgdir/usr/bin/vdhcoapp"
- install -Dm644 config.json "$pkgdir/usr/share/vdhcoapp/config.json"
+ 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/"
+}
+
+# update version
+_update_version() {
+ : ${_pkgver:=${pkgver%%.r*}}
- install -Dm644 "$srcdir/vdhcoapp-install.hook" "$pkgdir/usr/share/libalpm/hooks/vdhcoapp-install.hook"
- install -Dm644 "$srcdir/vdhcoapp-remove.hook" "$pkgdir/usr/share/libalpm/hooks/vdhcoapp-remove.hook"
+ if [[ "${_autoupdate::1}" != "t" ]] ; then
+ return
+ fi
+
+ local _response=$(curl -Ssf "$url/releases.atom")
+ local _tag=$(
+ printf '%s' "$_response" \
+ | grep '"https://.*/releases/tag/.*"' \
+ | sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \
+ | grep -Ev '[a-z]{2}' | sort -rV | head -1
+ )
+ local _pkgver_new="${_tag#v}"
+
+ # update _pkgver
+ if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then
+ _pkgver="${_pkgver_new:?}"
+ fi
}
+
+# execute
+_main_package
diff --git a/vdhcoapp-fix-paths.patch b/vdhcoapp-fix-paths.patch
deleted file mode 100644
index ec2c5d50e766..000000000000
--- a/vdhcoapp-fix-paths.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Description: Fix linux paths
-
---- vdhcoapp.old/app/native-autoinstall.js
-+++ vdhcoapp.new/app/native-autoinstall.js
-@@ -64,7 +64,7 @@
- }
- let config;
- try {
-- config = JSON.parse(fs.readFileSync(path.resolve(path.dirname(process.execPath), "./config.json"), "utf8"));
-+ config = JSON.parse(fs.readFileSync(path.resolve(path.dirname(process.execPath), "../share/vdhcoapp/config.json"), "utf8"));
- } catch (err) {
- DisplayMessage("Cannot read config file: " + err.message, "Error");
- process.exit(-1);
diff --git a/vdhcoapp-install.hook b/vdhcoapp-install.hook
deleted file mode 100644
index 59d0767fdf56..000000000000
--- a/vdhcoapp-install.hook
+++ /dev/null
@@ -1,10 +0,0 @@
-[Trigger]
-Operation = Install
-Operation = Upgrade
-Type = Package
-Target = vdhcoapp-git
-
-[Action]
-Description = Installing JSON configuration file ...
-When = PostTransaction
-Exec = /usr/bin/vdhcoapp install --system
diff --git a/vdhcoapp-remove.hook b/vdhcoapp-remove.hook
deleted file mode 100644
index c4c727638789..000000000000
--- a/vdhcoapp-remove.hook
+++ /dev/null
@@ -1,9 +0,0 @@
-[Trigger]
-Operation = Remove
-Type = Package
-Target = vdhcoapp-git
-
-[Action]
-Description = Uninstalling JSON configuration file ...
-When = PreTransaction
-Exec = /usr/bin/vdhcoapp uninstall --system
diff --git a/vdhcoapp.install b/vdhcoapp.install
new file mode 100644
index 000000000000..0a7e0a2c14db
--- /dev/null
+++ b/vdhcoapp.install
@@ -0,0 +1,11 @@
+post_install() {
+ /usr/bin/vdhcoapp install --system
+}
+
+post_upgrade() {
+ /usr/bin/vdhcoapp install --system
+}
+
+pre_remove() {
+ /usr/bin/vdhcoapp uninstall --system
+}