summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 655d5b3842af5d3827c6f8a40213f4700af56e3c (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
53
54
55
56
# Maintainer: Andrew <aandrew.me@pm.me>
pkgname="ytdownloader-gui"
pkgver=3.18.4
pkgrel=1
pkgdesc="GUI video downloader supporting hundreds of sites"
arch=('any')
url="https://github.com/aandrew-me/ytDownloader"
license=('GPL3')
conflicts=('ytdownloader-gui')
groups=()
depends=('yt-dlp' 'ffmpeg' 'electron')
makedepends=('git' 'npm' 'jq' 'sed')
# install=$pkgname.install
source=("$pkgname-$pkgver::https://github.com/aandrew-me/ytDownloader/archive/refs/tags/v${pkgver}.tar.gz"
'ytdownloader-gui.sh' 'ytdownloader-gui.desktop')
noextract=()
md5sums=('SKIP' 'SKIP' 'SKIP') #autofill using updpkgsums

build() {
    mv "$srcdir"/"ytDownloader-${pkgver}" "$srcdir"/"$pkgname"
    STRING_TO_REPLACE='ffmpeg=cp.execSync("which ffmpeg").toString("utf8").split("\\n")[0]'
    cd "$srcdir"/"$pkgname"
    rm "$srcdir"/"$pkgname/windows.sh"
    rm "$srcdir"/"$pkgname/linux.sh"
    rm -rf "${srcdir}"/"${pkgname}/flatpak"
    jq '.devDependencies = {}' <<<$(<package.json) > package.json

    sed '4,8d' ${srcdir}/${pkgname}/src/renderer.js > ${srcdir}/${pkgname}/src/temp.js
    rm ${srcdir}/${pkgname}/src/renderer.js
    mv ${srcdir}/${pkgname}/src/temp.js ${srcdir}/${pkgname}/src/renderer.js
    sed "4s/.*/$STRING_TO_REPLACE/" ${srcdir}/${pkgname}/src/renderer.js > ${srcdir}/${pkgname}/src/render.js
    rm "$srcdir/${pkgname}/src/renderer.js"
    mv "$srcdir/${pkgname}/src/render.js" "$srcdir/${pkgname}/src/renderer.js"

    npm install

    rm "$srcdir"/"$pkgname/package-lock.json"

}

package() {
  # cd "$srcdir"/"$pkgname"
  mkdir -p ${pkgdir}/usr/share/
  cp -r "$srcdir"/"$pkgname" ${pkgdir}/usr/share/${pkgname}

 # binary wrapper
  install -Dm 775 ${srcdir}/${pkgname}.sh ${pkgdir}/usr/bin/${pkgname}

 # desktop entry
  install -Dm 644 ${srcdir}/${pkgname}.desktop ${pkgdir}/usr/share/applications/${pkgname}.desktop

  # icons
  install -Dm 644 ${srcdir}/${pkgname}/resources/icon.png ${pkgdir}/usr/share/icons/${pkgname}.png


}