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