Add license file
[platform/upstream/zlib.git] / packaging / zlib.spec
1 %define keepstatic 1
2 Name:           zlib
3 Provides:       libz
4 Obsoletes:      libz
5 Version:        1.2.8
6 Release:        0
7 Summary:        Data Compression Library
8 License:        Zlib
9 Group:          Base/Libraries
10 Url:            http://www.zlib.net/
11 #X-Vcs-Url:     https://github.com/madler/zlib.git
12 Source:         http://zlib.net/zlib-%{version}.tar.bz2
13 Source1:        LICENSE
14 Source2:        baselibs.conf
15 Source1001:     zlib.manifest
16 BuildRequires:  pkgconfig
17
18 %description
19 ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt
20 (deflate format) and rfc1952.txt (gzip format). These documents are
21 also available in other formats from
22 ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html.
23
24 %package devel
25 Summary:        Include Files and Libraries mandatory for Development
26 Group:          Development/Libraries
27 Requires:       glibc-devel
28 Requires:       zlib = %{version}
29 Provides:       libz:/usr/include/zlib.h
30
31 %description devel
32 This package contains all necessary include files and libraries needed
33 to develop applications that require the provided includes and
34 libraries.
35
36 %package devel-static
37 Summary:        Include Files and Libraries mandatory for Development
38 Group:          Development/Libraries
39 Requires:       %{name}-devel = %{version}
40 Provides:       %{name}-devel:%{_libdir}/libz.a
41
42 %description devel-static
43 This package contains all necessary include files and libraries needed
44 to develop applications that require the provided includes and
45 libraries.
46
47 %package -n minizip
48 Summary:    Manipulates files from a .zip archive
49 Group:      System/Libraries
50 Requires:   %{name} = %{version}-%{release}
51
52 %description -n minizip
53 Minizip is a tool to manipulates files from a .zip archive.
54
55 %package -n minizip-devel
56 Summary:    Development files for the minizip library
57 Group:      Development/Libraries
58 Requires:   minizip = %{version}-%{release}
59
60 %description -n minizip-devel
61 This package contains the libraries and header files needed for
62 developing applications which use minizip.
63
64 %prep
65 %setup -q
66 cp %{SOURCE1} .
67 cp %{SOURCE1001} .
68
69 %build
70 export LDFLAGS="-Wl,-z,relro,-z,now"
71 %define do_profiling 0
72 %if %{do_profiling}
73 profiledir=$(mktemp -d)
74 trap "rm -rf $profiledir" EXIT
75 CC="gcc" ./configure --shared --prefix=%{_prefix} --libdir=/%{_lib}
76 %__make CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir" %{?_smp_mflags}
77 time %__make check
78 %__make clean
79 %__make CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir" %{?_smp_mflags}
80 %else
81 export CFLAGS="%{optflags}"
82 CC="gcc" ./configure --shared --prefix=%{_prefix} --libdir=/%{_lib}
83 %__make %{?_smp_mflags}
84 %endif
85
86 cd contrib/minizip
87 %reconfigure
88 %__make %{?_smp_mflags}
89
90 %check
91 time %__make check
92
93 %install
94 #mkdir -p %%{buildroot}%%{_mandir}/man3
95 mkdir -p %{buildroot}%{_libdir}
96 %make_install
97 pushd %{buildroot}%{_libdir}
98 ln -sf -v ../../%{_lib}/$(readlink %{buildroot}/%{_lib}/libz.so) %{buildroot}%{_libdir}/libz.so
99 popd
100 rm -v %{buildroot}/%{_lib}/libz.so
101 # static lib
102 mv %{buildroot}/%{_lib}/libz.a %{buildroot}%{_libdir}
103 # Move .pc file to %%{_libdir}
104 mv %{buildroot}/%{_lib}/pkgconfig %{buildroot}%{_libdir}
105 # manpage
106 install -m 644 zlib.3 %{buildroot}%{_mandir}/man3
107 install -m 644 zutil.h %{buildroot}%{_includedir}
108
109 pushd contrib/minizip
110 %make_install
111 rm -rf %{buildroot}%{_libdir}/libminizip.a
112 rm -rf %{buildroot}%{_libdir}/libminizip.la
113 popd
114
115 %post -p /sbin/ldconfig
116
117 %postun -p /sbin/ldconfig
118
119 %post -n minizip -p /sbin/ldconfig
120
121 %postun -n minizip -p /sbin/ldconfig
122
123 %files
124 %manifest %{name}.manifest
125 %defattr(-,root,root)
126 %license LICENSE
127 /%{_lib}/libz.so.1.2.*
128 /%{_lib}/libz.so.1
129
130 %files devel
131 %manifest %{name}.manifest
132 %defattr(-,root,root)
133 %doc README
134 %license LICENSE
135 %{_mandir}/man3/zlib.3.gz
136 %{_includedir}/zlib.h
137 %{_includedir}/zconf.h
138 %{_includedir}/zutil.h
139 %{_libdir}/libz.so
140 %{_libdir}/pkgconfig/zlib.pc
141
142 %files devel-static
143 %manifest %{name}.manifest
144 %defattr(-,root,root)
145 %license LICENSE
146 %{_libdir}/libz.a
147
148 %files -n minizip
149 %manifest %{name}.manifest
150 %license LICENSE
151 %{_libdir}/libminizip.so.*
152
153 %files -n minizip-devel
154 %manifest %{name}.manifest
155 %license LICENSE
156 %{_includedir}/minizip/*.h
157 %{_libdir}/libminizip.so
158 %{_libdir}/pkgconfig/minizip.pc