990dc29
%global         major_minor_version 5.4
dc05456
%global         patch_version 0
Gabriel Féron 74ff62b
07a9f8f
Name:           cura
f96865e
Epoch:          1
Gabriel Féron 74ff62b
Version:        %{major_minor_version}.%{patch_version}
751a621
Release:        %autorelease
Gabriel Féron 2430502
Summary:        3D printer / slicing GUI
bb8dee5
bb8dee5
# https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/MOUNX6I3POCDMYWBNJ7JPLLIKVYWVRBJ/
dc05456
License:        LGPL-3.0-or-later
07a9f8f
f96865e
URL:            https://ultimaker.com/en/products/cura-software
Gabriel be0898d
Source0:        https://github.com/Ultimaker/Cura/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
07a9f8f
dc05456
# Cmake bits taken from 4.13.1, before upstream went nuts with conan
dc05456
Source2:        mod_bundled_packages_json.py
dc05456
Source3:        CuraPluginInstall.cmake
dc05456
Source4:        CuraTests.cmake
dc05456
Source5:        com.ultimaker.cura.desktop.in
dc05456
Source6:        CMakeLists.txt
dc05456
Source7:        CuraVersion.py.in
dc05456
Source8:        com.ultimaker.cura.appdata.xml
Gabriel Féron 18391ff
Gabriel Féron 09e47bc
# Skip forced loading SentryLogger to avoid an error on startup
472bb26
Patch:          028e7f7.patch
Gabriel Féron 09e47bc
bab1ae3
# Fix asserts for called once in Python 3.12
472bb26
Patch:          https://github.com/Ultimaker/Cura/pull/16103.patch
bab1ae3
7b40be3
# Avoid "KeyError: material_name" crash
7b40be3
Patch:          https://github.com/Ultimaker/Cura/pull/17642.patch
7b40be3
f96865e
BuildArch:      noarch
5a2d100
12e0239
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
12e0239
ExcludeArch:    %{ix86}
12e0239
f96865e
BuildRequires:  cmake
Gabriel Féron 6afb99c
BuildRequires:  gcc
Gabriel Féron 6afb99c
BuildRequires:  gcc-c++
07a9f8f
BuildRequires:  desktop-file-utils
f96865e
BuildRequires:  dos2unix
2dfa411
BuildRequires:  gettext
b40f374
BuildRequires:  git-core
f96865e
BuildRequires:  python3-devel
b40f374
BuildRequires:  python3-pip
f96865e
BuildRequires:  python3-pytest
bb32769
BuildRequires:  python3-keyring
bb32769
BuildRequires:  python3-pyserial
6bc9a5f
BuildRequires:  python3-pynest2d
Gabriel Feron c48d6d9
BuildRequires:  python3-requests
990dc29
BuildRequires:  python3-savitar >= 5.3.0
990dc29
BuildRequires:  python3-uranium >= 5.4.0
bb32769
BuildRequires:  python3-zeroconf
f96865e
f96865e
Requires:       open-sans-fonts
dc05456
Requires:       python3-certifi
Gabriel Féron 2cdec40
Requires:       python3-keyring
dc05456
Requires:       python3-numpy-stl
f96865e
Requires:       python3-pyserial
6bc9a5f
Requires:       python3-pynest2d
Gabriel Feron c48d6d9
Requires:       python3-requests
990dc29
Requires:       python3-savitar >= 5.3.0
dc05456
Requires:       python3-trimesh
990dc29
Requires:       python3-uranium >= 5.4.0
f96865e
Requires:       python3-zeroconf
dc05456
# Requires:       qt5-qtquickcontrols
dc05456
# Requires:       qt5-qtquickcontrols2
f96865e
Requires:       CuraEngine == %{epoch}:%{version}
Gabriel Féron 74ff62b
Requires:       cura-fdm-materials >= %{major_minor_version}
f96865e
2b728f5
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1494278
2b728f5
Requires:       libglvnd-devel
2b728f5
0a2ffc7
# So that it just works
f96865e
Requires:       3dprinter-udev-rules
07a9f8f
3422eee
# For various plugins
3422eee
Recommends:     python3-trimesh
3422eee
Recommends:     python3-certifi
3422eee
07a9f8f
%description
07a9f8f
Cura is a project which aims to be an single software solution for 3D printing.
07a9f8f
While it is developed to be used with the Ultimaker 3D printer, it can be used
07a9f8f
with other RepRap based designs.
07a9f8f
f96865e
Cura prepares your model for 3D printing. For novices, it makes it easy to get
f96865e
great results. For experts, there are over 200 settings to adjust to your
f96865e
needs. As it's open source, our community helps enrich it even more.
07a9f8f
Gabriel Féron b76b9ad
# see: https://github.com/Ultimaker/Cura/issues/5142
Gabriel Féron b76b9ad
%define cura_cloud_api_root https://api.ultimaker.com
Gabriel Féron b76b9ad
%define cura_cloud_api_version 1
Gabriel Féron b76b9ad
%define cura_cloud_account_api_root https://account.ultimaker.com
Gabriel Féron b76b9ad
Gabriel Féron 2cdec40
%define reverse_dns_name com.ultimaker.%{name}
Gabriel Féron 2cdec40
07a9f8f
%prep
f96865e
%autosetup -p1 -S git -n Cura-%{version}
f96865e
dc05456
mkdir cmake
dc05456
cp -a %{SOURCE2} %{SOURCE3} %{SOURCE4} cmake
dc05456
rm -rf CMakeLists.txt
dc05456
cp -a %{SOURCE5} %{SOURCE6} %{SOURCE8} .
dc05456
cp -a %{SOURCE7} cura
dc05456
f96865e
# Wrong end of line encoding
f96865e
dos2unix docs/How_to_use_the_flame_graph_profiler.md
07a9f8f
f96865e
# Wrong shebang
472bb26
sed -i '1s=^#!/usr/bin/\(python\|env python\)3*=#!%{python3}=' cura_app.py
f96865e
07a9f8f
%build
abfc7ec
%cmake \
Gabriel Féron b76b9ad
  -DCURA_VERSION:STRING=%{version} \
dc05456
  -DCURA_BUILDTYPE="RPM %{version}"\
Gabriel Féron b76b9ad
  -DCURA_CLOUD_API_ROOT:STRING=%{cura_cloud_api_root} \
Gabriel Féron b76b9ad
  -DCURA_CLOUD_API_VERSION:STRING=%{cura_cloud_api_version} \
Gabriel Féron b76b9ad
  -DCURA_CLOUD_ACCOUNT_API_ROOT:STRING=%{cura_cloud_account_api_root} \
abfc7ec
  -DLIB_SUFFIX:STR=
abfc7ec
%cmake_build
f96865e
2dfa411
# rebuild locales
f96865e
cd resources/i18n
f96865e
rm *.pot
f96865e
for DIR in *; do
f96865e
  pushd $DIR
f96865e
  for FILE in *.po; do
f96865e
    msgfmt $FILE.po -o LC_MESSAGES/${FILE%po}mo || :
f96865e
  done
f96865e
  popd
2dfa411
done
2dfa411
cd -
07a9f8f
f96865e
07a9f8f
%install
abfc7ec
%cmake_install
f96865e
dc05456
mkdir -p %{buildroot}%{_datadir}/%{name}/resources/images/whats_new
dc05456
mkdir -p %{buildroot}%{_datadir}/%{name}/resources/texts/whats_new
dc05456
mkdir -p %{buildroot}%{_datadir}/%{name}/resources/scripts
dc05456
f96865e
# Sanitize the location of locale files
f96865e
pushd %{buildroot}%{_datadir}
f96865e
mv cura/resources/i18n locale
f96865e
ln -s ../../locale cura/resources/i18n
f96865e
rm locale/*/*.po
f96865e
popd
f96865e
f96865e
# Unbundle fonts
6a3f1c9
rm -rf %{buildroot}%{_datadir}/%{name}/resources/themes/cura-light/fonts/
6a3f1c9
ln -s %{_datadir}/fonts/open-sans/ %{buildroot}%{_datadir}/%{name}/resources/themes/cura-light/fonts
f96865e
Gabriel Féron 74ff62b
# Remove failing plugins
Gabriel Féron 09e47bc
rm -r %{buildroot}%{_prefix}/lib/cura/plugins/{SentryLogger,UFPReader,UFPWriter}
Gabriel Féron 74ff62b
b86e7c0
# Bytecompile the plugins
472bb26
%py_byte_compile %{python3} %{buildroot}%{_prefix}/lib/cura
b86e7c0
c76efbe
# Use the default flags in the shebang
c76efbe
%py3_shebang_fix %{buildroot}%{_bindir}/*
c76efbe
f96865e
%find_lang cura
f96865e
%find_lang fdmextruder.def.json
f96865e
%find_lang fdmprinter.def.json
f96865e
f96865e
f96865e
%check
472bb26
%{python3} -m pip freeze
472bb26
%{python3} -m pytest -v
6a3f1c9
Gabriel Féron 2cdec40
desktop-file-validate %{buildroot}%{_datadir}/applications/%{reverse_dns_name}.desktop
f96865e
f96865e
f96865e
%files -f cura.lang -f fdmextruder.def.json.lang -f fdmprinter.def.json.lang
f96865e
%license LICENSE
f96865e
%doc README.md
f96865e
# CHANGES is not updated since 15.x
1c3a0c7
# things in docs are developer oriented
f96865e
%{python3_sitelib}/%{name}
07a9f8f
%{_datadir}/%{name}
Gabriel Féron 2cdec40
%{_datadir}/applications/%{reverse_dns_name}.desktop
Gabriel Féron 2cdec40
%{_datadir}/metainfo/%{reverse_dns_name}.appdata.xml
6a3f1c9
%{_datadir}/icons/hicolor/128x128/apps/%{name}-icon.png
f96865e
%{_datadir}/mime/packages/%{name}.xml
07a9f8f
%{_bindir}/%{name}
f96865e
%{_prefix}/lib/%{name}
07a9f8f
07a9f8f
%changelog
751a621
%autochangelog