#
# Conditional build
-%bcond_without tests # make check
-#
-%define tzcode_ver 2009t
-%define tzdata_ver 2009u
+%bcond_without tests # make check
+%bcond_with java # build java subpackage
+
+%define tzcode_ver 2010n
+%define tzdata_ver 2010n
Summary: Timezone data
Summary(pl.UTF-8): Dane o strefach czasowych
Name: tzdata
Version: %{tzdata_ver}
-Release: 1
+Release: 0.1
License: Public Domain (database), BSD/LGPL v2.1+ (code/test suite)
Group: Base
Source0: %{name}-base-0.tar.bz2
# Source0-md5: 906a4c98cc5240f416524a256b039c42
Source1: ftp://elsie.nci.nih.gov/pub/%{name}%{tzdata_ver}.tar.gz
-# Source1-md5: 91355f66ab9bffe3d450357ff7a1189a
+# Source1-md5: b5eefb4986866895ab84f52220f1dfa6
Source2: ftp://elsie.nci.nih.gov/pub/tzcode%{tzcode_ver}.tar.gz
-# Source2-md5: 17fe1e12237b11d490f62dcec4b4bc11
+# Source2-md5: a7a776a5713831993e814fe0c05f9fd5
Source3: timezone.init
Source4: timezone.sysconfig
+Source5: javazic.tar.gz
+# Source5-md5: 6a3392cd5f1594d13c12c1a836ac8d91
Patch0: %{name}-test-update.patch
+Patch1: javazic-fixup.patch
URL: http://www.twinsun.com/tz/tz-link.htm
-BuildRequires: gawk
-BuildRequires: perl-base
-BuildRequires: rpmbuild(macros) >= 1.228
+BuildRequires: rpmbuild(macros) >= 1.300
+%if %{with java}
+BuildRequires: jpackage-utils
+BuildRequires: rpm-javaprov
+%endif
Requires(post,preun): /sbin/chkconfig
Requires: /sbin/chkconfig
Requires: rc-scripts >= 0.4.1.4
Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
całym świecie.
+%package java
+Summary: Timezone data for Java
+Summary(pl.UTF-8): Dane stref czasowych dla Javy
+Group: Base
+
+%description java
+This package contains timezone information for use by Java runtimes.
+
+%description java -l pl.UTF-8
+Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
+programów w Javie.
+
%package zoneinfo_right
Summary: Non-POSIX (real) time zones
Summary(es.UTF-8): Zonas de tiempo reales (no de POSIX)
s|@objpfx@|`pwd`/obj/|
s|@datadir@|%{_datadir}|
s|@install_root@|$RPM_BUILD_ROOT|
-" Makeconfig.in > Makeconfig
+" 'Makeconfig.in' > Makeconfig
grep -v tz-art.htm tzcode/tz-link.htm > tzcode/tz-link.html
+%if %{with java}
+install -d javazic
+tar zxf %{SOURCE5} -C javazic
+cd javazic
+%patch1
+
+# Hack alert! sun.tools may be defined and installed in the
+# VM. In order to guarantee that we are using IcedTea/OpenJDK
+# for creating the zoneinfo files, rebase all the packages
+# from "sun." to "rht.". Unfortunately, gcj does not support
+# any of the -Xclasspath options, so we must go this route
+# to ensure the greatest compatibility.
+# XXX: do we want 'pld' instead of 'rht'?
+mv sun rht
+find . -type f -name '*.java' -print0 \
+ | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
+ -e 's:sun\.util\.:rht.util.:g'
+cd -
+%endif
+
%build
%{__make}
+%if %{with java}
+cd javazic
+%javac -source 1.5 -target 1.5 -classpath . $(find -name '*.java')
+cd ../tzdata
+%java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \
+ -d ../zoneinfo/java \
+ africa antarctica asia australasia europe northamerica pacificnew \
+ southamerica backward etcetera solar87 solar88 solar89 systemv \
+ ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward
+cd ..
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
%{__make} check \
CC="%{__cc}" \
CFLAGS="%{rpmcflags} %{rpmldflags}"
+TZDIR=$(pwd)/obj ./obj/test-tz
+TZDIR=$(pwd)/obj ./obj/tst-timezone
: ====================TESTING END=====================
%endif
-
# glibc.spec didn't keep it. so won't here either.
rm -rf $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
# behave more like glibc.spec
> $RPM_BUILD_ROOT/etc/localtime
# header file
-install tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
-install tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
+cp -a tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
+cp -a tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
-install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
+install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
+%if %{with java}
+cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%{_datadir}/zoneinfo
%exclude %{_datadir}/zoneinfo/right
+%if %{with java}
+%files java
+%defattr(644,root,root,755)
+%{_datadir}/javazi
+%endif
+
%files zoneinfo_right
%defattr(644,root,root,755)
%{_datadir}/zoneinfo/right