diff --git a/rpm/harbour-quill.spec b/rpm/harbour-quill.spec index 9f273d5..c82e632 100644 --- a/rpm/harbour-quill.spec +++ b/rpm/harbour-quill.spec @@ -64,16 +64,30 @@ install -m 0644 %{_builddir}/harbour-quill_it.qm %{buildroot}%{_datadir}/%{name} # the source dir, the tarball is NOT extracted into the build dir, and rpm/ # is NOT copied there either. mkdir -p %{buildroot}/usr/share/applications -if [ -f %{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -elif [ -f %{_builddir}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -elif [ -f %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop ]; then - install -m 0644 %{_builddir}/%{name}-%{version}/rpm/%{name}.desktop %{buildroot}/usr/share/applications/ -else - echo "ERROR: %{name}.desktop not found (checked sibling source, build dir, extracted source)" >&2 + +# Il desktop file sta accanto a questa spec, e sfdk imposta %{_sourcedir} +# proprio alla cartella rpm/ dei sorgenti — in ENTRAMBE le modalita': build +# dentro il progetto e shadow build (Qt Creator). E' l'unico percorso che regge +# in tutte e due; i tentativi relativi a %{_builddir} restano come riserva per +# chi compila da un tarball estratto a mano (rpmbuild classico). +DESKTOP="" +for candidate in "%{_sourcedir}/%{name}.desktop" \ + "%{_builddir}/../%{name}-%{version}/rpm/%{name}.desktop" \ + "%{_builddir}/rpm/%{name}.desktop" \ + "%{_builddir}/%{name}-%{version}/rpm/%{name}.desktop"; do + if [ -f "$candidate" ]; then + DESKTOP="$candidate" + break + fi +done +if [ -z "$DESKTOP" ]; then + echo "ERROR: %{name}.desktop not found" >&2 + echo " cercato in %{_sourcedir} e sotto %{_builddir}" >&2 + echo " contenuto di %{_sourcedir}:" >&2 + ls -la %{_sourcedir} >&2 || true exit 1 fi +install -m 0644 "$DESKTOP" %{buildroot}/usr/share/applications/%{name}.desktop %files %defattr(-,root,root,-)