]> git.pld-linux.org Git - packages/tzdata.git/blob - tzdata.spec
- build "fat" zoneinfo files (required by at least pytz)
[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:        2020f
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:  d185bbba5f17dd80f5aa34601ac1def1
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:  rpm >= 4.4.9-56
37 BuildRequires:  rpmbuild(macros) >= 1.623
38 %if %{with java}
39 BuildRequires:  jdk
40 BuildRequires:  jpackage-utils
41 BuildRequires:  rpm-javaprov
42 %endif
43 Requires(post,preun,postun):    systemd-units >= 38
44 Requires:       %{name}-zoneinfo = %{version}-%{release}
45 Requires:       /sbin/chkconfig
46 Requires:       rc-scripts >= 0.4.3.0
47 Requires:       systemd-units >= 38
48 BuildArch:      noarch
49 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50
51 %description
52 This package contains data files with rules for various timezones
53 around the world.
54
55 %description -l pl.UTF-8
56 Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
57 całym świecie.
58
59 %package -n java-tzdata
60 Summary:        Timezone data for Java
61 Summary(pl.UTF-8):      Dane stref czasowych dla Javy
62 Group:          Base
63
64 %description -n java-tzdata
65 This package contains timezone information for use by Java runtimes.
66
67 %description -n java-tzdata -l pl.UTF-8
68 Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
69 programów w Javie.
70
71 %package zoneinfo
72 Summary:        Timezone data
73 Summary(pl.UTF-8):      Dane stref czasowych
74 Group:          Base
75
76 %description zoneinfo
77 Timezone data.
78
79 %description zoneinfo -l pl.UTF-8
80 Dane stref czasowych.
81
82 %package zoneinfo_right
83 Summary:        Non-POSIX (real) time zones
84 Summary(es.UTF-8):      Zonas de tiempo reales (no de POSIX)
85 Summary(pl.UTF-8):      Nie-POSIX-owe (prawdziwe) strefy czasowe
86 Group:          Base
87 Obsoletes:      glibc-zoneinfo_right
88
89 %description zoneinfo_right
90 You don't want this. Details at:
91 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
92
93 %description zoneinfo_right -l es.UTF-8
94 No lo necesita. Encontrará los detalles en:
95 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
96
97 %description zoneinfo_right -l pl.UTF-8
98 Nie potrzebujesz tego. Szczegóły pod:
99 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
100
101 %package devel
102 Summary:        tzfile header file
103 Summary(pl.UTF-8):      Plik nagłówkowy tzfile
104 Group:          Development/Libraries
105
106 %description devel
107 Header file for timezone database.
108
109 %description devel -l pl.UTF-8
110 Plik nagłówkowy bazy danych stref czasowych.
111
112 %prep
113 %setup -qn tzdb-%{version}
114 %patch0 -p1
115
116 sed -i -e '/tz-art.html/d' tz-link.html
117
118 %if %{with java}
119 install -d javazic
120 tar zxf %{SOURCE5} -C javazic
121 cd javazic
122 %patch1
123
124 # Hack alert! sun.tools may be defined and installed in the
125 # VM. In order to guarantee that we are using IcedTea/OpenJDK
126 # for creating the zoneinfo files, rebase all the packages
127 # from "sun." to "rht.". Unfortunately, gcj does not support
128 # any of the -Xclasspath options, so we must go this route
129 # to ensure the greatest compatibility.
130 # XXX: do we want 'pld' instead of 'rht'?
131 %{__mv} sun rht
132 find . -type f -name '*.java' -print0 \
133         | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
134                                                  -e 's:sun\.util\.:rht.util.:g'
135 cd -
136 %endif
137
138 %build
139 # build "fat" zoneinfo files for older parsers (like pytz)
140 # which can't parse "slim" 64-bit files
141 %{__make} \
142         CFLAGS="%{rpmcflags}" \
143         LDFLAGS="%{rpmldflags}" \
144         ZFLAGS="-b fat" \
145         cc="%{__cc}"
146
147 %if %{with java}
148 cd javazic
149 %javac -source 1.5 -target 1.5 -classpath . $(find -name '*.java')
150 cd ..
151
152 %java -classpath javazic/ rht.tools.javazic.Main -V %{version} \
153         -d zoneinfo/java \
154         africa antarctica asia australasia europe northamerica \
155         southamerica backward etcetera factory \
156         javazic/tzdata_jdk/gmt javazic/tzdata_jdk/jdk11_backward
157 %endif
158
159 %install
160 rm -rf $RPM_BUILD_ROOT
161 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
162
163 %{__make} install \
164         DESTDIR=$RPM_BUILD_ROOT \
165         ZFLAGS="-b fat"
166
167 %{__rm} $RPM_BUILD_ROOT%{_bindir}/tzselect
168 %{__rm} $RPM_BUILD_ROOT%{_bindir}/zdump
169 %{__rm} $RPM_BUILD_ROOT%{_sbindir}/zic
170 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/newctime.3*
171 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/newtzset.3*
172 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/tzselect.8*
173 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/zdump.8*
174 %{__rm} $RPM_BUILD_ROOT%{_mandir}/man8/zic.8*
175 %{__rm} $RPM_BUILD_ROOT%{_prefix}/lib/libtz.a
176 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo-posix
177 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/leapseconds
178 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/tzdata.zi
179 %{__rm} $RPM_BUILD_ROOT%{_datadir}/zoneinfo/zone1970.tab
180 %{__mv} $RPM_BUILD_ROOT%{_datadir}/zoneinfo-leaps $RPM_BUILD_ROOT%{_datadir}/zoneinfo/right
181
182 %if %{with tests}
183 # test needs to be ran after "make install", as it uses installed files
184 : ====================TESTING=========================
185 %{__make} check \
186         CC="%{__cc}" \
187         CFLAGS="%{rpmcflags} %{rpmldflags}"
188 : ====================TESTING END=====================
189 %endif
190
191 # behave more like glibc.spec
192 ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
193 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
194 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
195
196 > $RPM_BUILD_ROOT/etc/localtime
197
198 # header file
199 cp -p tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
200 cp -p tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
201
202 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
203 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
204 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
205
206 %if %{with java}
207 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
208 %endif
209
210 %clean
211 rm -rf $RPM_BUILD_ROOT
212
213 %post
214 /sbin/chkconfig --add timezone
215 %service timezone restart
216
217 %preun
218 if [ "$1" = "0" ]; then
219         /sbin/chkconfig --del timezone
220
221         # save for postun
222         localtime=$(readlink -f /etc/localtime)
223         # cp has no dereference target option, so remove link first
224         test -L /etc/localtime.rpmsave && rm -f /etc/localtime.rpmsave
225         cp -pf $localtime /etc/localtime.rpmsave
226 fi
227
228 %postun
229 if [ "$1" = "0" ]; then
230         if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
231                 echo >&2 "Preserving /etc/localtime"
232                 mv -f /etc/localtime{.rpmsave,}
233         fi
234 fi
235
236 %triggerpostun -- rc-scripts < 0.4.1.4
237 /sbin/chkconfig --add timezone
238
239 %triggerpostun -- tzdata < 2008b-4
240 if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
241         . /etc/sysconfig/timezone
242
243         if [ -z $ZONE_INFO_AREA ]; then
244                 TIMEZONE=$TIME_ZONE
245         else
246                 TIMEZONE=$ZONE_INFO_AREA/$TIME_ZONE
247         fi
248
249         echo "TIMEZONE=\"$TIMEZONE\"" >> /etc/sysconfig/timezone
250
251         %service timezone restart
252 fi
253
254 %triggerpostun -- tzdata < 2015f-2
255 %systemd_service_disable timezone.service
256 %systemd_service_stop timezone.service
257
258 %files
259 %defattr(644,root,root,755)
260 %doc README tz-link.html
261 %ghost /etc/localtime
262 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
263 %attr(754,root,root) /etc/rc.d/init.d/timezone
264 %{systemdunitdir}/timezone.service
265 %{_datadir}/zoneinfo/localtime
266 %{_datadir}/zoneinfo/posixrules
267 %{_datadir}/zoneinfo/posixtime
268
269 %if %{with java}
270 %files -n java-tzdata
271 %defattr(644,root,root,755)
272 %{_datadir}/javazi
273 %endif
274
275 %files zoneinfo
276 %defattr(644,root,root,755)
277 %{_datadir}/zoneinfo
278 %exclude %{_datadir}/zoneinfo/right
279 %exclude %{_datadir}/zoneinfo/localtime
280 %exclude %{_datadir}/zoneinfo/posixrules
281 %exclude %{_datadir}/zoneinfo/posixtime
282
283 %files zoneinfo_right
284 %defattr(644,root,root,755)
285 %{_datadir}/zoneinfo/right
286
287 %files devel
288 %defattr(644,root,root,755)
289 %doc tzfile.5.txt
290 %{_includedir}/tzfile.h
291 %{_mandir}/man5/tzfile.5*
This page took 0.074575 seconds and 4 git commands to generate.