]> git.pld-linux.org Git - packages/tzdata.git/blob - tzdata.spec
- up to 2016a
[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      2016a
13 %define         tzdata_ver      2016a
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:  0d3123eb1b453ec0620822bd65be4c42
31 #Source2Download: http://www.iana.org/time-zones/
32 Source2:        ftp://ftp.iana.org/tz/releases/tzcode%{tzcode_ver}.tar.gz
33 # Source2-md5:  f5e0299925631da7cf82d8ce1205111d
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:       /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_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 %patch0 -p1
110
111 %{__tar} xzf %{SOURCE1} -C tzdata
112 # don't override Makefile from base tar
113 %{__mv} tzdata/Makefile{,.tzdata}
114
115 install -d tzcode
116 %{__tar} xzf %{SOURCE2} -C tzcode
117 %patch2 -p1
118
119 %{__sed} -e "
120 s|@objpfx@|`pwd`/obj/|
121 s|@datadir@|%{_datadir}|
122 s|@install_root@|$RPM_BUILD_ROOT|
123 " 'Makeconfig.in' > Makeconfig
124
125 grep -v tz-art.htm tzcode/tz-link.htm > tzcode/tz-link.html
126
127 %if %{with java}
128 install -d javazic
129 tar zxf %{SOURCE5} -C javazic
130 cd javazic
131 %patch1
132
133 # Hack alert! sun.tools may be defined and installed in the
134 # VM. In order to guarantee that we are using IcedTea/OpenJDK
135 # for creating the zoneinfo files, rebase all the packages
136 # from "sun." to "rht.". Unfortunately, gcj does not support
137 # any of the -Xclasspath options, so we must go this route
138 # to ensure the greatest compatibility.
139 # XXX: do we want 'pld' instead of 'rht'?
140 mv sun rht
141 find . -type f -name '*.java' -print0 \
142         | xargs -0 -- sed -i -e 's:sun\.tools\.:rht.tools.:g' \
143                                                  -e 's:sun\.util\.:rht.util.:g'
144 cd -
145 %endif
146
147 %build
148 %{__make}
149
150 %if %{with java}
151 cd javazic
152 %javac -source 1.5 -target 1.5 -classpath . $(find -name '*.java')
153 cd ../tzdata
154 %java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \
155         -d ../zoneinfo/java \
156         africa antarctica asia australasia europe northamerica pacificnew \
157         southamerica backward etcetera factory systemv \
158         ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward
159 cd ..
160 %endif
161
162 %install
163 rm -rf $RPM_BUILD_ROOT
164 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
165 %{__make} install
166
167 %if %{with tests}
168 # test needs to be ran after "make install", as it uses installed files
169 : ====================TESTING=========================
170 %{__make} check \
171         CC="%{__cc}" \
172         CFLAGS="%{rpmcflags} %{rpmldflags}"
173 : ====================TESTING END=====================
174 %endif
175
176 # glibc.spec didn't keep it. so won't here either.
177 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
178 # behave more like glibc.spec
179 ln -sf %{_sysconfdir}/localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
180 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
181 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
182
183 > $RPM_BUILD_ROOT/etc/localtime
184
185 # header file
186 cp -p tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
187 cp -p tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
188
189 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
190 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
191
192 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
193
194 %if %{with java}
195 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
196 %endif
197
198 %clean
199 rm -rf $RPM_BUILD_ROOT
200
201 %post
202 /sbin/chkconfig --add timezone
203 %service timezone restart
204
205 %preun
206 if [ "$1" = "0" ]; then
207         /sbin/chkconfig --del timezone
208
209         # save for postun
210         cp -af /etc/localtime /etc/localtime.rpmsave
211 fi
212
213 %postun
214 if [ "$1" = "0" ]; then
215         if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
216                 echo >&2 "Preserving /etc/localtime"
217                 mv -f /etc/localtime{.rpmsave,}
218         fi
219 fi
220
221 %triggerpostun -- rc-scripts < 0.4.1.4
222 /sbin/chkconfig --add timezone
223
224 %triggerpostun -- tzdata < 2008b-4
225 if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
226         . /etc/sysconfig/timezone
227
228         if [ -z $ZONE_INFO_AREA ]; then
229                 TIMEZONE=$TIME_ZONE
230         else
231                 TIMEZONE=$ZONE_INFO_AREA/$TIME_ZONE
232         fi
233
234         echo "TIMEZONE=\"$TIMEZONE\"" >> /etc/sysconfig/timezone
235
236         %service timezone restart
237 fi
238
239 %triggerpostun -- tzdata < 2015f-2
240 %systemd_service_disable timezone.service
241 %systemd_service_stop 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 %{systemdunitdir}/timezone.service
250
251 %{_datadir}/zoneinfo
252 %exclude %{_datadir}/zoneinfo/right
253
254 %if %{with java}
255 %files -n java-tzdata
256 %defattr(644,root,root,755)
257 %{_datadir}/javazi
258 %endif
259
260 %files zoneinfo_right
261 %defattr(644,root,root,755)
262 %{_datadir}/zoneinfo/right
263
264 %files devel
265 %defattr(644,root,root,755)
266 %doc tzcode/tzfile.5.txt
267 %{_includedir}/tzfile.h
268 %{_mandir}/man5/tzfile.5*
This page took 0.098311 seconds and 3 git commands to generate.