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