File sap-locale.spec of Package sap-locale

#
# spec file for package sap-locale (Version 1.0)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild
# nodebuginfo

Name:           sap-locale
License:        GPL v2 or later; LGPL v2.0 or later
Group:          System/Libraries
AutoReq:        on
Version:        1.0
Release:        24
Summary:        SAP-specific Locales
Url:            http://www.novell.com/partners/sap/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         %{name}.tar.gz
ExclusiveArch:  %{ix86} ia64 ppc64 s390x x86_64
BuildRequires:  coreutils glibc-i18ndata glibc-locale sed
Requires:       glibc-locale
Obsoletes:      saplocales

%description 
This package contains all the SAP specific locales needed for running
an SAP Application Server.

The SAP applications were originally written at a time when the
standards for various locales were either not defined at all or were
not in wide usage yet before the release of the SAP applications.

Consequently, there now exists a divergency between the needs of the
SAP applications running under Linux and what is being supplied via the
GNU C Library Locales, which follows the current standards for the
various defined locales.

In order to be able to use SAP applications under SUSE Linux (and
especially under SUSE Linux Enterprise Server (SLES)), Novell is
supplying this package which contains the legacy locales required for
the SAP applications. The detailed list of locales is provided in
package documentation. These locales can coexist with the standard
locales on your system.



Authors:
--------
    Dennis Olsson <dollson@novell.com>
    Petr Baudis <pasky@suse.cz>

%prep
%setup -n sap-locale
# Where to find the native "gconv" shared module objects, depending on the archictecture bit-width.
%define LIBgconv	"%{_libdir}/gconv"

%build
echo "_libdir = '%{_libdir}'  _lib = '%{_lib}'"
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
# While we need to manipulate the path, use a shell instead of an RPM variable 
LIBgconv="%{LIBgconv}"
# Create all needed infrastructure directories
for dir in %{_prefix}/share/locale %{_prefix}/lib/locale "${LIBgconv}"
do
    install -d -m 755 ${RPM_BUILD_ROOT}${dir}
done
# Install all native modules and files for all architectures
install -m 444 locale.alias.SAP ${RPM_BUILD_ROOT}%{_prefix}/share/locale
cp -a locale/ ${RPM_BUILD_ROOT}%{_prefix}/lib/
cp -a gconv/ ${RPM_BUILD_ROOT}/${LIBgconv%/*}/
%ifarch x86_64
    # Compat 32-bit gconv modules for the "x86_64" architecture.
    install -d -m 755 ${RPM_BUILD_ROOT}${LIBgconv/64}/gconv
    cp -a gconv-32/* ${RPM_BUILD_ROOT}${LIBgconv/64}/gconv
%endif
%ifarch ia64
    # Compat 32-bit "gconv" modules for the "ia64" architecture.
    install -d -m 755 ${RPM_BUILD_ROOT}/emul/ia32-linux/usr/lib/gconv
    # TODO: This cannot be correct -- Just above "gconv" was used as native 64-bit; How can that
    # TODO: work in a 32-bit (emulated) environment??
    cp -a gconv ${RPM_BUILD_ROOT}/emul/ia32-linux/usr/lib/
    # TODO: Should more likely be this:
    # cp -a gconv-32 ${RPM_BUILD_ROOT}/emul/ia32-linux/usr/lib/
%endif
# Let us put the documentation together for this package:
install -d -m 755 ${RPM_BUILD_ROOT}%{_docdir}/%{name}/
# and for the 32-bit package on architectures that have this:
%ifarch x86_64 ia64
install -d -m 755 ${RPM_BUILD_ROOT}%{_docdir}/%{name}-32bit/
%endif

%clean
rm -rf ${RPM_BUILD_ROOT}

%pre
# Currently nothing to do.

%post
# Do not run on build system
[[ -e /.buildenv ]] && exit 0
exit 0

%preun
# Currently nothing to do.

%postun
# Currently nothing to do.

%files 
%defattr(444, root, root, 755)
%{_docdir}/%{name}/
%doc COPYING
%doc COPYING.LIB
%doc README
%{_prefix}/lib/locale/*
%{_libdir}/gconv/*
%{_prefix}/share/locale/locale.alias.SAP
%ifarch x86_64

%package 32bit
Summary:        SAP Specific Locales (for 32-bit emulation)
Group:          Productivity/Other
AutoReq:        on
Requires:       %{name}

%description 32bit
Supplies the same SAP Specific Locales as does "%{name}", but for
the 32-bit environment.


Supplies the same SAP Specific Locales as does "%{name}", but for
the 32-bit environment.

%files 32bit
%defattr(444, root, root, 755)
%{_docdir}/%{name}-32bit/
%doc COPYING
%doc COPYING.LIB
%doc README
%{_prefix}/lib/gconv/
%{_prefix}/lib/gconv/*
%endif
%ifarch ia64

%package 32bit
Summary:        SAP Specific Locales (for 32-bit emulation)
Group:          Productivity/Other
AutoReq:        on
Requires:       %{name}

%description 32bit
Supplies the same SAP Specific Locales as does "%{name}", but for
the 32-bit environment.


Supplies the same SAP Specific Locales as does "%{name}", but for
the 32-bit environment.

%files 32bit
%defattr(444, root, root, 755)
%{_docdir}/%{name}-32bit/
%doc COPYING
%doc COPYING.LIB
%doc README
/emul/ia32-linux/usr/
/emul/ia32-linux/usr/lib/
/emul/ia32-linux/usr/lib/gconv/
/emul/ia32-linux/usr/lib/gconv/*
%endif

%changelog
* Mon Jan 21 2008 pbaudis@suse.cz
- Introduce cs_CZ.iso88592@SAP, sorting numbers before letters
* Fri Dec 21 2007 pbaudis@suse.cz
- Fix de_DE and ko_KR locale names to contain valid codeset part
* Mon Nov 19 2007 pbaudis@suse.cz
- Real de_DE.iso88591HP@SAP support
- -32bit package fixes
* Fri Nov 02 2007 pbaudis@suse.cz
- Version 1.0
- Initial creation of package by DOlsson@novell.com and pbaudis@suse.cz