1 |
%define lib_major 1 |
2 |
%define lib_name %mklibname %{name}%{lib_major} |
3 |
%define devel_name %mklibname %{name} -d |
4 |
# for uClibc-zlib |
5 |
%define uClib_name %mklibname uClibc-%{name}%{lib_major} |
6 |
%define uClib_devel_name %mklibname uClibc-%{name} -d |
7 |
%define libminizip %mklibname minizip %{lib_major} |
8 |
%define minizip_devel %mklibname minizip -d |
9 |
|
10 |
%define build_biarch 0 |
11 |
# Enable bi-arch build on ppc64, sparc64 and x86-64 |
12 |
%ifarch sparcv9 sparc64 x86_64 ppc64 |
13 |
%define build_biarch 1 |
14 |
%endif |
15 |
%ifarch sparcv9 |
16 |
%define _lib lib64 |
17 |
%endif |
18 |
%define build_minizip 1 |
19 |
|
20 |
%bcond_without uclibc |
21 |
%bcond_without dietlibc |
22 |
|
23 |
Summary: The zlib compression and decompression library |
24 |
Name: zlib |
25 |
Version: 1.2.7 |
26 |
Release: %mkrel 4 |
27 |
Group: System/Libraries |
28 |
License: BSD |
29 |
URL: http://www.gzip.org/zlib/ |
30 |
Source0: http://prdownloads.sourceforge.net/libpng/%{name}-%{version}.tar.gz |
31 |
Patch1: zlib-1.2.6-multibuild.patch |
32 |
Patch2: zlib-1.2.5-lfs-decls.patch |
33 |
BuildRequires: setarch |
34 |
%if %{with uclibc} |
35 |
BuildRequires: uClibc-devel >= 0.9.30.3-2 |
36 |
%endif |
37 |
%if %{with dietlibc} |
38 |
BuildRequires: dietlibc-devel |
39 |
%endif |
40 |
%if %build_minizip |
41 |
BuildRequires: zlib-devel |
42 |
%endif |
43 |
|
44 |
%description |
45 |
The zlib compression library provides in-memory compression and |
46 |
decompression functions, including integrity checks of the uncompressed |
47 |
data. This version of the library supports only one compression method |
48 |
(deflation), but other algorithms may be added later, which will have |
49 |
the same stream interface. The zlib library is used by many different |
50 |
system programs. |
51 |
|
52 |
%package -n %{lib_name} |
53 |
Summary: The zlib compression and decompression library |
54 |
Group: System/Libraries |
55 |
Requires(pre): filesystem >= 2.1.9-18 |
56 |
Obsoletes: libz, libz1, %{name} |
57 |
Obsoletes: %{name}%{lib_major} < 1.2.5 |
58 |
Provides: libz = %{version}-%{release} libz1 = %{version}-%{release} %{name} = %{version}-%{release} |
59 |
|
60 |
%description -n %{lib_name} |
61 |
The zlib compression library provides in-memory compression and |
62 |
decompression functions, including integrity checks of the uncompressed |
63 |
data. This version of the library supports only one compression method |
64 |
(deflation), but other algorithms may be added later, which will have |
65 |
the same stream interface. The zlib library is used by many different |
66 |
system programs. |
67 |
|
68 |
%package -n %{devel_name} |
69 |
Summary: Header files and libraries for developing apps which will use zlib |
70 |
Group: Development/C |
71 |
Requires: %{lib_name} = %{version}-%{release} |
72 |
Obsoletes: libz1-devel libz-devel zlib-devel zlib1-devel |
73 |
Obsoletes: %{name}%{lib_major}-devel < 1.2.5 |
74 |
Provides: libz-devel = %{version}-%{release} lib%{name}-devel = %{version}-%{release} %{name}-devel = %{version}-%{release} |
75 |
|
76 |
%description -n %{devel_name} |
77 |
The zlib-devel package contains the header files and libraries needed |
78 |
to develop programs that use the zlib compression and decompression |
79 |
library. |
80 |
|
81 |
Install the zlib-devel package if you want to develop applications that |
82 |
will use the zlib library. |
83 |
|
84 |
%if %build_minizip |
85 |
%package -n %{libminizip} |
86 |
Summary: Minizip manipulates files from a .zip archive |
87 |
Group: System/Libraries |
88 |
|
89 |
%description -n %{libminizip} |
90 |
Minizip manipulates files from a .zip archive. |
91 |
|
92 |
%package -n %{minizip_devel} |
93 |
Summary: Development files for the minizip library |
94 |
Group: Development/C |
95 |
Requires: %{libminizip} = %{version}-%{release} |
96 |
Requires: zlib-devel = %{version}-%{release} |
97 |
Provides: libminizip-devel = %{version}-%{release} |
98 |
Provides: minizip-devel = %{version}-%{release} |
99 |
|
100 |
%description -n %{minizip_devel} |
101 |
This package contains the libraries and header files needed for |
102 |
developing applications which use minizip. |
103 |
%endif |
104 |
|
105 |
%if %{with uclibc} |
106 |
%package -n %{uClib_name} |
107 |
Summary: The uClibc-zlib compression and decompression library |
108 |
Group: System/Libraries |
109 |
Conflicts: %{lib_name} < 1.2.5-4 |
110 |
Requires: %{lib_name} = %{version}-%{release} |
111 |
Provides: uClibc-zlib = %{version}-%{release} uClibc-zlib1 = %{version}-%{release} |
112 |
Obsoletes: uClibc-zlib <= %{version}-%{release} uClibc-zlib1 <= %{version}-%{release} |
113 |
|
114 |
%description -n %{uClib_name} |
115 |
The uClibc-zlib compression library provides in-memory compression and |
116 |
decompression functions, including integrity checks of the uncompressed |
117 |
data. This version of the library supports only one compression method |
118 |
(deflation), but other algorithms may be added later, which will have |
119 |
the same stream interface. The zlib library is used by many different |
120 |
system programs. |
121 |
|
122 |
%package -n %{uClib_devel_name} |
123 |
Summary: Header files and libraries for developing apps which will use uClibc-zlib |
124 |
Group: Development/C |
125 |
Conflicts: %{devel_name} < 1.2.5-4 |
126 |
Requires: %{devel_name} = %{version}-%{release} |
127 |
Requires: %{uClib_name} = %{version}-%{release} |
128 |
Provides: uClibc-zlib-devel = %{version}-%{release} uClibc-zlib1-devel = %{version}-%{release} |
129 |
Obsoletes: uClibc-zlib-devel <= %{version}-%{release} uClibc-zlib1-devel <= %{version}-%{release} |
130 |
|
131 |
%description -n %{uClib_devel_name} |
132 |
The uClibc-zlib-devel package contains the header files and libraries |
133 |
needed to develop programs that use the zlib compression and decompression |
134 |
library. |
135 |
|
136 |
Install the uClibc-zlib-devel package if you want to develop applications that |
137 |
will use the uClibc-zlib library. |
138 |
%endif # with uclibc |
139 |
|
140 |
%prep |
141 |
%setup -q |
142 |
#patch1 -p1 -b .multibuild |
143 |
|
144 |
%build |
145 |
#(peroyvind): be sure to remove -m64/-m32 flags as they're not overridable |
146 |
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS| sed -e 's/-m.. //g'` -O3" |
147 |
mkdir objs |
148 |
cp -a $(ls | grep -v objs) objs/ |
149 |
pushd objs |
150 |
CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%{?ldflags}" \ |
151 |
%if %{build_biarch} |
152 |
CC="%{__cc} -m64" \ |
153 |
%endif |
154 |
./configure --shared --prefix=%{_prefix} --libdir=%{_libdir} |
155 |
%make |
156 |
make test |
157 |
popd |
158 |
|
159 |
%if %build_minizip |
160 |
pushd contrib/minizip |
161 |
autoreconf --install |
162 |
%configure --enable-static=no |
163 |
%make |
164 |
popd |
165 |
%endif |
166 |
|
167 |
%if %{build_biarch} |
168 |
%ifarch %{sunsparc} |
169 |
RPM_OPT_FLAGS_32="$RPM_OPT_FLAGS" |
170 |
%else |
171 |
RPM_OPT_FLAGS_32=`linux32 rpm --eval %%optflags` |
172 |
%endif |
173 |
mkdir objs32 |
174 |
cp -a $(ls | grep -v objs) objs32/ |
175 |
pushd objs32 |
176 |
CFLAGS="$RPM_OPT_FLAGS_32" LDFLAGS="%{?ldflags}" CC="%{__cc} -m32" \ |
177 |
./configure --shared --prefix=%{_prefix} |
178 |
%make |
179 |
make test |
180 |
popd |
181 |
%endif |
182 |
|
183 |
%if %{with dietlibc} |
184 |
mkdir objsdietlibc |
185 |
cp -a $(ls | grep -v objs) objsdietlibc/ |
186 |
pushd objsdietlibc |
187 |
CFLAGS="-Os" CC="diet gcc" \ |
188 |
./configure --prefix=%{_prefix} |
189 |
%make libz.a |
190 |
popd |
191 |
%endif |
192 |
|
193 |
%if %{with uclibc} |
194 |
mkdir objsuclibc |
195 |
cp -a $(ls | grep -v objs) objsuclibc/ |
196 |
pushd objsuclibc |
197 |
CFLAGS="%{uclibc_cflags}" LDFLAGS="%{?ldflags}" CC="%{uclibc_cc}" \ |
198 |
./configure --shared --prefix=%{_prefix} |
199 |
%make |
200 |
popd |
201 |
%endif |
202 |
|
203 |
%install |
204 |
rm -rf %{buildroot} |
205 |
|
206 |
install -d %{buildroot}/%{_prefix} |
207 |
install -d %{buildroot}/%{_libdir} |
208 |
|
209 |
make install -C objs prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} |
210 |
%if %{build_biarch} |
211 |
make install-libs -C objs32 prefix=%{buildroot}%{_prefix} |
212 |
%endif |
213 |
|
214 |
%if %build_minizip |
215 |
pushd contrib/minizip |
216 |
%makeinstall_std |
217 |
popd |
218 |
%endif |
219 |
|
220 |
%if %{with dietlibc} |
221 |
install -m644 objsdietlibc/libz.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a |
222 |
%endif |
223 |
|
224 |
%if %{with uclibc} |
225 |
#install -m644 objsuclibc/libz.a -D %{buildroot}%{uclibc_root}%{_libdir}/libz.a |
226 |
make install-libs -C objsuclibc prefix=%{buildroot}%{uclibc_root} libdir=%{buildroot}%{uclibc_root}%{_libdir} |
227 |
rm -fr %{buildroot}%{uclibc_root}/share/man %{buildroot}%{uclibc_root}/usr/lib*/pkgconfig |
228 |
%endif |
229 |
|
230 |
%if %build_minizip |
231 |
rm -fr %{buildroot}%_libdir/libminizip.la |
232 |
%endif |
233 |
|
234 |
%clean |
235 |
rm -fr %{buildroot} |
236 |
|
237 |
%files -n %{lib_name} |
238 |
%doc README |
239 |
%{_libdir}/libz.so.%{lib_major}* |
240 |
%if %{build_biarch} |
241 |
%{_prefix}/lib/libz.so.%{lib_major}* |
242 |
%endif |
243 |
|
244 |
%files -n %{devel_name} |
245 |
%doc README ChangeLog doc/algorithm.txt |
246 |
%{_mandir}/man3/zlib.3* |
247 |
%{_libdir}/*.a |
248 |
%{_libdir}/*.so |
249 |
%if %build_minizip |
250 |
%exclude %{_libdir}/libminizip.so |
251 |
%endif |
252 |
%{_libdir}/pkgconfig/zlib.pc |
253 |
%if %{build_biarch} |
254 |
%{_prefix}/lib/*.a |
255 |
%{_prefix}/lib/*.so |
256 |
%{_prefix}/lib/pkgconfig/zlib.pc |
257 |
%endif |
258 |
%{_includedir}/zconf.h |
259 |
%{_includedir}/zlib.h |
260 |
%if %{with dietlibc} |
261 |
%{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a |
262 |
%endif |
263 |
|
264 |
%if %build_minizip |
265 |
%files -n %{libminizip} |
266 |
%{_libdir}/libminizip.so.%{lib_major}* |
267 |
|
268 |
%files -n %{minizip_devel} |
269 |
%{_libdir}/pkgconfig/minizip.pc |
270 |
%{_libdir}/libminizip.so |
271 |
%{_includedir}/minizip |
272 |
%endif |
273 |
|
274 |
%if %{with uclibc} |
275 |
%files -n %{uClib_name} |
276 |
%{uclibc_root}%{_libdir}/libz.so.%{lib_major}* |
277 |
|
278 |
%files -n %{uClib_devel_name} |
279 |
%{uclibc_root}%{_libdir}/libz.so |
280 |
%{uclibc_root}%{_libdir}/libz.a |
281 |
%endif # with uclibc |