File cudatext-qt6.spec of Package CudaText

%global full_name cudatext
%global app_name CudaText
%global variant qt6
%global pkg_arch amd64

Name:           cudatext-%{variant}
Version:        1.233.1.0
Release:        1%{?dist}
Summary:        Cross-platform text editor

License:        MPL-2.0
URL:            https://cudatext.github.io/
Source0:        %{full_name}-linux-%{variant}-%{pkg_arch}-%{version}.tar.xz

BuildRequires:  desktop-file-utils
Requires:       libQt6Pas6
Recommends:     python3

ExclusiveArch:  x86_64

Conflicts:      %{full_name}-gtk2 %{full_name}-qt5 %{full_name}

%description
CudaText is a cross-platform text editor, written in Object Pascal.

%prep
%setup -q -c

%install
rm -rf %{buildroot}

# Установка в /opt/CudaText
install -d %{buildroot}/opt/%{app_name}
cp -a cudatext/* %{buildroot}/opt/%{app_name}/

# Установка иконки для .desktop
install -d %{buildroot}%{_datadir}/pixmaps
cp -a cudatext/%{full_name}-512.png %{buildroot}%{_datadir}/pixmaps/

# Wrapper-скрипт
install -d %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{full_name} <<'EOF'
#!/bin/sh
export CUDATEXT_DIR="$HOME/.config/cudatext"
export CUDATEXT_SETTINGS="$CUDATEXT_DIR/settings"
export CUDATEXT_PY="$CUDATEXT_DIR/py"
mkdir -p "$CUDATEXT_SETTINGS" "$CUDATEXT_PY"
exec /opt/CudaText/cudatext "$@"
EOF
chmod 755 %{buildroot}%{_bindir}/%{full_name}

# .desktop файл
install -d %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{full_name}.desktop <<EOF
[Desktop Entry]
Name=%{app_name}
GenericName=Text Editor
Comment=Edit text files
Exec=%{_bindir}/%{full_name}
Icon=%{full_name}-512
Terminal=false
Type=Application
MimeType=text/plain;
Categories=Utility;TextEditor;Development;
StartupNotify=true
EOF

%files
%dir /opt/%{app_name}
/opt/%{app_name}/*
%{_bindir}/%{full_name}
%{_datadir}/applications/%{full_name}.desktop
%{_datadir}/pixmaps/%{full_name}-512.png
openSUSE Build Service is sponsored by