]> git.pld-linux.org Git - SPECS.git/blob - tzdata.spec
SPECS updated Sun 1 Aug 11:02:02 CEST 2021
[SPECS.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:        2021a
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:  1a5ab08f40850d9d67aca333016c3b4f
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 # zic>=2020b installs localtime as hardlink to GMT, so remove first not break GMT zone files
197 %{__rm} $RPM_BUILD_ROOT/etc/localtime
198 > $RPM_BUILD_ROOT/etc/localtime
199
200 # header file
201 cp -p tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
202 cp -p tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
203
204 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
205 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
206 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
207
208 %if %{with java}
209 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
210 %endif
211
212 %clean
213 rm -rf $RPM_BUILD_ROOT
214
215 %post
216 /sbin/chkconfig --add timezone
217 %service timezone restart
218
219 %preun
220 if [ "$1" = "0" ]; then
221         /sbin/chkconfig --del timezone
222
223         # save for postun
224         localtime=$(readlink -f /etc/localtime)
225         # cp has no dereference target option, so remove link first
226         test -L /etc/localtime.rpmsave && rm -f /etc/localtime.rpmsave
227         cp -pf $localtime /etc/localtime.rpmsave
228 fi
229
230 %postun
231 if [ "$1" = "0" ]; then
232         if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
233                 echo >&2 "Preserving /etc/localtime"
234                 mv -f /etc/localtime{.rpmsave,}
235         fi
236 fi
237
238 %triggerpostun -- rc-scripts < 0.4.1.4
239 /sbin/chkconfig --add timezone
240
241 %triggerpostun -- tzdata < 2008b-4
242 if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
243         . /etc/sysconfig/timezone
244
245         if [ -z $ZONE_INFO_AREA ]; then
246                 TIMEZONE=$TIME_ZONE
247         else
248                 TIMEZONE=$ZONE_INFO_AREA/$TIME_ZONE
249         fi
250
251         echo "TIMEZONE=\"$TIMEZONE\"" >> /etc/sysconfig/timezone
252
253         %service timezone restart
254 fi
255
256 %triggerpostun -- tzdata < 2015f-2
257 %systemd_service_disable timezone.service
258 %systemd_service_stop timezone.service
259
260 %files
261 %defattr(644,root,root,755)
262 %doc README tz-link.html
263 %ghost /etc/localtime
264 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
265 %attr(754,root,root) /etc/rc.d/init.d/timezone
266 %{systemdunitdir}/timezone.service
267 %{_datadir}/zoneinfo/localtime
268 %{_datadir}/zoneinfo/posixrules
269 %{_datadir}/zoneinfo/posixtime
270
271 %if %{with java}
272 %files -n java-tzdata
273 %defattr(644,root,root,755)
274 %{_datadir}/javazi
275 %endif
276
277 %files zoneinfo
278 %defattr(644,root,root,755)
279 %{_datadir}/zoneinfo
280 %exclude %{_datadir}/zoneinfo/right
281 %exclude %{_datadir}/zoneinfo/localtime
282 %exclude %{_datadir}/zoneinfo/posixrules
283 %exclude %{_datadir}/zoneinfo/posixtime
284
285 %files zoneinfo_right
286 %defattr(644,root,root,755)
287 %{_datadir}/zoneinfo/right
288
289 %files devel
290 %defattr(644,root,root,755)
291 %doc tzfile.5.txt
292 %{_includedir}/tzfile.h
293 %{_mandir}/man5/tzfile.5*
This page took 0.180422 seconds and 3 git commands to generate.