]> git.pld-linux.org Git - packages/tzdata.git/blob - tzdata.spec
up to 2022c
[packages/tzdata.git] / tzdata.spec
1 #
2 # Conditional build
3 %bcond_without  tests           # make check
4 %bcond_without  java            # build java subpackage
5
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
12 %if "%{pld_release}" == "ac"
13 %ifnarch i586 i686 pentium3 pentium4 athlon %{x8664}
14 %undefine       with_java
15 %endif
16 %endif
17
18 Summary:        Timezone data
19 Summary(pl.UTF-8):      Dane o strefach czasowych
20 Name:           tzdata
21 Version:        2022c
22 Release:        1
23 License:        Public Domain (database), BSD/LGPL v2.1+ (code/test suite)
24 Group:          Base
25 #Source0Download: https://www.iana.org/time-zones
26 Source0:        https://www.iana.org/time-zones/repository/releases/tzdb-%{version}.tar.lz
27 # Source0-md5:  6548a7c482c97860d6b0b6a872b46490
28 Source3:        timezone.init
29 Source4:        timezone.sysconfig
30 Source5:        javazic.tar.gz
31 # Source5-md5:  6a3392cd5f1594d13c12c1a836ac8d91
32 Patch0:         disable-network-tests.patch
33 Patch1:         javazic-fixup.patch
34 Patch2:         install.patch
35 URL:            http://www.twinsun.com/tz/tz-link.htm
36 BuildRequires:  lzip
37 BuildRequires:  rpm >= 4.4.9-56
38 BuildRequires:  rpmbuild(macros) >= 1.623
39 %if %{with java}
40 BuildRequires:  jdk
41 BuildRequires:  jpackage-utils
42 BuildRequires:  rpm-javaprov
43 %endif
44 Requires(post,preun,postun):    systemd-units >= 38
45 Requires:       %{name}-zoneinfo = %{version}-%{release}
46 Requires:       /sbin/chkconfig
47 Requires:       rc-scripts >= 0.4.3.0
48 Requires:       systemd-units >= 38
49 BuildArch:      noarch
50 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51
52 %description
53 This package contains data files with rules for various timezones
54 around the world.
55
56 %description -l pl.UTF-8
57 Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
58 całym świecie.
59
60 %package -n java-tzdata
61 Summary:        Timezone data for Java
62 Summary(pl.UTF-8):      Dane stref czasowych dla Javy
63 Group:          Base
64
65 %description -n java-tzdata
66 This package contains timezone information for use by Java runtimes.
67
68 %description -n java-tzdata -l pl.UTF-8
69 Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
70 programów w Javie.
71
72 %package zoneinfo
73 Summary:        Timezone data
74 Summary(pl.UTF-8):      Dane stref czasowych
75 Group:          Base
76
77 %description zoneinfo
78 Timezone data.
79
80 %description zoneinfo -l pl.UTF-8
81 Dane stref czasowych.
82
83 %package zoneinfo_right
84 Summary:        Non-POSIX (real) time zones
85 Summary(es.UTF-8):      Zonas de tiempo reales (no de POSIX)
86 Summary(pl.UTF-8):      Nie-POSIX-owe (prawdziwe) strefy czasowe
87 Group:          Base
88 Obsoletes:      glibc-zoneinfo_right
89
90 %description zoneinfo_right
91 You don't want this. Details at:
92 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
93
94 %description zoneinfo_right -l es.UTF-8
95 No lo necesita. Encontrará los detalles en:
96 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
97
98 %description zoneinfo_right -l pl.UTF-8
99 Nie potrzebujesz tego. Szczegóły pod:
100 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
101
102 %package devel
103 Summary:        tzfile header file
104 Summary(pl.UTF-8):      Plik nagłówkowy tzfile
105 Group:          Development/Libraries
106
107 %description devel
108 Header file for timezone database.
109
110 %description devel -l pl.UTF-8
111 Plik nagłówkowy bazy danych stref czasowych.
112
113 %prep
114 %setup -qn tzdb-%{version}
115 %patch0 -p1
116
117 sed -i -e '/tz-art.html/d' tz-link.html
118
119 %if %{with java}
120 install -d javazic
121 tar zxf %{SOURCE5} -C javazic --no-same-owner
122 cd 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'?
132 %{__mv} sun rht
133 find . -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'
136 cd -
137 %endif
138
139 %build
140 # build "fat" zoneinfo files for older parsers (like pytz)
141 # which can't parse "slim" 64-bit files
142 %{__make} \
143         CFLAGS="%{rpmcflags}" \
144         LDFLAGS="%{rpmldflags}" \
145         ZFLAGS="-b fat" \
146         cc="%{__cc}"
147
148 %if %{with java}
149 cd javazic
150 %javac -source 1.6 -target 1.6 -classpath . $(find -name '*.java')
151 cd ..
152
153 %java -classpath javazic/ rht.tools.javazic.Main -V %{version} \
154         -d zoneinfo/java \
155         africa antarctica asia australasia europe northamerica \
156         southamerica backward etcetera factory \
157         javazic/tzdata_jdk/gmt javazic/tzdata_jdk/jdk11_backward
158 %endif
159
160 %install
161 rm -rf $RPM_BUILD_ROOT
162 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
163
164 %{__make} install \
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
182
183 %if %{with tests}
184 # test needs to be ran after "make install", as it uses installed files
185 : ====================TESTING=========================
186 %{__make} check \
187         CC="%{__cc}" \
188         CFLAGS="%{rpmcflags} %{rpmldflags}"
189 : ====================TESTING END=====================
190 %endif
191
192 # behave more like glibc.spec
193 ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
194 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
195 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
196
197 # zic>=2020b installs localtime as hardlink to GMT, so remove first not break GMT zone files
198 %{__rm} $RPM_BUILD_ROOT/etc/localtime
199 > $RPM_BUILD_ROOT/etc/localtime
200
201 # header file
202 cp -p tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
203 cp -p tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
204
205 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
206 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
207 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
208
209 %if %{with java}
210 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
211 %endif
212
213 %clean
214 rm -rf $RPM_BUILD_ROOT
215
216 %post
217 /sbin/chkconfig --add timezone
218 %service timezone restart
219
220 %preun
221 if [ "$1" = "0" ]; then
222         /sbin/chkconfig --del timezone
223
224         # save for postun
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
229 fi
230
231 %postun
232 if [ "$1" = "0" ]; then
233         if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
234                 echo >&2 "Preserving /etc/localtime"
235                 mv -f /etc/localtime{.rpmsave,}
236         fi
237 fi
238
239 %triggerpostun -- rc-scripts < 0.4.1.4
240 /sbin/chkconfig --add timezone
241
242 %triggerpostun -- tzdata < 2008b-4
243 if ! 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
255 fi
256
257 %triggerpostun -- tzdata < 2015f-2
258 %systemd_service_disable timezone.service
259 %systemd_service_stop timezone.service
260
261 %files
262 %defattr(644,root,root,755)
263 %doc README tz-link.html
264 %ghost /etc/localtime
265 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
266 %attr(754,root,root) /etc/rc.d/init.d/timezone
267 %{systemdunitdir}/timezone.service
268 %{_datadir}/zoneinfo/localtime
269 %{_datadir}/zoneinfo/posixrules
270 %{_datadir}/zoneinfo/posixtime
271
272 %if %{with java}
273 %files -n java-tzdata
274 %defattr(644,root,root,755)
275 %{_datadir}/javazi
276 %endif
277
278 %files zoneinfo
279 %defattr(644,root,root,755)
280 %{_datadir}/zoneinfo
281 %exclude %{_datadir}/zoneinfo/right
282 %exclude %{_datadir}/zoneinfo/localtime
283 %exclude %{_datadir}/zoneinfo/posixrules
284 %exclude %{_datadir}/zoneinfo/posixtime
285
286 %files zoneinfo_right
287 %defattr(644,root,root,755)
288 %{_datadir}/zoneinfo/right
289
290 %files devel
291 %defattr(644,root,root,755)
292 %doc tzfile.5.txt
293 %{_includedir}/tzfile.h
294 %{_mandir}/man5/tzfile.5*
This page took 0.054266 seconds and 3 git commands to generate.