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