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