File arrowdl.spec of Package arrowdl

#
# spec file for package arrowdl
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           arrowdl
Version:        4.2.1
Release:        0
Summary:        ArrowDL (Arrow Downloader) is a download manager
License:        LGPL-3.0
URL:            https://github.com/setvisible/ArrowDL
Source0:        https://github.com/setvisible/ArrowDL/archive/refs/tags/v%{version}.tar.gz#/ArrowDL-%{version}.tar.gz
BuildRequires:  boost-devel
BuildRequires:  libtorrent-rasterbar-devel
BuildRequires:  qt6-base-devel
BuildRequires:  cmake
BuildRequires:  qt6-tools
BuildRequires:  qt6-tools-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libopenssl-devel
BuildRequires:  cmake(Qt6LinguistTools)
Provides:       ArrowDL = %{version}-%{release}
Requires:       yt-dlp

%description
ArrowDL is a standalone application, embedding its own web engine. That is, it aims to be free and independent, and not rely on any third-party Web Browser technology.

The internal web engine is currently:

- Google Gumbo Parser, for the MinGW and GNU versions.
  Gumbo is a small pure-C HTML5 parser (but doesn't parse Javascript)

- Chromium, for the MSVC version.
  Chromium is a powerful web engine (parses HTML+Javascript)

When we give an URL address to ArrowDL, ArrowDL downloads the page, parses the HTML page and collects the links.
Due to rapid evolution of web technology, ArrowDL is designed to implement new parsers or add existing ones if required.


%prep
%autosetup -p1 -n ArrowDL-%{version}

%build
(
%cmake  \
    -DCMAKE_BUILD_TYPE='RelWithDebInfo' \
    -DCMAKE_INSTALL_PREFIX='%{_prefix}' \
    -DCMAKE_SKIP_RPATH='YES' \
    -DBUILD_TESTS='OFF' \
    -DLibtorrentRasterbar_LIBRARIES='%{_libdir}/libtorrent-rasterbar.so' \
    -DOPENSSL_INCLUDE_DIRS='%{_includedir}/openssl' \
    -DOPENSSL_CRYPTO_LIBRARY='%{_libdir}/libcrypto.so' \
    -DOPENSSL_SSL_LIBRARY='%{_libdir}/libssl.so' \
    -Wno-dev
)

cmake --build %__builddir

%install
  pkgname="%{name}"
  pkgdir="%{buildroot}"

  install -Dm755 %{__builddir}/src/ArrowDL -t "$pkgdir/%{_libdir}/$pkgname/"
  install -Dm755 %{__builddir}/web-extension/launcher/launcher -t "$pkgdir/%{_libdir}/$pkgname/"
  install -Dm644 %{__builddir}/src/*.qm -t "$pkgdir/%{_libdir}/$pkgname/locale/"

  install -Dm644 web-extension/launcher/unix/launcher-manifest-chrome.json \
    "$pkgdir/%{_sysconfdir}/chromium/native-messaging-hosts/com.arrowdl.extension.json"
  install -Dm644 web-extension/launcher/unix/launcher-manifest-firefox.json \
    "$pkgdir%{_libdir}/mozilla/native-messaging-hosts/com.arrowdl.extension.json"

  install -Dm644 src/resources/logo/LICENSE.txt \
    "$pkgdir/%{_datadir}/licenses/$pkgname/LOGO_LICENSE.txt"

  install -Dm644 installer/unix/appimage/ArrowDL.desktop -t \
    "$pkgdir/%{_datadir}/applications/"

  install -Dm644 src/resources/logo/ArrowDL.svg -t \
    "$pkgdir/%{_iconsdir}/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/%{_iconsdir}/hicolor/${i}x${i}/apps/ArrowDL.png"
  done

  install -d "$pkgdir/%{_bindir}"

  # Use ArrowDL
  cat  << EOF | tee "$pkgdir/%{_bindir}/ArrowDL"
#!/bin/sh
exec %{_libdir}/%{name}/ArrowDL "${@}"
EOF
  chmod a+x "$pkgdir/%{_bindir}/ArrowDL"
  # Use system yt-dlp
  cat  << EOF | tee "$pkgdir/%{_libdir}/$pkgname/yt-dlp"
#!/bin/sh
exec %{_bindir}/yt-dlp "${@}"
EOF
  chmod a+x "$pkgdir/%{_libdir}/$pkgname/yt-dlp"
  # Allow write permissions to queue.json
  touch "$pkgdir/%{_libdir}/$pkgname/queue.json"
  chmod 777 "$pkgdir/%{_libdir}/$pkgname/queue.json"

%files
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/locale
%dir %{_sysconfdir}/chromium
%dir %{_sysconfdir}/chromium/native-messaging-hosts
%dir %{_libdir}/mozilla
%dir %{_libdir}/mozilla/native-messaging-hosts
%dir %{_datadir}/licenses/%{name}
%dir %{_iconsdir}/hicolor/*x*/apps
%dir %{_iconsdir}/hicolor/*x*
%dir %{_iconsdir}/hicolor/scalable/apps
%dir %{_iconsdir}/hicolor/scalable
%dir %{_iconsdir}/hicolor
%{_libdir}/%{name}/ArrowDL
%{_libdir}/%{name}/locale/*.qm
%{_libdir}/%{name}/launcher
%{_libdir}/%{name}/yt-dlp
%{_sysconfdir}/chromium/native-messaging-hosts/com.arrowdl.extension.json
%{_libdir}/mozilla/native-messaging-hosts/com.arrowdl.extension.json
%{_datadir}/licenses/%{name}/LOGO_LICENSE.txt
%{_datadir}/applications/ArrowDL.desktop
%{_iconsdir}/hicolor/scalable/apps/ArrowDL.svg
%{_iconsdir}/hicolor/*x*/apps/ArrowDL.png
%{_bindir}/ArrowDL
%{_libdir}/%{name}/queue.json

%changelog
openSUSE Build Service is sponsored by