# https://github.com/OneMoreGres/ScreenTranslator/commit/fe16cbe669113f79a46af2da8a6221d04f0eb9c4 %global commit0 fe16cbe669113f79a46af2da8a6221d04f0eb9c4 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global commitdate 20170830 #global rname ScreenTranslator %global debug_package %{nil} Name: ScreenTranslator Version: 2.0.0.0 Release: 0.1.%{commitdate}git%{shortcommit0}%{?dist} Summary: Screen capture, OCR and translation tool License: GPLv3+ Url: https://github.com/OneMoreGres/ScreenTranslator Source0: https://github.com/OneMoreGres/ScreenTranslator/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz Source1: https://github.com/tesseract-ocr/tessdata/raw/3.04.00/eng.traineddata BuildRequires: tesseract-devel leptonica-devel BuildRequires: libappstream-glib BuildRequires: hicolor-icon-theme BuildRequires: desktop-file-utils BuildRequires: pkgconfig(xcb-util) BuildRequires: pkgconfig(tesseract) BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Gui) BuildRequires: pkgconfig(Qt5Multimedia) BuildRequires: pkgconfig(Qt5Network) BuildRequires: pkgconfig(Qt5Qml) BuildRequires: pkgconfig(Qt5Script) %description This software allows you to translate any text on screen. Basically it is a combination of screen capture, OCR and translation tools. %prep %setup -qn %{name}-%{commit0} %build # Create translation files. lrelease-qt5 translations/*.ts %{_qt5_qmake} %{_qt5_qmake_flags} %{_qt5_qmake} %{name}.pro \ QMAKE_CXXFLAGS="%{optflags}" \ QMAKE_CFLAGS="%{optflags}" \ QMAKE_LFLAGS="${RPM_LD_FLAGS} -Wl,--as-needed" %make_build %install #make_install DESTDIR=%{buildroot} install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_datadir}/pixmaps install -d %{buildroot}%{_datadir}/%{name} install -d %{buildroot}%{_datadir}/%{name}/translators install -d %{buildroot}%{_datadir}/applications install -d %{buildroot}%{_datadir}/tesseract-ocr/tessdata install -pm 755 %{name} %{buildroot}%{_bindir}/ install -pm 0644 images/* %{buildroot}%{_datadir}/pixmaps/ install -pm 0644 %{SOURCE1} %{buildroot}%{_datadir}/tesseract-ocr/tessdata/ chrpath --delete %{buildroot}%{_bindir}/%{name} cp -v version.json %{buildroot}%{_datadir}/%{name} cp -r translators/* %{buildroot}%{_datadir}/%{name}/translators desktop-file-install \ --dir %{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/applications/%{name}.desktop #install -Dp -m 644 %{SOURCE1} %{buildroot}/%{_datadir}/appdata/%{name}.appdata.xml #find translations -name "*.qm" | sed 's:'%{buildroot}':: #s:.*/\([a-zA-Z]\{2\}\).qm:%lang(\1) \0:' > %{name}.lang mkdir -p %{buildroot}/usr/share/%{name}/translations install -p -m644 translations/*.qm %{buildroot}/%{_datadir}/%{name}/translations %find_lang %{name} --all-name --with-qt --without-mo %check #desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop #appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/%{name}.appdata.xml %post touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : %postun if [ $1 -eq 0 ] ; then touch --no-create %{_datadir}/icons/hicolor &>/dev/null /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : fi %posttrans /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %files -f %{name}.lang %license LICENSE.md %doc README.md %{_bindir}/%{name} %{_datadir}/%{name}/version.json %{_datadir}/%{name}/translators/*.js %{_datadir}/applications/*.desktop %{_datadir}/pixmaps/STIcon.xcf %{_datadir}/pixmaps/STIcon*.png %{_datadir}/pixmaps/icon.ico %{_datadir}/tesseract-ocr/tessdata/eng.traineddata %changelog * Tue Dec 05 2017 Martin Gansser - 1.0.0-1 - Initial release