File aspia252.spec of Package aspia252
Name: aspia252
Version: 2.5.2
Release: 0
Summary: Remote desktop control and monitoring tool (Legacy Parallel Version)
License: GPL-3.0-or-later
URL: https://www.aspia.ru
Source0: aspia-%{version}.tar.gz
BuildRequires: cmake >= 3.21
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: libQt5Widgets-devel libQt5Network-devel libQt5PrintSupport-devel libQt5Xml-devel libqt5-linguist-devel
%if 0%{?suse_version} > 1600
BuildRequires: libqt5-qtbase-private-headers-devel
%else
BuildRequires: libQt5Core-private-headers-devel
%endif
BuildRequires: pkgconfig(asio)
BuildRequires: libcurl-devel fmt-devel libyuv-devel openssl-devel libopus-devel protobuf-devel rapidjson-devel sqlite3-devel libzstd-devel libicu-devel libjpeg-devel libvpx-devel libpulse-devel
BuildRequires: pkgconfig(x11) pkgconfig(xfixes) pkgconfig(xdamage) pkgconfig(xrandr) pkgconfig(xtst) pkgconfig(xi) pkgconfig(xext) pkgconfig(xcomposite) pkgconfig(systemd)
BuildRequires: hicolor-icon-theme
%description
Aspia legacy 2.5.2 version. This package is modified for parallel installation
alongside newer versions. Executables and services are suffixed with '25'.
%prep
%setup -q -n aspia-%{version}
# 1. Фикс-заголовок для совместимости с GCC 13/14/15 (Решает ошибку 16.0 с std::map)
cat << EOF > %{_builddir}/fix_stdint.h
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#ifdef __cplusplus
#include <cstdint>
#include <cstdlib>
#include <string>
#include <string_view>
#include <mutex>
#include <queue>
#include <algorithm>
#include <stdexcept>
#include <vector>
#include <memory>
#include <map>
#include <optional>
#include <utility>
#endif
EOF
# 2. Очистка от встроенных библиотек
find . -type f -name "CMakeLists.txt" -exec sed -i -E '/add_subdirectory\((mimalloc|custom_c_allocator|googletest|asio|rapidjson|fmt|libyuv|opus|zstd|sqlite|vpx|curl|protobuf|icu).*\)/d' {} +
find . -type f -name "CMakeLists.txt" -exec sed -i -E 's/\b(mimalloc-static|mimalloc|custom_c_allocator)\b//g' {} +
# 2.5. Возврат к системным аллокаторам
find source -type f -name "*" -exec sed -i 's/\bcustom_c_free\b/free/g' {} +
find source -type f -name "*" -exec sed -i 's/\bcustom_c_malloc\b/malloc/g' {} +
find source -type f -name "*" -exec sed -i 's/\bcustom_c_calloc\b/calloc/g' {} +
find source -type f -name "*" -exec sed -i 's/\bcustom_c_realloc\b/realloc/g' {} +
# 3. Инъекция системных путей
sed -i '1i include_directories(/usr/include/opus /usr/include/libvpx /usr/include/libyuv /usr/include/glog)' CMakeLists.txt
# 4. Принудительная линковка X11
sed -i '1i function(add_executable name)\n if(name MATCHES "test")\n return()\n endif()\n _add_executable(${name} ${ARGN})\nendfunction()' CMakeLists.txt
sed -i '1i function(target_link_libraries name)\n if(NOT TARGET ${name})\n return()\n endif()\n _target_link_libraries(${name} ${ARGN} X11)\nendfunction()' CMakeLists.txt
# 5. Исправление поиска библиотек
sed -i -E '/find_package\((asio|RapidJSON|GTest|libyuv|Opus|fmt|zstd|unofficial-libvpx|unofficial-sqlite3).*REQUIRED\)/d' CMakeLists.txt
sed -i -E 's/find_package\(CURL.*CONFIG REQUIRED\)/find_package(CURL REQUIRED)/gI' CMakeLists.txt
sed -i 's/find_package(protobuf CONFIG REQUIRED)/find_package(Protobuf REQUIRED)/' CMakeLists.txt
sed -i 's/find_package(ICU REQUIRED uc dt)/find_package(ICU REQUIRED COMPONENTS uc data)/' CMakeLists.txt
# 6. Замена таргетов
find . -type f -name "CMakeLists.txt" -exec sed -i \
-e 's/Opus::opus/opus/g' -e 's/fmt::fmt/fmt/g' -e 's/fmt-header-only/fmt/g' \
-e 's/zstd::libzstd_static/zstd/g' -e 's/RapidJSON::RapidJSON/ /g' \
-e 's/unofficial::libvpx::libvpx/vpx/g' -e 's/unofficial::sqlite3::sqlite3/sqlite3/g' \
-e 's/libyuv::libyuv/yuv/g' -e 's/CURL::libcurl/curl/g' -e 's/asio::asio/ /g' \
-e 's/ICU::dt/ICU::data/g' -e 's/Qt5::QICOPlugin/ /g' -e 's/Qt5::QGenericEnginePlugin/ /g' \
-e 's/Qt5::[a-zA-Z]*Private//g' \
-e 's/X11::[A-Za-z0-9]*/&/g' -e 's/X11:://g' {} +
%build
export CXXFLAGS="%{optflags} -include %{_builddir}/fix_stdint.h -fpermissive -std=c++17 -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-error -Wno-narrowing -Wno-address-of-packed-member"
export CFLAGS="%{optflags} -include %{_builddir}/fix_stdint.h -Wno-error"
%cmake \
-DENABLE_MIMALLOC=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DPROTOBUF_USE_DLLS=ON
%cmake_build
%install
%cmake_install
# 1. Переименование файлов (префикс aspia25 для бинарников и системных путей)
find %{buildroot} -type f \( -name "aspia-*" -o -name "aspia_*" \) | while read f; do
fname=$(basename "$f")
echo "$fname" | grep -q "aspia25" && continue
dir=$(dirname "$f")
newfname=$(echo "$fname" | sed -E 's/aspia([-|_])/aspia25\1/')
mv "$f" "$dir/$newfname"
done
# 2. Редактирование ярлыков (Версия 2.5.2 в именах для KDE 6)
find %{buildroot}%{_datadir}/applications/ -name "aspia25-*.desktop" -exec sed -i \
-e 's|^Name=Aspia|Name=Aspia 2.5.2|g' \
-e 's|^Name\[ru\]=Клиент Aspia|Name[ru]=Клиент Aspia 2.5.2|g' \
-e 's|^Name\[ru\]=Консоль Aspia|Name[ru]=Консоль Aspia 2.5.2|g' \
-e 's|Exec=/usr/bin/aspia_|Exec=/usr/bin/aspia25_|g' \
-e 's|Icon=aspia_|Icon=aspia25_|g' \
-e 's|.png||g' {} +
# 3. Редактирование .service файлов
if [ -d %{buildroot}%{_unitdir} ]; then
find %{buildroot}%{_unitdir} -name "aspia25-*.service" -exec sed -i \
-e 's|ExecStart=/usr/bin/aspia_|ExecStart=/usr/bin/aspia25_|g' {} +
fi
# 4. Исправление MIME-типов
if [ -d %{buildroot}%{_datadir}/mime/packages/ ]; then
find %{buildroot}%{_datadir}/mime/packages/ -name "aspia25-*.xml" -exec sed -i \
-e 's|icon-name="aspia_|icon-name="aspia25_|g' {} +
fi
# 5. Очистка оригиналов
find %{buildroot}%{_bindir} -type f -name "aspia_*" ! -name "aspia25_*" -delete
find %{buildroot}%{_datadir}/applications -type f -name "aspia-*" ! -name "aspia25-*" -delete
%files
%license LICENSE.md
%doc README.md
%{_bindir}/aspia25_*
%{_unitdir}/aspia25-*.service
%{_datadir}/applications/aspia25-*.desktop
%{_datadir}/mime/packages/aspia25-*.xml
%{_datadir}/icons/hicolor/*/apps/aspia25_*
%{_datadir}/icons/hicolor/*/mimetypes/aspia25_*
%changelog