]> git.pld-linux.org Git - packages/tzdata.git/blob - tzdata.spec
do not own tzdata dir by two packages; refs 2141fdb
[packages/tzdata.git] / tzdata.spec
1 #
2 # Conditional build
3 %bcond_without  tests           # make check
4 %bcond_without  java            # build java subpackage
5
6 %if "%{pld_release}" == "ac"
7 %ifnarch i586 i686 pentium3 pentium4 athlon %{x8664}
8 %undefine       with_java
9 %endif
10 %endif
11
12 %define         tzcode_ver      2017c
13 %define         tzdata_ver      2017c
14 Summary:        Timezone data
15 Summary(pl.UTF-8):      Dane o strefach czasowych
16 Name:           tzdata
17 Version:        %{tzdata_ver}
18 Release:        2
19 License:        Public Domain (database), BSD/LGPL v2.1+ (code/test suite)
20 Group:          Base
21 # The tzdata-base-0.tar.bz2 is a simple building infrastructure and
22 # a test suite. It is occasionally updated from glibc sources, and as
23 # such is under LGPL v2+, but none of this ever gets to be part of
24 # final zoneinfo files.
25 Source0:        %{name}-base-0.tar.bz2
26 # Source0-md5:  e36d2f742c22f8c8dbf0686ac9769b55
27 # ftp://elsie.nci.nih.gov/pub/ has been shut down because of lawsuit
28 #Source1Download: http://www.iana.org/time-zones/
29 Source1:        ftp://ftp.iana.org/tz/releases/%{name}%{tzdata_ver}.tar.gz
30 # Source1-md5:  1e751e7e08f8b68530674f04619d894d
31 #Source2Download: http://www.iana.org/time-zones/
32 Source2:        ftp://ftp.iana.org/tz/releases/tzcode%{tzcode_ver}.tar.gz
33 # Source2-md5:  2fe6986231db5182c61d565021a0cd7b
34 Source3:        timezone.init
35 Source4:        timezone.sysconfig
36 Source5:        javazic.tar.gz
37 # Source5-md5:  6a3392cd5f1594d13c12c1a836ac8d91
38 Patch0:         %{name}-test-update.patch
39 Patch1:         javazic-fixup.patch
40 Patch2:         install.patch
41 URL:            http://www.twinsun.com/tz/tz-link.htm
42 BuildRequires:  rpm >= 4.4.9-56
43 BuildRequires:  rpmbuild(macros) >= 1.623
44 %if %{with java}
45 BuildRequires:  jdk
46 BuildRequires:  jpackage-utils
47 BuildRequires:  rpm-javaprov
48 %endif
49 Requires(post,preun,postun):    systemd-units >= 38
50 Requires:       %{name}-zoneinfo = %{version}-%{release}
51 Requires:       /sbin/chkconfig
52 Requires:       rc-scripts >= 0.4.3.0
53 Requires:       systemd-units >= 38
54 BuildArch:      noarch
55 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56
57 %description
58 This package contains data files with rules for various timezones
59 around the world.
60
61 %description -l pl.UTF-8
62 Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
63 całym świecie.
64
65 %package -n java-tzdata
66 Summary:        Timezone data for Java
67 Summary(pl.UTF-8):      Dane stref czasowych dla Javy
68 Group:          Base
69
70 %description -n java-tzdata
71 This package contains timezone information for use by Java runtimes.
72
73 %description -n java-tzdata -l pl.UTF-8
74 Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
75 programów w Javie.
76
77 %package zoneinfo
78 Summary:        Timezone data
79 Summary(pl.UTF-8):      Dane stref czasowych
80 Group:          Base
81
82 %description zoneinfo
83 Timezone data.
84
85 %description zoneinfo -l pl.UTF-8
86 Dane stref czasowych.
87
88 %package zoneinfo_right
89 Summary:        Non-POSIX (real) time zones
90 Summary(es.UTF-8):      Zonas de tiempo reales (no de POSIX)
91 Summary(pl.UTF-8):      Nie-POSIX-owe (prawdziwe) strefy czasowe
92 Group:          Base
93 Obsoletes:      glibc-zoneinfo_right
94
95 %description zoneinfo_right
96 You don't want this. Details at:
97 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
98
99 %description zoneinfo_right -l es.UTF-8
100 No lo necesita. Encontrará los detalles en:
101 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
102
103 %description zoneinfo_right -l pl.UTF-8
104 Nie potrzebujesz tego. Szczegóły pod:
105 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
106
107 %package devel
108 Summary:        tzfile header file
109 Summary(pl.UTF-8):      Plik nagłówkowy tzfile
110 Group:          Development/Libraries
111
112 %description devel
113 Header file for timezone database.
114
115 %description devel -l pl.UTF-8
116 Plik nagłówkowy bazy danych stref czasowych.
117
118 %prep
119 %setup -qc
120 mv tzdata/* .
121 %patch0 -p1
122
123 %{__tar} xzf %{SOURCE1} -C tzdata
124 # don't override Makefile from base tar
125 %{__mv} tzdata/Makefile{,.tzdata}
126
127 install -d tzcode
128 %{__tar} xzf %{SOURCE2} -C tzcode
129 %patch2 -p1
130
131 %{__sed} -e "
132 s|@objpfx@|`pwd`/obj/|
133 s|@datadir@|%{_datadir}|
134 s|@install_root@|$RPM_BUILD_ROOT|
135 " 'Makeconfig.in' > Makeconfig
136
137 grep -v tz-art.htm tzcode/tz-link.htm > tzcode/tz-link.html
138
139 %if %{with java}
140 install -d javazic
141 tar zxf %{SOURCE5} -C javazic
142 cd javazic
143 %patch1
144
145 # Hack alert! sun.tools may be defined and installed in the
146 # VM. In order to guarantee that we are using IcedTea/OpenJDK
147 # for creating the zoneinfo files, rebase all the packages
148 # from "sun." to "rht.". Unfortunately, gcj does not support
149 # any of the -Xclasspath options, so we must go this route
150 # to ensure the greatest compatibility.
151 # XXX: do we want 'pld' instead of 'rht'?
152 mv sun rht
153 find . -type f -name '*.java' -print0 \
154         | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
155                                                  -e 's:sun\.util\.:rht.util.:g'
156 cd -
157 %endif
158
159 %build
160 %{__make}
161
162 %if %{with java}
163 cd javazic
164 %javac -source 1.5 -target 1.5 -classpath . $(find -name '*.java')
165 cd ../tzdata
166 %java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \
167         -d ../zoneinfo/java \
168         africa antarctica asia australasia europe northamerica pacificnew \
169         southamerica backward etcetera factory systemv \
170         ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward
171 cd ..
172 %endif
173
174 %install
175 rm -rf $RPM_BUILD_ROOT
176 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
177 %{__make} install
178
179 %if %{with tests}
180 # test needs to be ran after "make install", as it uses installed files
181 : ====================TESTING=========================
182 %{__make} check \
183         CC="%{__cc}" \
184         CFLAGS="%{rpmcflags} %{rpmldflags}"
185 : ====================TESTING END=====================
186 %endif
187
188 # glibc.spec didn't keep it. so won't here either.
189 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
190 # behave more like glibc.spec
191 ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
192 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
193 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
194
195 > $RPM_BUILD_ROOT/etc/localtime
196
197 # header file
198 cp -p tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
199 cp -p tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
200
201 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
202 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
203
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 tzcode/README tzcode/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 tzcode/tzfile.5.txt
290 %{_includedir}/tzfile.h
291 %{_mandir}/man5/tzfile.5*
This page took 0.075358 seconds and 3 git commands to generate.