File sap-locale.spec of Package sap-locale

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


Name:           sap-locale
AutoReq:        on
Version:        1.0+git20180205
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}-%{version}.tar.gz
Source1:        baselibs.conf
ExclusiveArch:  %{ix86} ia64 ppc64 ppc64le s390x x86_64
BuildRequires:  glibc-i18ndata
BuildRequires:  glibc-locale
Requires:       glibc-locale
Obsoletes:      saplocales
Provides:       saplocales
Requires(post): coreutils
Requires(post): sed
Requires(postun): coreutils
Requires(postun): sed
%if 0%{?suse_version} > 1320
# Needed for reference to __gconv_transliterate
%define __filter_GLIBC_PRIVATE 1
%endif

%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.

%prep
%setup -q

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

%install
# Create all needed infrastructure directories
for dir in %{_prefix}/share/locale/locale.alias.d %{_prefix}/lib/locale %{_libdir}/gconv; 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/locale.alias.d/SAP
cp -a locale/ ${RPM_BUILD_ROOT}%{_prefix}/lib/
cp -a gconv/ ${RPM_BUILD_ROOT}/%{_libdir}/

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
	# Regenerate the file - strip all below the autogen delimiter, then
	# restore the autogen part based on new contents
	sed -i -e '/^###X# /Q' "$l"
	echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
	cat "$l.d"/* >>"$l"
done
iconvconfig

%postun
for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
	# Regenerate the file - strip all below the autogen delimiter, then
	# restore the autogen part based on new contents
	sed -i -e '/^###X# /Q' "$l"
	[ -d "$l.d" ] || continue 
	echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
	cat "$l.d"/* >>"$l"
done
iconvconfig

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

%changelog
openSUSE Build Service is sponsored by