]> git.pld-linux.org Git - packages/tzdata.git/blob - tzdata.spec
- tzcode 2012b, tzdata 2012c
[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      2012b
13 %define         tzdata_ver      2012c
14 Summary:        Timezone data
15 Summary(pl.UTF-8):      Dane o strefach czasowych
16 Name:           tzdata
17 Version:        %{tzdata_ver}
18 Release:        1
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:        http://www.iana.org/time-zones/repository/releases/%{name}%{tzdata_ver}.tar.gz
30 # Source1-md5:  cfdc2710bd05c26dbd624441d57028f6
31 #Source2Download: http://www.iana.org/time-zones/
32 Source2:        http://www.iana.org/time-zones/repository/releases/tzcode%{tzcode_ver}.tar.gz
33 # Source2-md5:  6137322ffd36e1fd5128885be1c57008
34 Source3:        timezone.init
35 Source4:        timezone.sysconfig
36 Source5:        javazic.tar.gz
37 # Source5-md5:  6a3392cd5f1594d13c12c1a836ac8d91
38 Source6:        timezone.upstart
39 Source7:        timezone.service
40 Source8:        timezone.sh
41 Patch1:         javazic-fixup.patch
42 Patch2:         install.patch
43 URL:            http://www.twinsun.com/tz/tz-link.htm
44 BuildRequires:  rpm >= 4.4.9-56
45 BuildRequires:  rpmbuild(macros) >= 1.623
46 %if %{with java}
47 BuildRequires:  jdk
48 BuildRequires:  jpackage-utils
49 BuildRequires:  rpm-javaprov
50 %endif
51 Requires(post,preun,postun):    systemd-units >= 38
52 Requires:       /sbin/chkconfig
53 Requires:       rc-scripts >= 0.4.3.0
54 Requires:       systemd-units >= 38
55 BuildArch:      noarch
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %description
59 This package contains data files with rules for various timezones
60 around the world.
61
62 %description -l pl.UTF-8
63 Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
64 całym świecie.
65
66 %package -n java-tzdata
67 Summary:        Timezone data for Java
68 Summary(pl.UTF-8):      Dane stref czasowych dla Javy
69 Group:          Base
70
71 %description -n java-tzdata
72 This package contains timezone information for use by Java runtimes.
73
74 %description -n java-tzdata -l pl.UTF-8
75 Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
76 programów w Javie.
77
78 %package zoneinfo_right
79 Summary:        Non-POSIX (real) time zones
80 Summary(es.UTF-8):      Zonas de tiempo reales (no de POSIX)
81 Summary(pl.UTF-8):      Nie-POSIX-owe (prawdziwe) strefy czasowe
82 Group:          Libraries
83 Obsoletes:      glibc-zoneinfo_right
84
85 %description zoneinfo_right
86 You don't want this. Details at:
87 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
88
89 %description zoneinfo_right -l es.UTF-8
90 No lo necesita. Encontrará los detalles en:
91 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
92
93 %description zoneinfo_right -l pl.UTF-8
94 Nie potrzebujesz tego. Szczegóły pod:
95 <http://sources.redhat.com/ml/libc-alpha/2000-12/msg00068.html>.
96
97 %package devel
98 Summary:        tzfile header file
99 Summary(pl.UTF-8):      Plik nagłówkowy tzfile
100 Group:          Development/Libraries
101
102 %description devel
103 Header file for timezone database.
104
105 %description devel -l pl.UTF-8
106 Plik nagłówkowy bazy danych stref czasowych.
107
108 %prep
109 %setup -qc
110 mv tzdata/* .
111 %{__tar} xzf %{SOURCE1} -C tzdata
112 install -d tzcode
113 %{__tar} xzf %{SOURCE2} -C tzcode
114 %patch2 -p1
115
116 %{__sed} -e "
117 s|@objpfx@|`pwd`/obj/|
118 s|@datadir@|%{_datadir}|
119 s|@install_root@|$RPM_BUILD_ROOT|
120 " 'Makeconfig.in' > Makeconfig
121
122 grep -v tz-art.htm tzcode/tz-link.htm > tzcode/tz-link.html
123
124 %if %{with java}
125 install -d javazic
126 tar zxf %{SOURCE5} -C javazic
127 cd javazic
128 %patch1
129
130 # Hack alert! sun.tools may be defined and installed in the
131 # VM. In order to guarantee that we are using IcedTea/OpenJDK
132 # for creating the zoneinfo files, rebase all the packages
133 # from "sun." to "rht.". Unfortunately, gcj does not support
134 # any of the -Xclasspath options, so we must go this route
135 # to ensure the greatest compatibility.
136 # XXX: do we want 'pld' instead of 'rht'?
137 mv sun rht
138 find . -type f -name '*.java' -print0 \
139         | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
140                                                  -e 's:sun\.util\.:rht.util.:g'
141 cd -
142 %endif
143
144 %build
145 %{__make}
146
147 %if %{with java}
148 cd javazic
149 %javac -source 1.5 -target 1.5 -classpath . $(find -name '*.java')
150 cd ../tzdata
151 %java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \
152         -d ../zoneinfo/java \
153         africa antarctica asia australasia europe northamerica pacificnew \
154         southamerica backward etcetera solar87 solar88 solar89 systemv \
155         ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward
156 cd ..
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 %{__make} install
163
164 %if %{with tests}
165 # test needs to be ran after "make install", as it uses installed files
166 : ====================TESTING=========================
167 %{__make} check \
168         CC="%{__cc}" \
169         CFLAGS="%{rpmcflags} %{rpmldflags}"
170 : ====================TESTING END=====================
171 %endif
172
173 # glibc.spec didn't keep it. so won't here either.
174 rm -rf $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
175 # behave more like glibc.spec
176 ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
177 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
178 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
179
180 > $RPM_BUILD_ROOT/etc/localtime
181
182 # header file
183 cp -p tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
184 cp -p tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
185
186 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
187 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
188
189 install -d $RPM_BUILD_ROOT/etc/init
190 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/init/timezone.conf
191
192 install -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
193 install -p %{SOURCE8} $RPM_BUILD_ROOT/lib/systemd/pld-timezone
194
195 %if %{with java}
196 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
197 %endif
198
199 %clean
200 rm -rf $RPM_BUILD_ROOT
201
202 %post
203 /sbin/chkconfig --add timezone
204 %service timezone restart
205 %systemd_post timezone.service
206
207 %preun
208 if [ "$1" = "0" ]; then
209         /sbin/chkconfig --del timezone
210
211         # save for postun
212         cp -af /etc/localtime /etc/localtime.rpmsave
213 fi
214 %systemd_preun timezone.service
215
216 %postun
217 if [ "$1" = "0" ]; then
218         if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
219                 echo >&2 "Preserving /etc/localtime"
220                 mv -f /etc/localtime{.rpmsave,}
221         fi
222 fi
223 %systemd_reload
224
225 %triggerpostun -- rc-scripts < 0.4.1.4
226 /sbin/chkconfig --add timezone
227
228 %triggerpostun -- tzdata < 2008b-4
229 if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
230         . /etc/sysconfig/timezone
231
232         if [ -z $ZONE_INFO_AREA ]; then
233                 TIMEZONE=$TIME_ZONE
234         else
235                 TIMEZONE=$ZONE_INFO_AREA/$TIME_ZONE
236         fi
237
238         echo "TIMEZONE=\"$TIMEZONE\"" >> /etc/sysconfig/timezone
239
240         %service timezone restart
241 fi
242
243 %triggerpostun -- tzdata < 2012a-2
244 %systemd_trigger timezone.service
245
246 %files
247 %defattr(644,root,root,755)
248 %doc tzcode/README tzcode/Theory tzcode/tz-link.html
249 %ghost /etc/localtime
250 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
251 %attr(754,root,root) /etc/rc.d/init.d/timezone
252 %config(noreplace) %verify(not md5 mtime size) /etc/init/timezone.conf
253 %{systemdunitdir}/timezone.service
254 %attr(755,root,root) /lib/systemd/pld-timezone
255
256 %{_datadir}/zoneinfo
257 %exclude %{_datadir}/zoneinfo/right
258
259 %if %{with java}
260 %files -n java-tzdata
261 %defattr(644,root,root,755)
262 %{_datadir}/javazi
263 %endif
264
265 %files zoneinfo_right
266 %defattr(644,root,root,755)
267 %{_datadir}/zoneinfo/right
268
269 %files devel
270 %defattr(644,root,root,755)
271 %doc tzcode/tzfile.5.txt
272 %{_includedir}/tzfile.h
273 %{_mandir}/man5/tzfile.5*
This page took 0.068571 seconds and 3 git commands to generate.