File timezone.spec of Package timezone

#
# spec file for package timezone (Version 2010l)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           timezone
License:        Public Domain, Freeware
Summary:        Timezone Descriptions
Group:          System/Base
Url:            http://www.gnu.org/software/libc/libc.html
PreReq:         filesystem, coreutils
# COMMON-BEGIN
Version:        2010l
Release:        0.<RELEASE2>
Source:         tzdata%{version}.tar.gz
Source1:        tzcode2009k.tar.gz
# COMMON-END
Patch0:         tzdata-china.diff
Patch1:         tzcode-zic.diff
Patch2:         tzcode-ksh.diff
Patch3:         tzcode-link.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
These are configuration files that describe available time zones. You
can select an appropriate time zone for your system with YaST.



%prep
%setup -c -a 1
%patch
%patch1
%patch2
%patch3

%build
make TZDIR=%{_prefix}/share/zoneinfo CFLAGS="$RPM_OPT_FLAGS -DHAVE_GETTEXT=1 -DTZDEFAULT='\"/etc/localtime\"'" AWK=awk
make TZDIR=zoneinfo AWK=awk zones
# Generate posixrules
./zic -y ./yearistype -d zoneinfo -p America/New_York

%install
mkdir -p $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo
cp -a zoneinfo $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/posix
cp -al $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/posix/. $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo
cp -a zoneinfo-leaps $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/right
mkdir -p $RPM_BUILD_ROOT/etc
rm -f $RPM_BUILD_ROOT/etc/localtime
cp -f $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/UTC $RPM_BUILD_ROOT/etc/localtime
install -m 644 iso3166.tab $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/iso3166.tab
install -m 644 zone.tab $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo/zone.tab
install -D -m 755 tzselect $RPM_BUILD_ROOT%{_bindir}/tzselect
install -D -m 755 zdump $RPM_BUILD_ROOT%{_sbindir}/zdump
install -D -m 755 zic $RPM_BUILD_ROOT%{_sbindir}/zic

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -f /etc/sysconfig/clock ];
then
    . /etc/sysconfig/clock
    if [ -n "$TIMEZONE" -a -f /etc/localtime -a -f /usr/share/zoneinfo/$TIMEZONE ]; then
	cp -l /usr/share/zoneinfo/$TIMEZONE /etc/localtime.$$ 2>/dev/null || cp -f /usr/share/zoneinfo/$TIMEZONE /etc/localtime.$$
	mv /etc/localtime.$$ /etc/localtime
    else
	[ ! -f /etc/localtime ] || echo "WARNING: Not updating /etc/localtime with new zone file" >&2
    fi
fi

%files
%defattr(-,root,root)
%verify(not md5 size mtime) %config(noreplace) /etc/localtime
%{_prefix}/share/zoneinfo
%{_bindir}/tzselect
%{_sbindir}/zdump
%{_sbindir}/zic

%changelog
openSUSE Build Service is sponsored by