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