summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a6d7c448fec99749c2e51f9f013da9be21546a21 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=arrowdl
pkgver=4.0.2
pkgrel=1
pkgdesc="A mass download manager that helps you to select, organize, prioritize and run your downloads in parallel."
arch=('x86_64')
url="https://www.arrow-dl.com/ArrowDL"
license=('LGPL-3.0-or-later AND CC-BY-SA-3.0')
depends=('libtorrent-rasterbar' 'qt6-base' 'yt-dlp')
makedepends=('boost' 'cmake' 'qt6-tools')
conflicts=('downzemall')
source=("$pkgname-$pkgver.tar.gz::https://github.com/setvisible/ArrowDL/archive/v$pkgver.tar.gz")
sha256sums=('14dd870d4f5d9a749e77a79167e01044a552d77fbe66e878ac5e10b47f336e41')

prepare() {
  cd "ArrowDL-$pkgver"

  # set absolute path to app directory
  sed -i 's|ABSOLUTE/PATH/TO/APP/DIRECTORY|opt/arrowdl|g' \
    web-extension/launcher/unix/*.json

  # Look for system shared object, not source archive
  sed -i 's/libtorrent-rasterbar.a/libtorrent-rasterbar.so/g' \
    cmake/Modules/FindLibtorrentRasterbar.cmake
}

build() {
  cmake -B build -S "ArrowDL-$pkgver" \
    -DCMAKE_BUILD_TYPE='RelWithDebInfo' \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DCMAKE_SKIP_RPATH='YES' \
    -DBUILD_TESTS='OFF' \
    -DLibtorrentRasterbar_LIBRARIES='/usr/lib/libtorrent-rasterbar.so' \
    -DOPENSSL_INCLUDE_DIRS='/usr/include/openssl' \
    -DOPENSSL_CRYPTO_LIBRARY='/usr/lib/libcrypto.so' \
    -DOPENSSL_SSL_LIBRARY='/usr/lib/libssl.so' \
    -Wno-dev
  cmake --build build
}

package() {
  cd "ArrowDL-$pkgver"
  install -Dm755 ../build/src/ArrowDL -t "$pkgdir/opt/$pkgname/"
  install -Dm755 ../build/web-extension/launcher/launcher -t "$pkgdir/opt/$pkgname/"
  install -Dm644 ../build/src/*.qm -t "$pkgdir/opt/$pkgname/locale/"

  install -Dm644 web-extension/launcher/unix/launcher-manifest-chrome.json \
    "$pkgdir/etc/chromium/native-messaging-hosts/com.setvisible.arrowdl.json"
  install -Dm644 web-extension/launcher/unix/launcher-manifest-chrome.json \
    "$pkgdir/etc/opt/chrome/native-messaging-hosts/com.setvisible.arrowdl.json"
  install -Dm644 web-extension/launcher/unix/launcher-manifest-firefox.json \
    "$pkgdir/usr/lib/mozilla/native-messaging-hosts/ArrowDL.json"

  install -Dm644 src/resources/logo/LICENSE.txt \
    "$pkgdir/usr/share/licenses/$pkgname/LOGO_LICENSE.txt"

  install -Dm644 installer/unix/appimage/ArrowDL.desktop -t \
    "$pkgdir/usr/share/applications/"

  install -Dm644 src/resources/logo/ArrowDL.svg -t \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/"
  for i in 16 24 32 48 64 128 256 512 1024; do
    install -Dm644 "src/resources/logo/icon${i}.png" \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/ArrowDL.png"
  done

  install -d "$pkgdir/usr/bin"
  ln -s "/opt/$pkgname/ArrowDL" "$pkgdir/usr/bin/"

  # Use system yt-dlp
  ln -s /usr/bin/yt-dlp "$pkgdir/opt/$pkgname/"

  # Allow write permissions to queue.json
  touch "$pkgdir/opt/$pkgname/queue.json"
  chmod 777 "$pkgdir/opt/$pkgname/queue.json"
}