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