File sap-locale.spec of Package sap-locale

#
# spec file for package sap-locale
#
# Copyright (c) 2013 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/
#
# nodebuginfo


Name:           sap-locale
AutoReq:        on
Version:        1.0
Release:        0
Summary:        SAP-specific Locales
License:        GPL-2.0+ and LGPL-2.0+
Group:          System/Libraries
Url:            http://www.novell.com/partners/sap/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         %{name}.tar.gz
ExclusiveArch:  %{ix86} ia64 ppc64 ppc64le s390x x86_64
BuildRequires:  coreutils
BuildRequires:  glibc-i18ndata
BuildRequires:  glibc-locale
BuildRequires:  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
Group:          System/Libraries
AutoReq:        on
Requires:       %{name}

%description 32bit
This is a re-packaged binary rpm. For the package source, please look
for the source of the package without the "32bit" ending

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>

%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
Group:          System/Libraries
AutoReq:        on
Requires:       %{name}

%description 32bit
This is a re-packaged binary rpm. For the package source, please look
for the source of the package without the "32bit" ending

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>

%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