How to auto generate pngs from svgs with the sdk

I believe that was also what @attah was suggesting. I started down that road, but it’s more appropriate for single commands than shell foo :slight_smile:

Damn. So now it seems we will have to summon a magi from the depths. @martyone ?

Ok, upon reading those spec files I realized that rpmbuild is probably turing complete and we can just chuck the rest :slight_smile: Are

%{SOURCE31} \

values availble in shadow builds ? EDIT. Sorry, just re-read. They are defined in the spec.

If I understand this correctly, given the declaration of the dependency on BuildRequires: sailfish-svg2png, all that’s required is to include the files (svg.path, etc in the pro) and the files section declaration and the conversions are done without the loop construct?

Having read through the spec and pro, that seems to be assembling single individual commands, which are executed as additional build/make steps?

I just meant as an example for making files available in the build environment.
If i sent you on a wild goose-chase for automatic icons, i’m sorry, that’s not there

Those don’t seem to be available to rpmbuild, however.

The QT docs contain an example something like

mytarget.target = .mycommand
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2

mytarget2.commands = @echo Building $$mytarget.target
QMAKE_EXTRA_TARGETS += mytarget mytarget2

Which suggest one could assemble the command, or copy from a file. I tried that and failed :wink: But I probably made some silly error.

Ok, so this sort of works

Source31:   harbour-allthenews.svg
...

%make_install
install -D -m0644 %{SOURCE31}  %{_tmppath}/

for size in 86 108 128 172
do
   mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/
   rsvg-convert --width=$size --height=$size --output \
           %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png \
          %{_tmppath}/harbour-allthenews.svg
done

So, now the file is copied from project root to _temppath and rsvg-convert produces output.

sb2 complains

 (WARNING)	rsvg-convert[7267/1870894912]	Path not found for FD 4, for __fxstatat64()
 (WARNING)	rsvg-convert[7270/1870927680]	Path not found for FD 4, for __fxstatat64()
 (WARNING)	rsvg-convert[7273/1870640960]	Path not found for FD 4, for __fxstatat64()
 (WARNING)	rsvg-convert[7276/1870231360]	Path not found for FD 4, for __fxstatat64()
# exit 0 (0)

But it works!

Be sure to clean and remove pngs that would otherwise get installed.

EDIT: turns out it’s a path relative to the spec, of course.

install -D -m0644 /home/mwa/src/sailfish/allthenews/rpm/harbour-allthenews.svg /var/tmp/

Just by chance I had the svg in rpm too. AND props to @nephros!