2 %bcond_with system_poly2tri
4 %include /usr/lib/rpm/macros.perl
5 Summary: G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
9 License: AGPLv3 and CC-BY
10 # Images are CC-BY, code is AGPLv3
11 Group: Applications/Engineering
12 URL: http://slic3r.org/
13 Source0: https://github.com/alexrj/Slic3r/archive/%{version}.tar.gz
14 # Source0-md5: 8b9902eb089d5ce59b25a2c9b711ec69
15 Source1: %{name}.desktop
16 Source2: %{name}.appdata.xml
17 # Modify Build.PL so we are able to build this on Fedora
18 Patch0: %{name}-buildpl.patch
19 # Don't warn for Perl >= 5.16
20 # Use /usr/share/slic3r as datadir
21 # Those two are located at the same place at the code, so the patch is merged
22 Patch1: %{name}-nowarn-datadir.patch
23 Patch2: %{name}-english-locale.patch
24 Patch3: %{name}-linker.patch
25 Patch4: %{name}-clear-error.patch
26 Patch5: %{name}-test-out-of-memory.patch
27 Patch6: %{name}-clipper.patch
28 Patch7: %{name}-admesh.patch
29 BuildRequires: ImageMagick
30 BuildRequires: admesh-devel >= 0.98.1
31 BuildRequires: boost-devel
32 BuildRequires: desktop-file-utils
33 BuildRequires: perl(ExtUtils::MakeMaker) >= 6.80
34 BuildRequires: perl(ExtUtils::ParseXS) >= 3.22
35 BuildRequires: perl(ExtUtils::Typemaps::Default) >= 1.05
36 BuildRequires: perl(Growl::GNTP) >= 0.15
37 BuildRequires: perl(Math::ConvexHull) >= 1.0.4
38 BuildRequires: perl(Math::Geometry::Voronoi) >= 1.3
39 BuildRequires: perl(Math::PlanePath) >= 53
40 BuildRequires: perl(Module::Build::WithXSpp) >= 0.14
41 BuildRequires: perl(Moo) >= 1.003001
42 BuildRequires: perl-Class-XSAccessor
43 BuildRequires: perl-Encode-Locale
44 BuildRequires: perl-ExtUtils-Typemap
45 BuildRequires: perl-IO-stringy
46 BuildRequires: perl-Math-ConvexHull-MonotoneChain
47 BuildRequires: perl-SVG
48 BuildRequires: perl-Wx
49 BuildRequires: perl-XML-SAX
50 BuildRequires: perl-XML-SAX-ExpatXS
51 BuildRequires: perl-devel >= 1:5.8.0
52 BuildRequires: perl-modules
53 %{?with_system_poly2tri:BuildRequires: poly2tri-devel}
54 BuildRequires: polyclipping-devel >= 6.2.0
55 BuildRequires: rpm-perlprov >= 4.1-13
56 Requires: admesh-libs >= 0.97.5
57 Requires: perl-threads >= 2.00
58 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61 Slic3r is a G-code generator for 3D printers. It's compatible with
62 RepRaps, Makerbots, Ultimakers and many more machines. See the project
63 homepage at slic3r.org and the documentation on the Slic3r wiki for
67 %setup -qn Slic3r-%{version}
72 %if %{with system_poly2tri}
81 # Remove bundled admesh, clipper, poly2tri and boost
84 %{?with_system_poly2tri:rm -rf xs/src/poly2tri}
89 %{__perl} ./Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS"
95 ./Build test verbose=1
97 SLIC3R_NO_AUTO=1 perl Build.PL installdirs=vendor
98 # the --gui runs no tests, it only checks requires
101 # prepare pngs in mutliple sizes
102 for res in 16 32 48 128 256; do
103 mkdir -p hicolor/${res}x${res}/apps
106 convert ../var/Slic3r.ico %{name}.png
107 cp %{name}-0.png 256x256/apps/%{name}.png
108 cp %{name}-1.png 128x128/apps/%{name}.png
109 cp %{name}-2.png 48x48/apps/%{name}.png
110 cp %{name}-3.png 32x32/apps/%{name}.png
111 cp %{name}-4.png 16x16/apps/%{name}.png
115 # To avoid "iCCP: Not recognized known sRGB profile that has been edited"
117 find . -type f -name "*.png" -exec convert {} -strip {} \;
121 rm -rf $RPM_BUILD_ROOT
123 ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0
125 find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \;
127 # I see no way of installing slic3r with it's build script
128 # So I copy the files around manually
129 install -d $RPM_BUILD_ROOT%{_bindir}
130 install -d $RPM_BUILD_ROOT%{perl_vendorlib}
131 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
132 install -d $RPM_BUILD_ROOT%{_datadir}/icons
133 install -d $RPM_BUILD_ROOT%{_datadir}/appdata
135 cp -a %{name}.pl $RPM_BUILD_ROOT%{_bindir}/%{name}
136 cp -a lib/* $RPM_BUILD_ROOT%{perl_vendorlib}
138 cp -a var/* $RPM_BUILD_ROOT%{_datadir}/%{name}
139 cp -r hicolor $RPM_BUILD_ROOT%{_datadir}/icons
140 desktop-file-install --dir=$RPM_BUILD_ROOT%{_desktopdir} %{SOURCE1}
142 cp %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml
144 %{_fixperms} $RPM_BUILD_ROOT*
148 %update_icon_cache hicolor
152 if [ $1 -eq 0 ] ; then
153 %update_icon_cache hicolor
157 rm -rf $RPM_BUILD_ROOT
160 %defattr(644,root,root,755)
162 %attr(755,root,root) %{_bindir}/%{name}
163 %{perl_vendorlib}/Slic3r*
164 %{perl_vendorarch}/Slic3r*
165 %{perl_vendorarch}/auto/Slic3r*
166 %{_iconsdir}/hicolor/*/apps/%{name}.png
167 %{_desktopdir}/%{name}.desktop
168 %{_datadir}/appdata/%{name}.appdata.xml