-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libxml2.spec
284 lines (245 loc) · 8.4 KB
/
libxml2.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# disable_lto is a workaround for unresolved symbols in the 32bit library.
# We add -flto manually after building the 32bit package, so nothing lost.
%global _disable_lto 1
%bcond_without python
%if %{with python}
%global _disable_ld_no_undefined 1
%endif
# ICU support is needed in order for libreoffice, chromium, qtwebengine and
# maybe others to use system libxml.
# Please don't disable it without good reason. And if you do, fix the
# packages that rely on it.
%bcond_without icu
# (tpg) enable PGO build
%bcond_without pgo
%define major 2
%define libname %mklibname xml2_ %{major}
%define devname %mklibname xml2 -d
# libxml2 is used by wine -- needs a 32-bit compat package
%ifarch %{x86_64}
%bcond_without compat32
%else
%bcond_with compat32
%endif
%if %{with compat32}
%define lib32name libxml2_%{major}
%define dev32name libxml2-devel
%endif
# (tpg) optimize it a bit
%global optflags %{optflags} -O3
Summary: Library providing XML and HTML support
Name: libxml2
Version: 2.12.7
Release: 1
License: MIT
Group: System/Libraries
Url: https://www.xmlsoft.org/
Source0: https://download.gnome.org/sources/libxml2/%(echo %{version}|cut -d. -f1-2)/libxml2-%{version}.tar.xz
#Source0: http://xmlsoft.org/sources/%{name}-%{version}.tar.gz
Patch1: libxml2-2.9.9-no-Lusrlib.patch
Patch2: https://src.fedoraproject.org/rpms/libxml2/raw/rawhide/f/libxml2-2.9.8-python3-unicode-errors.patch
BuildRequires: gtk-doc
%if %{with python}
BuildRequires: pkgconfig(python3)
BuildRequires: gettext-devel
%endif
BuildRequires: pkgconfig(readline)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(zlib)
%ifarch riscv64
BuildRequires: atomic-devel
%endif
%if %{with icu}
BuildRequires: pkgconfig(icu-i18n)
%endif
%if %{with compat32}
# We don't require the same slew of dependencies as the regular version:
# We don't build the command line tools (hence, no need for readline),
# and since wine doesn't use python, we don't need the python bits either.
# Lastly, ICU is enabled in the regular build because of WebKit/Blink and
# LibreOffice - neither of which is relevant to wine.
BuildRequires: devel(libz)
BuildRequires: devel(liblzma)
%endif
%description
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified. The
output can be a simple SAX stream or and in-memory DOM-like
representations. In this case one can use the built-in XPath and
XPointer implementation to select subnodes or ranges. A flexible
Input/Output mechanism is available, with existing HTTP and FTP modules
and combined to a URI library.
%package -n %{libname}
Summary: Shared libraries providing XML and HTML support
Group: System/Libraries
Obsoletes: %{mklibname xml 2} < 2.8.0
Provides: %{name} = %{EVRD}
%description -n %{libname}
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified.
%package -n %{devname}
Summary: Libraries, includes, etc. to develop XML and HTML applications
Group: Development/C
Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
%if %{with icu}
# libxml/encoding.h #includes <unicode/ucnv.h>
Requires: pkgconfig(icu-i18n)
%endif
# Needed because libxml2.so links to them
Requires: pkgconfig(liblzma)
Requires: pkgconfig(zlib)
%description -n %{devname}
Libraries, include files, etc you can use to develop XML applications.
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified.
%if %{with compat32}
%package -n %{lib32name}
Summary: Shared libraries providing XML and HTML support (32-bit)
Group: System/Libraries
%description -n %{lib32name}
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified.
%package -n %{dev32name}
Summary: Libraries, includes, etc. to develop XML and HTML applications (32-bit)
Group: Development/C
Requires: %{lib32name} = %{EVRD}
Requires: %{devname} = %{EVRD}
# Needed because libxml2.so links to them
Requires: pkgconfig(liblzma)
Requires: devel(libz)
%description -n %{dev32name}
Libraries, include files, etc you can use to develop XML applications.
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified.
%endif
%package utils
Summary: Utilities to manipulate XML files
Group: System/Libraries
%description utils
This packages contains utils to manipulate XML files.
%if %{with python}
%package -n python-%{name}
Summary: Python bindings for the libxml2 library
Group: Development/Python
%rename %{name}-python
Requires: %{libname} = %{EVRD}
%description -n python-%{name}
The libxml2-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxml2 library to manipulate XML files.
This library allows you to manipulate XML files. It includes support
for reading, modifying and writing XML and HTML files. There is DTDs
support: this includes parsing and validation even with complex DtDs,
either at parse time or later once the document has been modified.
%endif
%prep
%autosetup -p1
%if %{with compat32}
export CONFIGURE_TOP="$(pwd)"
mkdir build32
cd build32
%configure32 \
--without-python \
--without-history \
--without-icu
%endif
%build
%if %{with compat32}
%make_build -C build32
%endif
export CONFIGURE_TOP="$(pwd)"
mkdir build
cd build
%if %{with pgo}
export LD_LIBRARY_PATH="$(pwd)"
CFLAGS="%{optflags} -flto -fprofile-generate" \
CXXFLAGS="%{optflags} -flto -fprofile-generate" \
LDFLAGS="%{build_ldflags} -flto -fprofile-generate" \
%configure --disable-static
%make_build
make dba100000.xml
./xmllint --noout dba100000.xml
./xmllint --stream dba100000.xml
./xmllint --noout --valid ../test/valid/REC-xml-19980210.xml
./xmllint --stream --valid ../test/valid/REC-xml-19980210.xml
unset LD_LIBRARY_PATH
llvm-profdata merge --output=%{name}-llvm.profdata $(find . -name "*.profraw" -type f)
PROFDATA="$(realpath %{name}-llvm.profdata)"
rm -f *.profraw
make clean
CFLAGS="%{optflags} -flto -fprofile-use=$PROFDATA" \
CXXFLAGS="%{optflags} -flto -fprofile-use=$PROFDATA" \
LDFLAGS="%{build_ldflags} -flto -fprofile-use=$PROFDATA" \
%else
CFLAGS="%{optflags} -flto" \
CXXFLAGS="%{optflags} -flto" \
LDFLAGS="%{build_ldflags} -flto" \
%endif
%configure \
%if !%{with python}
--without-python \
%endif
--disable-static \
%if %{with icu}
--with-icu
%else
--without-icu
%endif
%make_build
xz --text -T0 -c ../doc/libxml2-api.xml > ../doc/libxml2-api.xml.xz
%install
%if %{with compat32}
%make_install -C build32
%endif
%make_install -C build
# remove unpackaged files
rm -rf %{buildroot}%{_prefix}/doc %{buildroot}%{_datadir}/doc
%check
# all tests must pass
# use TARBALLURL_2="" TARBALLURL="" TESTDIRS="" to disable xstc test which are using remote tarball
# Currently (2.9.4-1) disabled because it freezes some build machines
#make TARBALLURL_2="" TARBALLURL="" TESTDIRS="" check
%files -n %{libname}
%{_libdir}/libxml2.so.%{major}*
%files utils
%{_bindir}/xmlcatalog
%{_bindir}/xmllint
%doc %{_mandir}/man1/xmlcatalog*
%doc %{_mandir}/man1/xmllint*
%if %{with python}
%files -n python-%{name}
%doc python/tests/*.py
%{py_platsitedir}/*.so
%{py_puresitedir}/__pycache__
%{py_puresitedir}/*.py
%endif
%files -n %{devname}
%doc README* Copyright
%doc doc/libxml2-api.xml.xz
%doc %{_datadir}/gtk-doc/html/*
%{_datadir}/aclocal/*
%{_bindir}/xml2-config
%{_libdir}/cmake/libxml2/libxml2-config.cmake
%{_libdir}/libxml2.so
%{_libdir}/pkgconfig/*
%{_includedir}/*
%doc %{_mandir}/man1/xml2-config*
%if %{with compat32}
%files -n %{lib32name}
%{_prefix}/lib/libxml2.so.%{major}*
%files -n %{dev32name}
%{_prefix}/lib/libxml2.so
%{_prefix}/lib/pkgconfig/*.pc
%{_prefix}/lib/cmake/libxml2/libxml2-config.cmake
%endif