File ultimaker-cura.spec of Package Cura

Name: UltiMaker-Cura
Version: 5.8.0
Release: 0
Url: https://ultimaker.com
Summary: A easy-to-use 3D printing software
Group: Hardware/Printing
BuildRequires: desktop-file-utils
BuildRequires: update-desktop-files
BuildRequires: hicolor-icon-theme
BuildRequires: -post-build-checks
#Requires:       python3-keyring >= 21
#Requires:       python3-numpy
#Requires:       python3-pynest2d
#Requires:       python3-pyserial
#Requires:       python3-qt5 >= 5.10
#Requires:       python3-requests
#Requires:       python3-scipy
#Requires:       python3-sentry-sdk
#Requires:       python3-shapely
#Requires:       python3-typing
#Requires:       uranium >= %{version}
#Recommends:     cura-fdm-materials >= %{versionRecommends:     cura-fdm-materials >= %{version#}
#Recommends:     python3-zeroconf
BuildArch:      noarch
License:        LGPL-3.0-only
# The CuraEngine is not supported on 32bit Linux anymore
ExcludeArch:    %ix86 %arm s390 ppc
AutoReqProv: no
Source1: %{name}.png
Source2: UltiMaker-Cura-%{version}-linux-X64.AppImage
Source3: %{name}.desktop.txt
BuildRoot: %{_tmppath}/%{name}-%{version}-build

%description
Cura is a project which aims to be an single software solution for 3D printing.
While it is developed to be used with the Ultimaker 3D printer, it can be used
with other RepRap based designs.

Cura helps setting up an Ultimaker, shows the 3D model, allows for scaling /
positioning, can slice the model to G-Code with editable configuration
settings, and send this G-Code to the 3D printer for printing.

%build

%install
mkdir -p %{buildroot}/usr/share/pixmaps/
install -D -m 644 %{SOURCE1} %{buildroot}/usr/share/pixmaps/%{name}.png

mkdir -p %{buildroot}/opt/%{name}/
install -D -m 755 %{SOURCE2} %{buildroot}/opt/%{name}/UltiMaker-Cura-%{version}-linux-X64.AppImage
cp -f %{SOURCE3} %{buildroot}/opt/%{name}/%{name}.desktop

mkdir -p %{buildroot}/usr/share/applications/
cp -f %{SOURCE3} %{buildroot}/usr/share/applications/%{name}.desktop

%post
# Create .desktop file
#rm -f %{_datadir}/applications/%{name}.desktop
#cat > %{_datadir}/applications/%{name}.desktop << EOM
#[Desktop Entry]
#Name=UltiMaker-Cura
#Exec=%{name}
#Terminal=false
#Type=Application
#Icon=%{name}
#StartupWMClass=Ferdium
#Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great.
#GenericName=3D Printing Software
#MimeType=x-scheme-handler/%{name};
#Categories=Hardware;Printing;
#EOM

# Create executable for app
rm -f /usr/bin/%{name}
cat > /usr/bin/%{name} << EOM
#!/bin/bash

LD_PRELOAD=/usr/lib64/libstdc++.so.6 /opt/%{name}/UltiMaker-Cura-%{version}-linux-X64.AppImage
EOM

chmod -R +x /usr/bin/%{name}

%desktop_database_post
%icon_theme_cache_post
%mime_database_post

update-desktop-database
gtk-update-icon-cache

%preun
if [ "$1" = 0 ]; then
  # Remove .desktop file
  rm -f %{_datadir}/applications/%{name}.desktop
  rm -f /usr/bin/%{name}

  %desktop_database_post
  %icon_theme_cache_post
  %mime_database_post

  update-desktop-database
  gtk-update-icon-cache
fi

%clean

%files
%defattr(755,root,root,755) 
/opt/%{name}/UltiMaker-Cura-%{version}-linux-X64.AppImage
%defattr(-,root,root)
/usr/share/pixmaps/%{name}.png
/usr/share/applications/%{name}.desktop
/opt/%{name}/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by