[packages/qt5-qtquick1] - added translations

qboosh qboosh at pld-linux.org
Tue Jul 1 21:56:57 CEST 2014


commit 2864e75ac6797927cd36abafa46e4c9d0a8901fb
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jul 1 22:01:24 2014 +0200

    - added translations

 qt5-qtquick1.spec | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/qt5-qtquick1.spec b/qt5-qtquick1.spec
index 2e9aa52..7805ee1 100644
--- a/qt5-qtquick1.spec
+++ b/qt5-qtquick1.spec
@@ -1,6 +1,7 @@
 #
 # Conditional build:
 %bcond_without	qch	# documentation in QCH format
+%bcond_without	qm	# QM translations
 
 %define		orgname		qtquick1
 %define		qtbase_ver		%{version}
@@ -18,6 +19,8 @@ License:	LGPL v2 with Digia Qt LGPL Exception v1.1 or GPL v3
 Group:		X11/Libraries
 Source0:	http://download.qt-project.org/official_releases/qt/5.3/%{version}/submodules/%{orgname}-opensource-src-%{version}.tar.xz
 # Source0-md5:	cd6ffd4a29f7050f71670e7afec09e5d
+Source1:	http://download.qt-project.org/official_releases/qt/5.3/%{version}/submodules/qttranslations-opensource-src-%{version}.tar.xz
+# Source1-md5:	1f8d488b6ac26cdbec7f7f7364cd01d0
 URL:		http://qt-project.org/
 BuildRequires:	Qt5Core-devel >= %{qtbase_ver}
 BuildRequires:	Qt5Designer-devel >= %{qttools_ver}
@@ -33,6 +36,7 @@ BuildRequires:	Qt5XmlPatterns-devel >= %{qtxmlpatterns_ver}
 BuildRequires:	qt5-assistant >= %{qttools_ver}
 %endif
 BuildRequires:	qt5-build >= %{qtbase_ver}
+%{?with_qm:BuildRequires:	qt5-linguist >= 5.2}
 BuildRequires:	qt5-qmake >= %{qtbase_ver}
 BuildRequires:	rpmbuild(macros) >= 1.654
 BuildRequires:	sed >= 4.0
@@ -175,7 +179,7 @@ Qt5 Quick1 (Qt5Declarative) examples.
 Przykłady do biblioteki Qt5 Quick1 (Qt5Declarative).
 
 %prep
-%setup -q -n %{orgname}-opensource-src-%{version}
+%setup -q -n %{orgname}-opensource-src-%{version} %{?with_qm:-a1}
 
 # enable docs
 %{__sed} -i -e '/^# SUBDIRS += doc/s/^# //' src/src.pro
@@ -185,6 +189,13 @@ qmake-qt5
 %{__make}
 %{__make} %{!?with_qch:html_}docs
 
+%if %{with qm}
+cd qttranslations-opensource-src-%{version}
+qmake-qt5
+%{__make}
+cd ..
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__make} install \
@@ -193,6 +204,13 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} install_%{!?with_qch:html_}docs \
 	INSTALL_ROOT=$RPM_BUILD_ROOT
 
+%if %{with qm}
+%{__make} -C qttranslations-opensource-src-%{version} install \
+	INSTALL_ROOT=$RPM_BUILD_ROOT
+# keep only qmlviewer and qtquick1
+%{__rm} $RPM_BUILD_ROOT%{_datadir}/qt5/translations/{assistant,designer,linguist,qmlviewer,qt,qtbase,qtconfig,qtconnectivity,qtdeclarative,qtlocation,qtmultimedia,qtquick1,qtscript,qtxmlpatterns}_*.qm
+%endif
+
 # useless symlinks
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libQt5*.so.5.?
 # actually drop *.la, follow policy of not packaging them when *.pc exist
@@ -229,13 +247,28 @@ ifecho_tree() {
 echo "%defattr(644,root,root,755)" > examples.files
 ifecho_tree examples %{_examplesdir}/qt5/declarative
 
+# find_lang --with-qm supports only PLD qt3/qt4 specific %{_datadir}/locale/*/LC_MESSAGES layout
+find_qt5_qm()
+{
+	name="$1"
+	find $RPM_BUILD_ROOT%{_datadir}/qt5/translations -name "${name}_*.qm" | \
+		sed -e "s:^$RPM_BUILD_ROOT::" \
+		    -e 's:\(.*/'$name'_\)\([a-z][a-z][a-z]\?\)\(_[A-Z][A-Z]\)\?\(\.qm\)$:%lang(\2\3) \1\2\3\4:'
+}
+
+echo '%defattr(644,root,root,755)' > qtquick1.lang
+%if %{with qm}
+find_qt5_qm qmlviewer >> qtquick1.lang
+find_qt5_qm qtquick1 >> qtquick1.lang
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post	-n Qt5Declarative -p /sbin/ldconfig
 %postun	-n Qt5Declarative -p /sbin/ldconfig
 
-%files -n Qt5Declarative
+%files -n Qt5Declarative -f qtquick1.lang
 %defattr(644,root,root,755)
 %doc LGPL_EXCEPTION.txt dist/changes-*
 %attr(755,root,root) %{_libdir}/libQt5Declarative.so.*.*.*
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/qt5-qtquick1.git/commitdiff/2864e75ac6797927cd36abafa46e4c9d0a8901fb



More information about the pld-cvs-commit mailing list