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