]> git.pld-linux.org Git - packages/tzdata.git/blame - tzdata.spec
up to 2022b
[packages/tzdata.git] / tzdata.spec
CommitLineData
6b9abb55
JB
1#
2# Conditional build
6cac3b7d 3%bcond_without tests # make check
00ab1294 4%bcond_without java # build java subpackage
0eb7e566 5
6cac3b7d
JB
6%ifnarch %{x8664}
7# TODO: add more archs which pass tests
8# tests fail with 32-bit time_t; reenable after transition to 64-bit everywhere
9%undefine with_tests
10%endif
11
55eefd52
ER
12%if "%{pld_release}" == "ac"
13%ifnarch i586 i686 pentium3 pentium4 athlon %{x8664}
14%undefine with_java
15%endif
16%endif
17
f21a80a6 18Summary: Timezone data
e5477455 19Summary(pl.UTF-8): Dane o strefach czasowych
f21a80a6 20Name: tzdata
858ec221 21Version: 2022b
2e6e6a1e 22Release: 1
6b9abb55 23License: Public Domain (database), BSD/LGPL v2.1+ (code/test suite)
3458d90a 24Group: Base
cfa167f6
ER
25#Source0Download: https://www.iana.org/time-zones
26Source0: https://www.iana.org/time-zones/repository/releases/tzdb-%{version}.tar.lz
858ec221 27# Source0-md5: 5997b431868adc23cf645bd7cdde203e
48f17b2c
ER
28Source3: timezone.init
29Source4: timezone.sysconfig
0eb7e566
ER
30Source5: javazic.tar.gz
31# Source5-md5: 6a3392cd5f1594d13c12c1a836ac8d91
8650fa3d 32Patch0: disable-network-tests.patch
0eb7e566 33Patch1: javazic-fixup.patch
1f4e4169 34Patch2: install.patch
6b9abb55 35URL: http://www.twinsun.com/tz/tz-link.htm
af97ec11 36BuildRequires: lzip
55eefd52 37BuildRequires: rpm >= 4.4.9-56
9c28425c 38BuildRequires: rpmbuild(macros) >= 1.623
df36f3e7 39%if %{with java}
fd501718 40BuildRequires: jdk
df36f3e7
ER
41BuildRequires: jpackage-utils
42BuildRequires: rpm-javaprov
43%endif
9c28425c 44Requires(post,preun,postun): systemd-units >= 38
7e1f4700 45Requires: %{name}-zoneinfo = %{version}-%{release}
925acaa9 46Requires: /sbin/chkconfig
a6f970d7 47Requires: rc-scripts >= 0.4.3.0
9c28425c 48Requires: systemd-units >= 38
f21a80a6 49BuildArch: noarch
95a1ed16 50BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
f21a80a6
PZ
51
52%description
3458d90a
JB
53This package contains data files with rules for various timezones
54around the world.
55
151d1751
JR
56%description -l pl.UTF-8
57Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
58całym świecie.
f21a80a6 59
00ab1294 60%package -n java-tzdata
0eb7e566 61Summary: Timezone data for Java
6496acd7 62Summary(pl.UTF-8): Dane stref czasowych dla Javy
0eb7e566
ER
63Group: Base
64
00ab1294 65%description -n java-tzdata
0eb7e566
ER
66This package contains timezone information for use by Java runtimes.
67
00ab1294 68%description -n java-tzdata -l pl.UTF-8
6496acd7
JB
69Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
70programów w Javie.
71
a796fb22
ER
72%package zoneinfo
73Summary: Timezone data
cdd299a1 74Summary(pl.UTF-8): Dane stref czasowych
a796fb22
ER
75Group: Base
76
77%description zoneinfo
78Timezone data.
79
cdd299a1
JB
80%description zoneinfo -l pl.UTF-8
81Dane stref czasowych.
82
33e5a5b5
ER
83%package zoneinfo_right
84Summary: Non-POSIX (real) time zones
e5477455
ER
85Summary(es.UTF-8): Zonas de tiempo reales (no de POSIX)
86Summary(pl.UTF-8): Nie-POSIX-owe (prawdziwe) strefy czasowe
a796fb22 87Group: Base
37e6efaa 88Obsoletes: glibc-zoneinfo_right
33e5a5b5
ER
89
90%description zoneinfo_right
91You don't want this. Details at:
e3ed8f87 92<http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
33e5a5b5 93
151d1751
JR
94%description zoneinfo_right -l es.UTF-8
95No lo necesita. Encontrará los detalles en:
e3ed8f87 96<http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
33e5a5b5 97
151d1751
JR
98%description zoneinfo_right -l pl.UTF-8
99Nie potrzebujesz tego. Szczegóły pod:
e3ed8f87 100<http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
33e5a5b5 101
9550cc22 102%package devel
caed056f
JB
103Summary: tzfile header file
104Summary(pl.UTF-8): Plik nagłówkowy tzfile
85de48d2 105Group: Development/Libraries
9550cc22 106
107%description devel
85de48d2
AG
108Header file for timezone database.
109
110%description devel -l pl.UTF-8
111Plik nagłówkowy bazy danych stref czasowych.
9550cc22 112
f21a80a6 113%prep
cfa167f6 114%setup -qn tzdb-%{version}
8650fa3d 115%patch0 -p1
7ad9890e 116
316a7be9 117sed -i -e '/tz-art.html/d' tz-link.html
0b5f1229 118
0eb7e566
ER
119%if %{with java}
120install -d javazic
af97ec11 121tar zxf %{SOURCE5} -C javazic --no-same-owner
0eb7e566
ER
122cd javazic
123%patch1
124
125# Hack alert! sun.tools may be defined and installed in the
126# VM. In order to guarantee that we are using IcedTea/OpenJDK
127# for creating the zoneinfo files, rebase all the packages
128# from "sun." to "rht.". Unfortunately, gcj does not support
129# any of the -Xclasspath options, so we must go this route
130# to ensure the greatest compatibility.
131# XXX: do we want 'pld' instead of 'rht'?
6cac3b7d 132%{__mv} sun rht
0eb7e566
ER
133find . -type f -name '*.java' -print0 \
134 | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
135 -e 's:sun\.util\.:rht.util.:g'
136cd -
137%endif
138
f21a80a6 139%build
6cac3b7d
JB
140# build "fat" zoneinfo files for older parsers (like pytz)
141# which can't parse "slim" 64-bit files
316a7be9
ER
142%{__make} \
143 CFLAGS="%{rpmcflags}" \
144 LDFLAGS="%{rpmldflags}" \
6cac3b7d 145 ZFLAGS="-b fat" \
316a7be9 146 cc="%{__cc}"
f21a80a6 147
0eb7e566
ER
148%if %{with java}
149cd javazic
446a8df9 150%javac -source 1.6 -target 1.6 -classpath . $(find -name '*.java')
316a7be9
ER
151cd ..
152
153%java -classpath javazic/ rht.tools.javazic.Main -V %{version} \
154 -d zoneinfo/java \
411bc50f
ER
155 africa antarctica asia australasia europe northamerica \
156 southamerica backward etcetera factory \
316a7be9 157 javazic/tzdata_jdk/gmt javazic/tzdata_jdk/jdk11_backward
0eb7e566
ER
158%endif
159
f21a80a6 160%install
95a1ed16 161rm -rf $RPM_BUILD_ROOT
95a3c0b6 162install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
6cac3b7d 163
316a7be9 164%{__make} install \
6cac3b7d
JB
165 DESTDIR=$RPM_BUILD_ROOT \
166 ZFLAGS="-b fat"
167
168%{__rm} $RPM_BUILD_ROOT%{_bindir}/tzselect
169%{__rm} $RPM_BUILD_ROOT%{_bindir}/zdump
170%{__rm} $RPM_BUILD_ROOT%{_sbindir}/zic
171%{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/newctime.3*
172%{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/newtzset.3*
173%{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/tzselect.8*
174%{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/zdump.8*
175%{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/zic.8*
176%{__rm} $RPM_BUILD_ROOT%{_prefix}/lib/libtz.a
177%{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo-posix
178%{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/leapseconds
179%{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/tzdata.zi
180%{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/zone1970.tab
181%{__mv} $RPM_BUILD_ROOT%{_datadir}/zoneinfo-leaps $RPM_BUILD_ROOT%{_datadir}/zoneinfo/right
a360159e 182
aa82ac7a 183%if %{with tests}
cf62b8f3 184# test needs to be ran after "make install", as it uses installed files
48f17b2c 185: ====================TESTING=========================
5db5c79b 186%{__make} check \
187 CC="%{__cc}" \
188 CFLAGS="%{rpmcflags} %{rpmldflags}"
48f17b2c 189: ====================TESTING END=====================
aa82ac7a 190%endif
48f17b2c 191
0f163d2c
ER
192# behave more like glibc.spec
193ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
194ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
195ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
196
136ee967
JB
197# zic>=2020b installs localtime as hardlink to GMT, so remove first not break GMT zone files
198%{__rm} $RPM_BUILD_ROOT/etc/localtime
50d7b850
AM
199> $RPM_BUILD_ROOT/etc/localtime
200
85de48d2 201# header file
316a7be9
ER
202cp -p tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
203cp -p tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
9550cc22 204
463fb3cd 205install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
1f4e4169 206cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
5763ae29 207ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
95a3c0b6 208
0eb7e566
ER
209%if %{with java}
210cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
211%endif
212
f21a80a6 213%clean
95a1ed16 214rm -rf $RPM_BUILD_ROOT
f21a80a6 215
48f17b2c
ER
216%post
217/sbin/chkconfig --add timezone
218%service timezone restart
219
220%preun
221if [ "$1" = "0" ]; then
222 /sbin/chkconfig --del timezone
e32f56d0
ER
223
224 # save for postun
8f291ac0
ER
225 localtime=$(readlink -f /etc/localtime)
226 # cp has no dereference target option, so remove link first
227 test -L /etc/localtime.rpmsave && rm -f /etc/localtime.rpmsave
228 cp -pf $localtime /etc/localtime.rpmsave
e32f56d0
ER
229fi
230
231%postun
232if [ "$1" = "0" ]; then
233 if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
1903f4d5 234 echo >&2 "Preserving /etc/localtime"
e32f56d0
ER
235 mv -f /etc/localtime{.rpmsave,}
236 fi
48f17b2c
ER
237fi
238
64a9089d
ER
239%triggerpostun -- rc-scripts < 0.4.1.4
240/sbin/chkconfig --add timezone
241
72e063bb
MB
242%triggerpostun -- tzdata < 2008b-4
243if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
244 . /etc/sysconfig/timezone
245
246 if [ -z $ZONE_INFO_AREA ]; then
247 TIMEZONE=$TIME_ZONE
248 else
249 TIMEZONE=$ZONE_INFO_AREA/$TIME_ZONE
250 fi
251
252 echo "TIMEZONE=\"$TIMEZONE\"" >> /etc/sysconfig/timezone
253
254 %service timezone restart
255fi
256
5763ae29
JR
257%triggerpostun -- tzdata < 2015f-2
258%systemd_service_disable timezone.service
259%systemd_service_stop timezone.service
95a3c0b6 260
f21a80a6
PZ
261%files
262%defattr(644,root,root,755)
316a7be9 263%doc README tz-link.html
50d7b850 264%ghost /etc/localtime
48f17b2c
ER
265%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
266%attr(754,root,root) /etc/rc.d/init.d/timezone
95a3c0b6 267%{systemdunitdir}/timezone.service
2141fdbf
JK
268%{_datadir}/zoneinfo/localtime
269%{_datadir}/zoneinfo/posixrules
270%{_datadir}/zoneinfo/posixtime
4747911d 271
0eb7e566 272%if %{with java}
00ab1294 273%files -n java-tzdata
0eb7e566
ER
274%defattr(644,root,root,755)
275%{_datadir}/javazi
276%endif
277
a796fb22
ER
278%files zoneinfo
279%defattr(644,root,root,755)
280%{_datadir}/zoneinfo
281%exclude %{_datadir}/zoneinfo/right
2141fdbf
JK
282%exclude %{_datadir}/zoneinfo/localtime
283%exclude %{_datadir}/zoneinfo/posixrules
284%exclude %{_datadir}/zoneinfo/posixtime
a796fb22 285
33e5a5b5
ER
286%files zoneinfo_right
287%defattr(644,root,root,755)
288%{_datadir}/zoneinfo/right
9550cc22 289
290%files devel
85de48d2 291%defattr(644,root,root,755)
316a7be9 292%doc tzfile.5.txt
9550cc22 293%{_includedir}/tzfile.h
85de48d2 294%{_mandir}/man5/tzfile.5*
This page took 0.926071 seconds and 4 git commands to generate.