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

#
# spec file for package kde4-l10n
#
# Copyright (c) 2011 SUSE LINUX Products 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/
#

# icecream 0

Name:           kde4-l10n
Version:        4.7.2
Release:        1
License:        GPLv2+
Summary:        English translations for KDE
Url:            http://l10n.kde.org/
Group:          System/Localization
#@SOURCES@
Source1000:     COPYING
Source1001:     texts
Source1002:     update_spec.pl
Source1003:     pre_checkin.sh
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  libkde4-devel
BuildRequires:  recode
BuildRequires:  update-desktop-files
%define kdepim_version %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%define build_languages @LANGUAGES@
%define split_languages @SPLITLANGS@

%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.bz2; do tar xjf $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(KDE4 REQUIRED)" >> CMakeLists.txt
echo "find_package(Gettext REQUIRED)" >> CMakeLists.txt
echo "include(KDE4Defaults)" >> CMakeLists.txt
echo "include(MacroOptionalAddSubdirectory)" >> 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 "macro_optional_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}/kde4-l10n-$i
   install -m 644 %{SOURCE1000} %{buildroot}%{_docdir}/kde4-l10n-$i
done

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

   mkdir -p %{buildroot}%{_docdir}/kde4-l10n-$i-data
   install -m 644 %{SOURCE1000} %{buildroot}%{_docdir}/kde4-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

#
# remove unwanted files
#
rm -f  %{buildroot}/opt/kde3/share/locale/*/charset
find %{buildroot}%{_kde4_htmldir}/ -type l -name common -print0 | xargs -0 rm
#
rm -f files.* files.data.* files.doc.*

for i in %build_languages sr@latin sr@ijekavian sr@ijekavianlatin; do
   turtlelang=$i
   l=$i
   case $i in
      de)
         turtlelang=de_DE
         ;;
      mk)
         turtlelang=mk_MK
         ;;
      fr)
         turtlelang=fr_FR
         ;;
      sr@latin)
         l=sr
         ;;
      sr@ijekavian)
         l=sr
         ;;
      sr@ijekavianlatin)
         l=sr
         ;;
   esac
   {
   echo "%defattr(-,root,root)"
   if test -d %{buildroot}%{_datadir}/locale/$i; then
      echo "%dir %{_datadir}/locale/$i"
      echo "%dir %{_datadir}/locale/$i/LC_MESSAGES"
      echo "%lang($l) %{_datadir}/locale/$i/LC_MESSAGES/*.mo"
   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}/kde4-l10n-$l"

   } >> files.$l
   {
   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 -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}%{_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}%{_kde4_appsdir}/khangman/$i.txt; then
      echo "%dir %{_kde4_appsdir}/khangman"
      echo "%lang($l) %{_kde4_appsdir}/khangman/$i.txt"
   fi
   if test -f %{buildroot}%{_kde4_appsdir}/katepart/syntax/logohighlightstyle.$turtlelang.xml; then
      echo "%lang($l) %{_kde4_appsdir}/katepart/syntax/logohighlightstyle.$turtlelang.xml"
      echo "%dir %{_kde4_appsdir}/katepart/syntax"
      echo "%dir %{_kde4_appsdir}/katepart"
   fi
   kturtle=0
   if test -f %{buildroot}%{_kde4_appsdir}/kturtle/data/logokeywords.$turtlelang.xml; then
      echo "%lang($l) %{_kde4_appsdir}/kturtle/data/logokeywords.$turtlelang.xml"
      echo "%dir %{_kde4_appsdir}/kturtle/data"
      echo "%dir %{_kde4_appsdir}/kturtle"
      kturtle=1
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/kturtle/examples/$turtlelang; then
      echo "%lang($l) %{_kde4_appsdir}/kturtle/examples/$turtlelang"
      echo "%dir %{_kde4_appsdir}/kturtle/examples"
      if test "$kturtle" = 0; then
         echo "%dir %{_kde4_appsdir}/kturtle"
      fi
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/klettres/$i; then
      echo "%lang($l) %{_kde4_appsdir}/klettres/$i"
      echo "%dir %{_kde4_appsdir}/klettres"
   fi
   if test -f %{buildroot}%{_kde4_appsdir}/ktuberling/sounds/$i.soundtheme; then
      echo "%lang($l) %{_kde4_appsdir}/ktuberling/sounds/$i.soundtheme"
   fi
   if test -d %{buildroot}%{_kde4_appsdir}/ktuberling/sounds/$i; then
      echo "%lang($l) %{_kde4_appsdir}/ktuberling/sounds/$i"
      echo "%dir %{_kde4_appsdir}/ktuberling"
      echo "%dir %{_kde4_appsdir}/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
   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 -d %{buildroot}%{_docdir}/kde4-l10n-$i-data; then
      echo "%{_docdir}/kde4-l10n-$i-data"
   fi
   } >> files.data.$l

   {
   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}%{_docdir}/kde4-l10n-$i-doc ; then
      echo "%{_docdir}/kde4-l10n-$i-doc"
   fi
   } >> files.doc.$l
   cat files.$l files.data.$l files.doc.$l >files.all.$l
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@

%clean
rm -rf %{buildroot}

%changelog
openSUSE Build Service is sponsored by