cf513b2
%global orig slic3r
cf513b2
Name:           %{orig}-prusa3d
431482e
Version:        1.33.8
cf513b2
Release:        1%{?dist}
7055433
Summary:        G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
7055433
License:        AGPLv3 and CC-BY
7055433
# Images are CC-BY, code is AGPLv3
7055433
Group:          Applications/Engineering
cf513b2
URL:            https://github.com/prusa3d/Slic3r
cf513b2
Source0:        https://github.com/prusa3d/Slic3r/archive/version_%{version}.tar.gz
7055433
00db753
# Modify Build.PL so we are able to build this on Fedora
cf513b2
Patch0:         %{orig}-buildpl.patch
7055433
00db753
# Use /usr/share/slic3r as datadir
cf513b2
Patch1:         %{orig}-datadir.patch
cf513b2
Patch2:         %{orig}-english-locale.patch
cf513b2
Patch3:         %{orig}-linker.patch
cb29a72
#Patch4:         %%{orig}-clipper.patch
0fe13f5
7055433
Source1:        %{name}.desktop
180504c
Source2:        %{name}.appdata.xml
180504c
0d5ea80
# This Slic3r does not support big endian
0d5ea80
# https://github.com/prusa3d/Slic3r/commit/2085a482c76d88bfbb7ed8b5c598ff9f7ed8788f
5ad5f96
ExcludeArch:    ppc64 ppc64p7 s390x
0d5ea80
0d5ea80
0d5af19
BuildRequires:  perl-devel
0d5af19
BuildRequires:  perl-generators
5429fab
BuildRequires:  perl(Class::XSAccessor)
cf513b2
BuildRequires:  perl(Devel::CheckLib)
7cfea94
BuildRequires:  perl(Encode::Locale) >= 1.05
046176c
BuildRequires:  perl(ExtUtils::MakeMaker) >= 6.80
046176c
BuildRequires:  perl(ExtUtils::ParseXS) >= 3.22
7d8e177
BuildRequires:  perl(ExtUtils::Typemaps::Default) >= 1.05
0e6aea0
BuildRequires:  perl(ExtUtils::Typemaps) >= 1.00
00db753
BuildRequires:  perl(File::Basename)
5429fab
BuildRequires:  perl(File::Spec)
00db753
BuildRequires:  perl(Getopt::Long)
046176c
BuildRequires:  perl(Growl::GNTP) >= 0.15
5429fab
BuildRequires:  perl(IO::Scalar)
7055433
BuildRequires:  perl(List::Util)
00db753
BuildRequires:  perl(Math::PlanePath) >= 53
046176c
BuildRequires:  perl(Module::Build::WithXSpp) >= 0.14
6e45624
BuildRequires:  perl(Moo) >= 1.003001
5429fab
BuildRequires:  perl(parent)
0e6aea0
BuildRequires:  perl(POSIX)
7055433
BuildRequires:  perl(Scalar::Util)
00db753
BuildRequires:  perl(Storable)
7055433
BuildRequires:  perl(SVG)
00db753
BuildRequires:  perl(Test::Harness)
5429fab
BuildRequires:  perl(Test::More)
0e6aea0
BuildRequires:  perl(Thread::Semaphore)
0e6aea0
BuildRequires:  perl(threads) >= 1.96
00db753
BuildRequires:  perl(Time::HiRes)
0e6aea0
BuildRequires:  perl(Unicode::Normalize)
7055433
BuildRequires:  perl(Wx)
5429fab
BuildRequires:  perl(XML::SAX)
5429fab
BuildRequires:  perl(XML::SAX::ExpatXS)
228bba0
4861264
#BuildRequires:  admesh-devel >= 0.98.1
046176c
BuildRequires:  boost-devel
7055433
BuildRequires:  desktop-file-utils
046176c
BuildRequires:  poly2tri-devel
0e6aea0
#BuildRequires:  polyclipping-devel >= 6.2.0
52dcceb
BuildRequires:  ImageMagick
228bba0
5429fab
Requires:       perl(XML::SAX)
7055433
Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
4861264
#Requires:       admesh-libs >= 0.98.1
4861264
4105d45
Requires:       hicolor-icon-theme
4105d45
0985d3c
# For faster slicing
0985d3c
Recommends:     perl(Thread::Queue)
0985d3c
4861264
# Fedora polyclipping version is not compatible
a0fdc25
Provides:       bundled(polyclipping) = 6.2.9
a0fdc25
4861264
# Upstream has custom patches, reluctant to send to upstream
4861264
Provides:       bundled(admesh-libs) = 0.98.1
4861264
7055433
%description
431482e
This is Slic3r Prusa Edition, a modified version of Slic3r adding more features
431482e
not only useful for the Prusa printers.
431482e
7055433
Slic3r is a G-code generator for 3D printers. It's compatible with RepRaps,
7055433
Makerbots, Ultimakers and many more machines.
7055433
See the project homepage at slic3r.org and the documentation on the Slic3r wiki
7055433
for more information.
7055433
7055433
%prep
cf513b2
%setup -qn Slic3r-version_%{version}
228bba0
7055433
%patch0 -p1
7055433
%patch1 -p1
046176c
%patch2 -p1
51e3e00
%patch3 -p1
0e6aea0
#%%patch4 -p1
ea2fed3
51fd39f
# Remove bundled libs
4861264
#rm -rf xs/src/admesh
0e6aea0
#rm xs/src/clipper.*pp
046176c
rm -rf xs/src/poly2tri
046176c
rm -rf xs/src/boost
51fd39f
rm -rf xs/src/glew
2386974
# There is also Shiny, a profiler. But it's basically ifdefed out.
046176c
dc03daa
# Fix the version
dc03daa
sed -i 's/#define SLIC3R_VERSION .*$/#define SLIC3R_VERSION "%{version}"/' xs/src/libslic3r/libslic3r.h
dc03daa
94487dc
# Fix the shebang
94487dc
sed -i 's|#!/usr/bin/env perl|#!%{__perl}|' %{orig}.pl
dc03daa
cf513b2
#####################
cf513b2
# Move it to a separate namespace, so it does not conflict with the slic3r package
cf513b2
mv lib/Slic3r lib/Slic3rPrusa
cf513b2
mv lib/Slic3r.pm lib/Slic3rPrusa.pm
cf513b2
mv xs/lib/Slic3r xs/lib/Slic3rPrusa
cf513b2
cf513b2
# Perl
cf513b2
find . \( -name '*.pm' -o -name '*.t' -o -name '*.pl' -o -name '*.PL' -o -name '*.xsp'  -o -name '*.map' \) -exec \
cf513b2
  sed -i -e 's/Slic3r::/Slic3rPrusa::/g' \
cf513b2
         -e 's/package Slic3r;/package Slic3rPrusa;/g' \
cf513b2
         -e 's/{Slic3r};/{Slic3rPrusa};/g' \
cf513b2
         -e 's/use Slic3r;/use Slic3rPrusa;/g' \
cf513b2
  {} \;
cf513b2
cf513b2
# C++
cf513b2
find xs/src \( -name '*.cpp' -o -name '*.c' -o -name '*.hpp' -o -name '*.h' \) -exec \
cf513b2
  sed -i -e 's/Slic3r::/Slic3rPrusa::/g' \
cf513b2
         -e 's/namespace Slic3r/namespace Slic3rPrusa/g' \
cf513b2
  {} \;
cf513b2
cf513b2
# Settings directory
cf513b2
sed -i 's/GetUserDataDir)/GetUserDataDir)."Prusa"/' lib/Slic3rPrusa/GUI.pm
cf513b2
cf513b2
#####################
cf513b2
7055433
%build
00db753
cd xs
00db753
perl ./Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS"
7055433
./Build
00db753
cd -
00db753
# Building non XS part only runs test, so skip it and run it in tests
7055433
52dcceb
# prepare pngs in mutliple sizes
cf513b2
for res in 16 24 32 48 128; do
52dcceb
  mkdir -p hicolor/${res}x${res}/apps
52dcceb
done
52dcceb
cd hicolor
52dcceb
convert ../var/Slic3r.ico %{name}.png
cf513b2
cp %{name}-0.png 128x128/apps/%{name}.png
52dcceb
cp %{name}-2.png 48x48/apps/%{name}.png
52dcceb
cp %{name}-3.png 32x32/apps/%{name}.png
cf513b2
cp %{name}-4.png 24x24/apps/%{name}.png
cf513b2
cp %{name}-5.png 16x16/apps/%{name}.png
52dcceb
rm %{name}-*.png
52dcceb
cd -
52dcceb
3bb92bd
# To avoid "iCCP: Not recognized known sRGB profile that has been edited"
3bb92bd
cd var
3bb92bd
find . -type f -name "*.png" -exec convert {} -strip {} \;
3bb92bd
cd -
3bb92bd
7055433
%install
00db753
cd xs
7055433
./Build install destdir=%{buildroot} create_packlist=0
00db753
cd -
7055433
find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
7055433
00db753
# I see no way of installing slic3r with it's build script
00db753
# So I copy the files around manually
00db753
mkdir -p %{buildroot}%{_bindir}
00db753
mkdir -p %{buildroot}%{perl_vendorlib}
7055433
mkdir -p %{buildroot}%{_datadir}/%{name}
52dcceb
mkdir -p %{buildroot}%{_datadir}/icons
180504c
mkdir -p %{buildroot}%{_datadir}/appdata
7055433
cf513b2
cp -a %{orig}.pl %{buildroot}%{_bindir}/%{name}
00db753
cp -ar lib/* %{buildroot}%{perl_vendorlib}
00db753
7055433
cp -a var/* %{buildroot}%{_datadir}/%{name}
52dcceb
cp -r hicolor %{buildroot}%{_datadir}/icons
7055433
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
7055433
180504c
cp %{SOURCE2} %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
180504c
00db753
%{_fixperms} %{buildroot}*
7055433
7055433
%check
00db753
cd xs
adbcc21
./Build test verbose=1
00db753
cd -
00db753
SLIC3R_NO_AUTO=1 perl Build.PL installdirs=vendor
00db753
# the --gui runs no tests, it only checks requires
7055433
52dcceb
%post
52dcceb
/sbin/ldconfig
52dcceb
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
52dcceb
52dcceb
%postun
52dcceb
/sbin/ldconfig
52dcceb
if [ $1 -eq 0 ] ; then
52dcceb
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
52dcceb
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
52dcceb
fi
52dcceb
52dcceb
%posttrans
52dcceb
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
52dcceb
7055433
%files
00db753
%doc README.md
7055433
%{_bindir}/%{name}
cf513b2
%{perl_vendorlib}/Slic3rPrusa*
cf513b2
%{perl_vendorarch}/Slic3rPrusa*
cf513b2
%{perl_vendorarch}/auto/Slic3rPrusa*
52dcceb
%{_datadir}/icons/hicolor/*/apps/%{name}.png
7055433
%{_datadir}/applications/%{name}.desktop
180504c
%{_datadir}/appdata/%{name}.appdata.xml
7055433
%{_datadir}/%{name}
7055433
7055433
%changelog
431482e
* Wed Feb 22 2017 Miro Hrončok <mhroncok@redhat.com> - 1.33.8-1
431482e
- Update to 1.33.8
4105d45
- Mention it's a fork in the description and appdata file
4105d45
- Require hicolor-icon-theme
0d5ea80
- Exclude big endian arches
431482e
39612e0
* Sat Dec 17 2016 Miro Hrončok <mhroncok@redhat.com> - 1.31.6-1
39612e0
- Update to 1.31.6
4861264
- Bundle admesh
0985d3c
- Recommend Thread::Queue for faster slicing
51fd39f
- Unbundle glew
39612e0
cf513b2
* Fri Nov 11 2016 Miro Hrončok <mhroncok@redhat.com> - 1.31.4-1
cf513b2
- New package adapted from the slic3r package