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