File abdm.spec of Package abdm

#
# spec file for package ab-download-manager
#
# 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:           abdm
Version:        1.7.1
Release:        0
Summary:        A modern download manager that speeds up your downloads
License:        GPL-3.0-or-later
URL:            https://abdownloadmanager.com 
Source0:        https://github.com/amir1376/ab-download-manager/releases/download/v%{version}/ABDownloadManager_%{version}_linux_x64.tar.gz
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  desktop-file-utils
BuildRequires:  chrpath
Requires:       desktop-file-utils
ExclusiveArch:  x86_64

%description
AB Download Manager is a desktop application that helps you manage and
organize your downloads more efficiently than ever before.
Features include:
- ⚡️ Faster Download Speed (up to 500% boost with multiple connections)
- ⏰ Queues and Schedulers
- Browser Extensions for automatic link capture
- Multiplatform support (Windows/Linux/Mac)
- Multiple Themes (Dark/Light) with modern UI
- Free and Open Source

%prep
%setup -q -n ABDownloadManager

%build
# No build needed for prebuilt binaries

%install
install -d -m 755 %{buildroot}%{_bindir}
install -d -m 755 %{buildroot}%{_libdir}/%{name}
install -d -m 755 %{buildroot}%{_datadir}/applications
# Fix: Removed icon directory creation
# install -d -m 755 %%{buildroot}%%{_datadir}/icons/hicolor/scalable/apps

# Copy all files to the _libdir location
cp -r . %{buildroot}%{_libdir}/%{name}/

# Set executable bit on all binaries and .so files
# This is ESSENTIAL for the auto-stripper to work
find %{buildroot}%{_libdir}/%{name} -type f -name "*.so" -exec chmod 755 {} \;
find %{buildroot}%{_libdir}/%{name} -type f -name "jexec" -exec chmod 755 {} \;
find %{buildroot}%{_libdir}/%{name} -type f -name "jspawnhelper" -exec chmod 755 {} \;
chmod 755 %{buildroot}%{_libdir}/%{name}/bin/ABDownloadManager

# Fix: REMOVED all manual 'strip' commands.
# They were corrupting the prebuilt binaries.

# Remove RPATH
find %{buildroot}%{_libdir}/%{name} -type f \( -name "*.so" -o -name "jexec" -o -name "jspawnhelper" -o -name "ABDownloadManager" \) -exec chrpath -d {} \;

# Create wrapper script
cat > %{buildroot}%{_bindir}/%{name} << 'EOF'
#!/bin/bash
exec %{_libdir}/%{name}/bin/ABDownloadManager "$@"
EOF
chmod +x %{buildroot}%{_bindir}/%{name}

# Install Desktop File
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << 'EOF'
[Desktop Entry]
Type=Application
Name=AB Download Manager
Comment=A modern download manager that speeds up your downloads
Exec=%{name}
Icon=%{name}
Categories=Network;FileTransfer;
Terminal=false
StartupWMClass=ABDownloadManager
EOF

# Removed all icon installation logic
# ...

# Remove hidden file
find %{buildroot} -name ".jpackage.xml" -delete

%fdupes %{buildroot}%{_libdir}/%{name}

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

%post
# Fix: Use literal command to avoid 'fg: no job control' error
/usr/bin/update-desktop-database -q || :
# Fix: Removed icon cache scriptlet
# %%icon_theme_cache_post

%postun
# Fix: Use literal command to avoid 'fg: no job control' error
/usr/bin/update-desktop-database -q || :
# Fix: Removed icon cache scriptlet
# %%icon_theme_cache_post_un

%files
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/applications/%{name}.desktop
# Fix: Removed the icon file from the file list
# %%ghost %%attr(0644,root,root) %%{_datadir}/icons/hicolor/scalable/apps/%%{name}.svg

%changelog
* Fri Nov 07 2025 itachi_re <xanbenson99@gmail.com> - 1.7.1-0
- Initial package
- Moved binaries from /usr/share to /usr/lib64 (FHS compliance)
- Added wrapper script, fixed permissions, removed RPATH
- Added desktop file scriptlets
- Removed icon file as it is not present in source tarball
- Removed manual strip commands to prevent binary corruption
openSUSE Build Service is sponsored by