File gettext.spec of Package gettext

#
# spec file for package gettext (version 0.17)
#
# Copyright (c) Lincom Software Team. All spec files
# are released under the CC-BY-NC-ND, version 3 United States.
#

# Starter Variables
%bcond_without jar
%bcond_without java
%bcond_without check

# Basic Information
Name:		gettext
Version:	0.17
Release:	2%{?dist}
Summary:	Set of tools and documentation to help produce multi-lingual messages.
Group:		Development/Tools
License:	GPLv3 and LGPLv2+
URL:		http://www.gnu.org/software/gettext 

# Source Information
Source0:	http://ftp.gnu.org/gnu/gettext/gettext-%{version}.tar.gz
Patch0:		http://www.linuxfromscratch.org/patches/lfs/development/gettext-0.17-upstream_fixes-2.patch

# Build Information
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	autoconf automake libtool bison gcc-c++
if %{with java}
BuildRequires:	gcc-java libgcj
if %{with jar}
BuildRequires:	%{_bindir}/fastjar
BuildRequires:	zip unzip
%endif
%endif
BuildRequires:	expat-devel
Requires(post):	/sbin/install-info
Requires(preun):	/sbin/install-info

%description
The GNU gettext package provides a set of tools and documentation for
producing multi-lingual messages in programs. Tools include a set of
conventions about how programs should be written to support message
catalogs, a directory and file naming organization for the message
catalogs, a runtime library which supports the retrieval of translated
messages, and stand-alone programs for handling the translatable and
the already translated strings. Gettext provides an easy to use
library and tools for creating, using, and modifying natural language
catalogs and is a powerful and simple method for internationalizing
programs.


%package devel
Summary: Development files for %{name}
Group: Development/Tools
License: LGPLv2+
Requires: %{name} = %{version}-%{release}
Requires: %{name}-libs = %{version}-%{release}
Requires(post): info
Requires(preun): info


%description devel
This package contains all development related files necessary for
developing or compiling applications/libraries that needs
internationalization capability. You also need this package if you
want to add gettext support for your project.


%package libs
Summary: Libraries for %{name}
Group: System Environment/Libraries
License: LGPLv2+

%description libs
This package contains libraries used internationalization support.

%prep
%setup -q
%patch0 -p1

%build
[ -f  %{_datadir}/automake/depcomp ] && cp -f %{_datadir}/automake/{depcomp,ylwrap} .

%if %{with java}
export JAVAC=gcj
%if %{with jar}
export JAR=fastjar
%endif
%endif
%configure --without-included-gettext --enable-nls --disable-static \
    --enable-shared --with-pic-=yes --disable-csharp \
%if %{with java}
    --enable-java \
%else
    --disable-java --disable-native-java \
%endif
    --disable-rpath \
	--prefix=/usr
make %{?_smp_mflags} %{?with_java:GCJFLAGS="-findirect-dispatch"}

make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} lispdir=%{_datadir}/emacs/site-lisp EXAMPLESFILES=""

# Gettext should be moved to the /bin directory
mkdir -pv %{buildroot}/bin
mv -v %{buildroot}%{_bindir}/gettext %{buildroot}/bin
ls -sv ../../bin/gettext %{buildroot}%{_bindir}/gettext

# make preloadable_libintl.so executable
chmod 755 ${RPM_BUILD_ROOT}%{_libdir}/preloadable_libintl.so

# Yet again, the failures of %{_infodir}
rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir

#### The following copied shamelessly from Fedora (and Mandriva) ####
# doc relocations
for i in gettext-runtime/man/*.html; do
  rm ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/`basename $i`
done
rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/javadoc*

rm -rf ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/examples

rm -rf htmldoc
mkdir htmldoc
mv ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/* ${RPM_BUILD_ROOT}/%{_datadir}/doc/libasprintf/* htmldoc
rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/libasprintf
rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext

## note libintl.jar does not build with gcj < 4.3
## since it would not be fully portable
%if %{with jar}
### this is no longer needed since examples not packaged
## set timestamp of examples ChangeLog timestamp for brp-java-repack-jars
#for i in `find ${RPM_BUILD_ROOT} examples -newer ChangeLog -type f -name ChangeLog`; do
#  touch -r ChangeLog  $i
#done
%else
# in case another java compiler is installed
rm -f ${RPM_BUILD_ROOT}%{_datadir}/%{name}/libintl.jar
%endif

rm -f ${RPM_BUILD_ROOT}%{_datadir}/%{name}/gettext.jar

# remove unpackaged files from the buildroot
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/emacs
rm ${RPM_BUILD_ROOT}%{_libdir}/lib*.la


%find_lang %{name}-runtime
%find_lang %{name}-tools
cat %{name}-*.lang > %{name}.lang

%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/gettext.info.gz %{_infodir}/dir || :


%preun
if [ "$1" = 0 ]; then
  /sbin/install-info --delete %{_infodir}/gettext.info.gz %{_infodir}/dir || :
fi

%postun -p /sbin/ldconfig

%post devel
/sbin/ldconfig
/sbin/install-info %{_infodir}/autosprintf.info %{_infodir}/dir || :


%preun devel
if [ "$1" = 0 ]; then
  /sbin/install-info --delete %{_infodir}/autosprintf.info %{_infodir}/dir || :
fi

%postun devel -p /sbin/ldconfig

%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig

%clean
rm -rf %{buildroot}

%if %{with check}
%check
## For Koji build problem
cp  ${RPM_BUILD_ROOT}%{_libdir}/libgettext*-%{version}.so ${RPM_BUILD}gettext-tools/src/.libs
cp  ${RPM_BUILD_ROOT}%{_libdir}/libgettext*-%{version}.so ${RPM_BUILD}gettext-tools/tests/.libs
cp  ${RPM_BUILD_ROOT}%{_libdir}/libasprintf.so* ${RPM_BUILD}gettext-tools/src/.libs
cp  ${RPM_BUILD_ROOT}%{_libdir}/libasprintf.so* ${RPM_BUILD}gettext-tools/tests/.libs
# this takes quite a lot of time to run
make check
%endif

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc gettext-runtime/ABOUT-NLS AUTHORS gettext-runtime/BUGS
%doc COPYING gettext-tools/misc/DISCLAIM README
%doc NEWS THANKS 
%doc gettext-runtime/man/*.1.html
%doc gettext-runtime/intl/COPYING*
/bin/*
%{_bindir}/*
%{_libdir}/libgettextlib-%{version}.so
%{_libdir}/libgettextsrc-%{version}.so
%{_infodir}/gettext*
%{_mandir}/man1/*
%{_libdir}/%{name}
%if %{with java}
%exclude %{_libdir}/%{name}/gnu.gettext.*
%endif
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/archive.tar.gz
%{_datadir}/%{name}/intl
%{_datadir}/%{name}/po
%{_datadir}/%{name}/styles
%if %{with jar}
%{_datadir}/%{name}/libintl.jar
%endif


%files devel
%defattr(-,root,root,-)
%doc gettext-runtime/man/*.3.html ChangeLog
%{_datadir}/%{name}/ABOUT-NLS
%{_datadir}/%{name}/projects/
%{_datadir}/%{name}/config.rpath
%{_datadir}/%{name}/*.h
%{_datadir}/%{name}/msgunfmt.tcl
%{_datadir}/aclocal/*
%{_includedir}/*
%{_infodir}/autosprintf*
%{_libdir}/libasprintf.so
%{_libdir}/libgettextpo.so
%{_libdir}/libgettextlib.so
%{_libdir}/libgettextsrc.so
%{_libdir}/preloadable_libintl.so
%{_mandir}/man3/*
%{_datadir}/%{name}/javaversion.class
%doc gettext-runtime/intl-java/javadoc*
%if %{with java}
%{_libdir}/%{name}/gnu.gettext.*
%endif

%files libs
%defattr(-,root,root,-)

%{_libdir}/libasprintf.so.*
%{_libdir}/libgettextpo.so.*

%changelog
* Mon Feb 08 2010 Robert Xu <robxu9@gmail.com> 0.17-2
- Expanded Spec File
- Split into Subpackages
* Sun Nov 14 2009 Robert Xu <robxu9@gmail.com> 0.17-1
- Created Initial Spec File.
openSUSE Build Service is sponsored by