1 |
%define lib_major 1 |
2 |
%define lib_name %mklibname %{name}%{lib_major} |
3 |
%define devel_name %mklibname %{name} -d |
4 |
|
5 |
%define build_biarch 0 |
6 |
# Enable bi-arch build on ppc64, sparc64 and x86-64 |
7 |
%ifarch sparcv9 sparc64 x86_64 ppc64 |
8 |
%define build_biarch 1 |
9 |
%endif |
10 |
%ifarch sparcv9 |
11 |
%define _lib lib64 |
12 |
%endif |
13 |
|
14 |
%bcond_without uclibc |
15 |
%bcond_without dietlibc |
16 |
|
17 |
Summary: The zlib compression and decompression library |
18 |
Name: zlib |
19 |
Version: 1.2.5 |
20 |
Release: %mkrel 3 |
21 |
Group: System/Libraries |
22 |
License: BSD |
23 |
URL: http://www.gzip.org/zlib/ |
24 |
Source0: http://prdownloads.sourceforge.net/libpng/%{name}-%{version}.tar.gz |
25 |
Patch1: zlib-1.2.5-multibuild.patch |
26 |
Patch2: zlib-1.2.5-lfs-decls.patch |
27 |
BuildRequires: setarch |
28 |
%if %{with uclibc} |
29 |
BuildRequires: uClibc-devel >= 0.9.30.3-2 |
30 |
%endif |
31 |
%if %{with dietlibc} |
32 |
BuildRequires: dietlibc-devel |
33 |
%endif |
34 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
35 |
|
36 |
%description |
37 |
The zlib compression library provides in-memory compression and |
38 |
decompression functions, including integrity checks of the uncompressed |
39 |
data. This version of the library supports only one compression method |
40 |
(deflation), but other algorithms may be added later, which will have |
41 |
the same stream interface. The zlib library is used by many different |
42 |
system programs. |
43 |
|
44 |
%package -n %{lib_name} |
45 |
Summary: The zlib compression and decompression library |
46 |
Group: System/Libraries |
47 |
Obsoletes: libz, libz1, %{name} |
48 |
Obsoletes: %{name}%{lib_major} < 1.2.5 |
49 |
Provides: libz = %{version}-%{release} libz1 = %{version}-%{release} %{name} = %{version}-%{release} |
50 |
%if %{with uclibc} |
51 |
Provides: uClibc-zlib = %{version}-%{release} uClibc-zlib1 = %{version}-%{release} |
52 |
Obsoletes: uClibc-zlib <= %{version}-%{release} uClibc-zlib1 <= %{version}-%{release} |
53 |
%endif |
54 |
|
55 |
%description -n %{lib_name} |
56 |
The zlib compression library provides in-memory compression and |
57 |
decompression functions, including integrity checks of the uncompressed |
58 |
data. This version of the library supports only one compression method |
59 |
(deflation), but other algorithms may be added later, which will have |
60 |
the same stream interface. The zlib library is used by many different |
61 |
system programs. |
62 |
|
63 |
%package -n %{devel_name} |
64 |
Summary: Header files and libraries for developing apps which will use zlib |
65 |
Group: Development/C |
66 |
Requires: %{lib_name} = %{version}-%{release} |
67 |
Obsoletes: libz1-devel libz-devel zlib-devel zlib1-devel |
68 |
Obsoletes: %{name}%{lib_major}-devel < 1.2.5 |
69 |
Provides: libz-devel = %{version}-%{release} lib%{name}-devel = %{version}-%{release} %{name}-devel = %{version}-%{release} |
70 |
%if %{with uclibc} |
71 |
Provides: uClibc-zlib-devel = %{version}-%{release} uClibc-zlib1-devel = %{version}-%{release} |
72 |
Obsoletes: uClibc-zlib-devel <= %{version}-%{release} uClibc-zlib1-devel <= %{version}-%{release} |
73 |
%endif |
74 |
|
75 |
%description -n %{devel_name} |
76 |
The zlib-devel package contains the header files and libraries needed |
77 |
to develop programs that use the zlib compression and decompression |
78 |
library. |
79 |
|
80 |
Install the zlib-devel package if you want to develop applications that |
81 |
will use the zlib library. |
82 |
|
83 |
%prep |
84 |
%setup -q |
85 |
%patch1 -p1 -b .multibuild~ |
86 |
%patch2 -p1 -b .lfs |
87 |
|
88 |
%build |
89 |
#(peroyvind): be sure to remove -m64/-m32 flags as they're not overridable |
90 |
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS| sed -e 's/-m.. //g'` -O3" |
91 |
mkdir objs |
92 |
pushd objs |
93 |
CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%{?ldflags}" \ |
94 |
%if %{build_biarch} |
95 |
CC="%{__cc} -m64" \ |
96 |
%endif |
97 |
../configure --shared --prefix=%{_prefix} --libdir=%{_libdir} |
98 |
%make |
99 |
make test |
100 |
ln -s ../zlib.3 . |
101 |
popd |
102 |
|
103 |
%if %{build_biarch} |
104 |
%ifarch %{sunsparc} |
105 |
RPM_OPT_FLAGS_32="$RPM_OPT_FLAGS" |
106 |
%else |
107 |
RPM_OPT_FLAGS_32=`linux32 rpm --eval %%optflags` |
108 |
%endif |
109 |
mkdir objs32 |
110 |
pushd objs32 |
111 |
CFLAGS="$RPM_OPT_FLAGS_32" LDFLAGS="%{?ldflags}" CC="%{__cc} -m32" \ |
112 |
../configure --shared --prefix=%{_prefix} |
113 |
%make |
114 |
make test |
115 |
ln -s ../zlib.3 . |
116 |
popd |
117 |
%endif |
118 |
|
119 |
%if %{with dietlibc} |
120 |
mkdir objsdietlibc |
121 |
pushd objsdietlibc |
122 |
CFLAGS="-Os" CC="diet gcc" \ |
123 |
../configure --prefix=%{_prefix} |
124 |
%make libz.a |
125 |
popd |
126 |
%endif |
127 |
|
128 |
%if %{with uclibc} |
129 |
mkdir objsuclibc |
130 |
pushd objsuclibc |
131 |
CFLAGS="%{uclibc_cflags}" LDFLAGS="%{?ldflags}" CC="%{uclibc_cc}" \ |
132 |
../configure --shared --prefix=%{_prefix} |
133 |
%make |
134 |
popd |
135 |
%endif |
136 |
|
137 |
%install |
138 |
rm -rf %{buildroot} |
139 |
|
140 |
install -d %{buildroot}/%{_prefix} |
141 |
install -d %{buildroot}/%{_libdir} |
142 |
|
143 |
make install -C objs prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} |
144 |
%if %{build_biarch} |
145 |
make install-libs -C objs32 prefix=%{buildroot}%{_prefix} |
146 |
%endif |
147 |
|
148 |
install -d %{buildroot}/%{_lib} |
149 |
mv %{buildroot}%{_libdir}/*.so.* %{buildroot}/%{_lib}/ |
150 |
ln -s ../../%{_lib}/libz.so.%{version} %{buildroot}%{_libdir}/ |
151 |
|
152 |
%if %{build_biarch} |
153 |
install -d %{buildroot}/lib |
154 |
mv %{buildroot}%{_prefix}/lib/*.so.* %{buildroot}/lib/ |
155 |
ln -s ../../lib/libz.so.%{version} %{buildroot}%{_prefix}/lib/ |
156 |
%endif |
157 |
|
158 |
%if %{with dietlibc} |
159 |
install -m644 objsdietlibc/libz.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a |
160 |
%endif |
161 |
|
162 |
%if %{with uclibc} |
163 |
#install -m644 objsuclibc/libz.a -D %{buildroot}%{uclibc_root}%{_libdir}/libz.a |
164 |
make install-libs-only -C objsuclibc prefix=%{buildroot}%{uclibc_root} libdir=%{buildroot}%{uclibc_root}%{_libdir} |
165 |
%endif |
166 |
|
167 |
%clean |
168 |
rm -fr %{buildroot} |
169 |
|
170 |
%files -n %{lib_name} |
171 |
%defattr(-, root, root) |
172 |
%doc README |
173 |
/%{_lib}/libz.so.%{lib_major}* |
174 |
%{_libdir}/libz.so.%{lib_major}* |
175 |
%if %{with uclibc} |
176 |
%{uclibc_root}%{_libdir}/libz.so.%{lib_major}* |
177 |
%endif |
178 |
%if %{build_biarch} |
179 |
/lib/libz.so.* |
180 |
%{_prefix}/lib/libz.so.%{lib_major}* |
181 |
%endif |
182 |
|
183 |
%files -n %{devel_name} |
184 |
%defattr(-, root, root) |
185 |
%doc README ChangeLog doc/algorithm.txt |
186 |
%{_mandir}/man3/zlib.3* |
187 |
%{_libdir}/*.a |
188 |
%{_libdir}/*.so |
189 |
%{_libdir}/pkgconfig/zlib.pc |
190 |
%if %{with uclibc} |
191 |
%{uclibc_root}%{_libdir}/libz.so |
192 |
%endif |
193 |
%if %{build_biarch} |
194 |
%{_prefix}/lib/*.a |
195 |
%{_prefix}/lib/*.so |
196 |
%{_prefix}/lib/pkgconfig/zlib.pc |
197 |
%endif |
198 |
%{_includedir}/* |
199 |
%if %{with dietlibc} |
200 |
%{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a |
201 |
%endif |
202 |
%if %{with uclibc} |
203 |
%{uclibc_root}%{_libdir}/libz.a |
204 |
%endif |
205 |
|
206 |
|