File kde-l10n.spec.in of Package kde-l10n

#
# spec file for package kde-l10n.spec
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define build_languages @LANGUAGES@
%define split_languages @SPLITLANGS@
Name:           kde-l10n
Version:        17.08.3
Release:        0
Summary:        English translations for KDE
License:        GPL-2.0+
Group:          System/Localization
Url:            http://l10n.kde.org/
#@SOURCES@
Source1000:     COPYING
Source1001:     texts
Source1002:     update_spec.pl
Source1003:     pre_checkin.sh
BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  fdupes
BuildRequires:  kdoctools-devel
BuildRequires:  ki18n-devel
BuildRequires:  libkde4-devel
BuildRequires:  libqt5-linguist-devel
BuildRequires:  update-desktop-files
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
All the requirements for a translated desktop. This package
contains application translations, help files, and screenshots.

#@PACKAGES@

%prep
%setup -q -T -c %{name}
for i in $RPM_SOURCE_DIR/kde-l10n-*.tar.xz; do tar xf $i; done

#Create top CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.6)" >> CMakeLists.txt
echo "project(kde-i18n)" >> CMakeLists.txt
echo "" >> CMakeLists.txt
echo "find_package(Gettext REQUIRED)" >> CMakeLists.txt
echo "" >> CMakeLists.txt
echo "if(NOT GETTEXT_MSGMERGE_EXECUTABLE)" >> CMakeLists.txt
echo "  MESSAGE(FATAL_ERROR \"Please install the msgmerge binary\")" >> CMakeLists.txt
echo "endif(NOT GETTEXT_MSGMERGE_EXECUTABLE)" >> CMakeLists.txt
echo "if(NOT GETTEXT_MSGFMT_EXECUTABLE)" >> CMakeLists.txt
echo "  MESSAGE(FATAL_ERROR \"Please install the msgfmt binary\")" >> CMakeLists.txt
echo "endif(NOT GETTEXT_MSGFMT_EXECUTABLE)" >> CMakeLists.txt
echo "" >> CMakeLists.txt
echo "set(BUILD_ALL 1)" >> CMakeLists.txt
echo "" >> CMakeLists.txt
for lang in $(ls); do
   if [ -f $lang/CMakeLists.txt ]; then
      echo "add_subdirectory($lang)" >>CMakeLists.txt
   fi
done


%build
for i in $(find . -name "desktop_*.po"); do
   rm -f $i
done
%cmake_kde4
%make_jobs


%install
make DESTDIR=%{buildroot} install/fast
for i in %build_languages; do
   mkdir -p %{buildroot}%{_docdir}/kde-l10n-$i
   install -m 644 %{SOURCE1000} %{buildroot}%{_docdir}/kde-l10n-$i
done

for i in %split_languages; do
   mkdir -p %{buildroot}%{_docdir}/kde-l10n-$i-doc
   install -m 644 %{SOURCE1000} %{buildroot}%{_docdir}/kde-l10n-$i-doc

   mkdir -p %{buildroot}%{_docdir}/kde-l10n-$i-data
   install -m 644 %{SOURCE1000} %{buildroot}%{_docdir}/kde-l10n-$i-data
done


# hacks
rm -f %{buildroot}%{_datadir}/locale/*/flag.png
rm -f %{buildroot}%{_datadir}/locale/*/charset
rm -f %{buildroot}%{_datadir}/locale/*/index.lokalize
rm -f %{buildroot}%{_datadir}/kstars/*/info_url.dat

#
# remove unwanted files
#
rm -f %{buildroot}%{_kde4_appsdir}/kanagram/hu.txt
rm -f %{buildroot}%{_datadir}/klettres/lt.txt
rm -f  %{buildroot}/opt/kde3/share/locale/*/charset
find %{buildroot}%{_kde4_htmldir}/ -type l -name common -print0 | xargs -0 rm

# Duplicated mo files between tarballs and applications
find %{buildroot}%{_datadir}/locale/ -type f \( -name akonadi_baloo_indexer.mo -o \
 -name baloowidgets.mo -o -name kget.mo -o -name kgetplugin.mo -o \
 -name plasma_runner_kget.mo -o -name plasma_applet_kget.mo -o \
 -name sweeper.mo -o -name juk.mo -o -name kimagemapeditor.mo -o \
 -name kmix.mo -o -name kmouth.mo -o -name kolf.mo -o -name ksirk.mo -o \
 -name palapeli.mo -o -name ksirkskineditor.mo -o -name kio_jabberdisco.mo -o \
 -name kopete.mo \) -delete

# Duplicated manpages between tarballs and applications
find %{buildroot}%{_mandir}/ -type f \( -name kdesu.1 \
 -o -name adddebug.1 -o -name cheatmake.1 -o -name create_cvsignore.1 \
 -o -name create_makefile.1 -o -name create_makefiles.1 -o -name cvscheck.1 \
 -o -name cvslastchange.1 -o -name cvslastlog.1 -o -name cvsrevertlast.1 \
 -o -name cxxmetric.1 -o -name extend_dmalloc.1 -o -name extractrc.1 \
 -o -name fixincludes.1 -o -name pruneemptydirs.1 -o -name qtdoc.1 \
 -o -name reportview.1 -o -name transxx.1 -o -name zonetab2pot.py.1 \
 -o -name kmouth.1 \
 \) -delete

#
rm -f files.* files.data.* files.doc.*

for i in %build_languages sr@latin sr@ijekavian sr@ijekavianlatin; do
   turtlelang=$i
   autolang=$i
   l=$i
   f=$i
   case $i in
      de)
         turtlelang=de_DE
         autolang=de_DE
         ;;
      mk)
         turtlelang=mk_MK
         ;;
      fr)
         turtlelang=fr_FR
         ;;
      ru)
         autolang=ru_RU
         ;;
      uk)
         autolang=uk
         ;;
      it)
         autolang=it_IT
         ;;
      sr@latin)
         l=sr
         f=sr
         ;;
      sr@ijekavian)
         l=sr
         f=sr
         ;;
      sr@ijekavianlatin)
         l=sr
         f=sr
         ;;
      ca@valencia)
         f=caValencia
         ;;
   esac
   {
   if test -d %{buildroot}%{_datadir}/locale/$i/LC_SCRIPTS/ki18n5; then
      rm -rf %{buildroot}%{_datadir}/locale/$i/LC_SCRIPTS/ki18n5
   fi
   if test -d %{buildroot}%{_datadir}/lokalize; then
      rm -rf %{buildroot}%{_datadir}/lokalize
   fi
   echo "%defattr(-,root,root)"
   if test -d %{buildroot}%{_datadir}/locale/$i; then
      echo "%lang($l) %{_datadir}/locale/$i/"
   fi
   if test -f %{buildroot}%{_datadir}/locale/$i/ceviri_uygula.sh; then
      echo "%lang($l) %{_datadir}/locale/$i/ceviri_uygula.sh"
   fi
   if test -d %{buildroot}%{_datadir}/locale/$i/LC_SCRIPTS; then
      echo "%lang($l) %{_datadir}/locale/$i/LC_SCRIPTS/"
      echo "%dir %{_datadir}/locale/$i/LC_SCRIPTS"
   fi
   if test -f %{buildroot}%{_datadir}/locale/$i/entry.desktop; then
      echo "%lang($l) %{_datadir}/locale/$i/entry.desktop"
   fi
   if test -d %{buildroot}%{_mandir}/$i; then
      echo "%lang($l) %{_mandir}/$i"
   fi
   for d in %{buildroot}%{_kde4_iconsdir}/*/*/*/l10n/$i %{buildroot}%{_kde4_iconsdir}/*/scalable/*/*/*/l10n/$i; do
      if test -d $d; then
         echo "%lang($l) ${d##%{buildroot}}"
         echo "%dir ${d##%{buildroot}}/../"
      fi
   done

   echo "%{_docdir}/kde-l10n-$l"

   } >> files.$f
   {
   echo "%defattr(-,root,root)"
   if test -d %{buildroot}%{_kde4_appsdir}/khangman/data/$i; then
      echo "%lang($l) %{_kde4_appsdir}/khangman/data/$i"
      echo "%dir %{_kde4_appsdir}/khangman"
      echo "%dir %{_kde4_appsdir}/khangman/data"
   fi
   if test -f %{buildroot}%{_datadir}/khangman/$i.txt; then
      echo "%lang($l) %{_datadir}/khangman/$i.txt"
      echo "%dir %{_datadir}/khangman"
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/kanagram/data/$i; then
      echo "%lang($l) %{_kde4_appsdir}/kanagram/data/$i"
      echo "%dir %{_kde4_appsdir}/kanagram"
      echo "%dir %{_kde4_appsdir}/kanagram/data"
   fi
   if test -f %{buildroot}%{_datadir}/kanagram/$i.txt; then
      echo "%lang($l) %{_datadir}/kanagram/$i.txt"
      echo "%dir %{_datadir}/kanagram"
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/kajongg/voices/$i; then
      echo "%lang($l) %{_kde4_appsdir}/kajongg/voices/$i"
      echo "%dir %{_kde4_appsdir}/kajongg"
      echo "%dir %{_kde4_appsdir}/kajongg/voices"
   fi
   if test -f %{buildroot}%{_kde4_appsdir}/step/objinfo/l10n/$i/Box.html; then
      echo "%dir %{_kde4_appsdir}/step"
      echo "%dir %{_kde4_appsdir}/step/objinfo"
      echo "%dir %{_kde4_appsdir}/step/objinfo/l10n"
      echo "%dir %{_kde4_appsdir}/step/objinfo/l10n/$i"
      echo "%lang($l) %{_kde4_appsdir}/step/objinfo/l10n/$i/*"
   fi
   if test -f %{buildroot}%{_datadir}/step/objinfo/l10n/$i/Box.html; then
      echo "%dir %{_datadir}/step"
      echo "%dir %{_datadir}/step/objinfo"
      echo "%dir %{_datadir}/step/objinfo/l10n"
      echo "%dir %{_datadir}/step/objinfo/l10n/$i"
      echo "%lang($l) %{_datadir}/step/objinfo/l10n/$i/*"
   fi
   if test -f %{buildroot}%{_kde4_appsdir}/khangman/$i.txt; then
      echo "%dir %{_kde4_appsdir}/khangman"
      echo "%lang($l) %{_kde4_appsdir}/khangman/$i.txt"
   fi
   if test -f %{buildroot}%{_datadir}/katepart/syntax/logohighlightstyle.$turtlelang.xml; then
      echo "%lang($l) %{_datadir}/katepart/syntax/logohighlightstyle.$turtlelang.xml"
      echo "%dir %{_datadir}/katepart/syntax"
      echo "%dir %{_datadir}/katepart"
   fi
   kturtle=0
   if test -f %{buildroot}%{_datadir}/kturtle/data/logokeywords.$turtlelang.xml; then
      echo "%lang($l) %{_datadir}/kturtle/data/logokeywords.$turtlelang.xml"
      echo "%dir %{_datadir}/kturtle/data"
      echo "%dir %{_datadir}/kturtle"
      kturtle=1
   fi
   if test -d %{buildroot}%{_datadir}/kturtle/examples/$turtlelang; then
      echo "%lang($l) %{_datadir}/kturtle/examples/$turtlelang"
      echo "%dir %{_datadir}/kturtle/examples"
      if test "$kturtle" = 0; then
         echo "%dir %{_datadir}/kturtle"
      fi
   fi
   if test -d %{buildroot}%{_datadir}/klettres/$i; then
      echo "%lang($l) %{_datadir}/klettres/$i"
      echo "%dir %{_datadir}/klettres"
   fi
   if test -f %{buildroot}%{_datadir}/autocorrect/$i.xml; then
      echo "%lang($l) %{_datadir}/autocorrect/$i.xml"
      echo "%dir %{_datadir}/autocorrect"
   fi
   if test -f %{buildroot}%{_datadir}/ktuberling/sounds/$i.soundtheme; then
      echo "%lang($l) %{_datadir}/ktuberling/sounds/$i.soundtheme"
   fi
   if test -d %{buildroot}%{_datadir}/ktuberling/sounds/$i; then
      echo "%lang($l) %{_datadir}/ktuberling/sounds/$i"
      echo "%dir %{_datadir}/ktuberling"
      echo "%dir %{_datadir}/ktuberling/sounds"
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/ksplash/Themes/Default/*/l10n/$i; then
      echo "%lang($l) %{_kde4_appsdir}/ksplash/Themes/Default/*/l10n/$i"
      echo "%dir %{_kde4_appsdir}/ksplash/Themes/Default/*/l10n"
      echo "%dir %{_kde4_appsdir}/ksplash/Themes/Default/*"
      echo "%dir %{_kde4_appsdir}/ksplash/Themes/Default"
      echo "%dir %{_kde4_appsdir}/ksplash/Themes"
      echo "%dir %{_kde4_appsdir}/ksplash"
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/kvtml/$i; then
      echo "%lang($l) %{_kde4_appsdir}/kvtml/$i"
      echo "%dir %{_kde4_appsdir}/kvtml"
   fi
   if test -d %{buildroot}%{_datadir}/apps/kvtml/$i; then
      echo "%lang($l) %{_datadir}/apps/kvtml/$i"
      echo "%dir %{_datadir}/apps/kvtml"
      echo "%dir %{_datadir}/apps"
   fi
   for d in %{buildroot}%{_kde4_appsdir}/desktoptheme/*/widgets/l10n/$i; do
      if test -d $d; then
         echo "%lang($l) %{_kde4_appsdir}/desktoptheme/*/widgets/l10n/$i"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*/widgets/l10n"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*/widgets"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*"
         echo "%dir %{_kde4_appsdir}/desktoptheme"
      fi
   done
   for d in %{buildroot}%{_kde4_appsdir}/desktoptheme/*/icons/l10n/$i; do
      if test -d $d; then
         echo "%lang($l) %{_kde4_appsdir}/desktoptheme/*/icons/l10n/$i"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*/icons/l10n"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*/icons"
         echo "%dir %{_kde4_appsdir}/desktoptheme/*"
         echo "%dir %{_kde4_appsdir}/desktoptheme"
      fi
   done

   if test -f %{buildroot}%{_kde4_appsdir}/autocorrect/$autolang.xml; then
      echo "%lang($l) %{_kde4_appsdir}/autocorrect/$autolang.xml"
      echo "%dir %{_kde4_appsdir}/autocorrect"
   fi

   if test -f %{buildroot}%{_kde4_appsdir}/autocorrect/$autolang-*.xml; then
      echo "%lang($l) %{_kde4_appsdir}/autocorrect/$autolang-*.xml"
      echo "%dir %{_kde4_appsdir}/autocorrect"
   fi

   if test -d %{buildroot}%{_docdir}/kde-l10n-$i-data; then
      echo "%{_docdir}/kde-l10n-$i-data"
   fi
   } >> files.data.$f

   {
   echo "%defattr(-,root,root)"
   if test -d %{buildroot}%{_kde_html_dir}/$i; then
      echo "%lang($l) %doc %{_kde_html_dir}/$i"
   fi

   if test -d %{buildroot}%{_datadir}/doc/HTML/$i; then
      echo "%lang($l) %doc %{_datadir}/doc/HTML/$i/"
   fi

   if test -d %{buildroot}%{_docdir}/kde-l10n-$i-doc ; then
      echo "%{_docdir}/kde-l10n-$i-doc"
   fi
   } >> files.doc.$f
   cat files.$f files.data.$f files.doc.$f >files.all.$f
done

%fdupes %{buildroot}

for file in %{buildroot}%{_datadir}/locale/*/entry.desktop; do
   grep -q "X-SuSE-translate" "$file" || %suse_update_desktop_file $file
done

#@FILES@

%changelog
openSUSE Build Service is sponsored by