1 |
%define major 0 |
2 |
%define pcreposix_major 1 |
3 |
%define libname_orig lib%{name} |
4 |
%define libname %mklibname pcre %{major} |
5 |
%define develname %mklibname -d pcre |
6 |
|
7 |
%define build_pcreposix_compat 1 |
8 |
|
9 |
Summary: Perl-compatible regular expression library |
10 |
Name: pcre |
11 |
Version: 8.13 |
12 |
Release: %mkrel 1 |
13 |
License: BSD-Style |
14 |
Group: File tools |
15 |
URL: http://www.pcre.org/ |
16 |
Source0: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%name-%version.tar.bz2 |
17 |
Source1: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%name-%version.tar.bz2.sig |
18 |
Requires: %{libname} = %{version}-%{release} |
19 |
BuildRequires: automake |
20 |
Patch1: pcre-0.6.5-fix-detect-into-kdelibs.patch |
21 |
Patch2: pcre-linkage_fix.diff |
22 |
Patch3: pcre-7.8-format_not_a_string_literal_and_no_format_arguments.diff |
23 |
# from debian: |
24 |
Patch4: pcre-pcreposix-glibc-conflict.patch |
25 |
|
26 |
%description |
27 |
PCRE has its own native API, but a set of "wrapper" functions that are based on |
28 |
the POSIX API are also supplied in the library libpcreposix. Note that this |
29 |
just provides a POSIX calling interface to PCRE: the regular expressions |
30 |
themselves still follow Perl syntax and semantics. |
31 |
This package contains a grep variant based on the PCRE library. |
32 |
|
33 |
%package -n %{libname} |
34 |
Group: System/Libraries |
35 |
Summary: Perl-compatible regular expression library |
36 |
Provides: %{libname_orig} = %{version}-%{release} |
37 |
Conflicts: pcre <= 4.0 |
38 |
|
39 |
%description -n %{libname} |
40 |
PCRE has its own native API, but a set of "wrapper" functions that are based on |
41 |
the POSIX API are also supplied in the library libpcreposix. Note that this |
42 |
just provides a POSIX calling interface to PCRE: the regular expressions |
43 |
themselves still follow Perl syntax and semantics. The header file |
44 |
for the POSIX-style functions is called pcreposix.h. The official POSIX name is |
45 |
regex.h, but I didn't want to risk possible problems with existing files of |
46 |
that name by distributing it that way. To use it with an existing program that |
47 |
uses the POSIX API, it will have to be renamed or pointed at by a link. |
48 |
|
49 |
%package -n %{develname} |
50 |
Group: Development/C |
51 |
Summary: Headers and static lib for pcre development |
52 |
Requires: %{libname} = %{version}-%{release} |
53 |
Provides: %{libname_orig}-devel = %{version}-%{release} |
54 |
Provides: %{name}-devel = %{version}-%{release} |
55 |
Obsoletes: %mklibname pcre 0 -d |
56 |
Conflicts: pcre <= 4.0 |
57 |
|
58 |
%description -n %{develname} |
59 |
Install this package if you want do compile applications using the pcre |
60 |
library. |
61 |
|
62 |
%prep |
63 |
|
64 |
%setup -q |
65 |
%patch1 -p1 -b .detect_into_kdelibs |
66 |
%patch2 -p0 |
67 |
|
68 |
|
69 |
%if %{build_pcreposix_compat} |
70 |
# pcre-pcreposix-glibc-conflict patch below breaks compatibility, |
71 |
# create a libpcreposix.so.0 without the patch |
72 |
cp -a . ../pcre-with-pcreposix_compat && mv ../pcre-with-pcreposix_compat . |
73 |
%endif |
74 |
%patch4 -p1 -b .symbol-conflict |
75 |
|
76 |
%build |
77 |
%if %{build_pcreposix_compat} |
78 |
dirs="pcre-with-pcreposix_compat ." |
79 |
%else |
80 |
dirs="." |
81 |
%endif |
82 |
for i in $dirs; do |
83 |
cd $i |
84 |
mkdir -p m4 |
85 |
autoreconf -fi |
86 |
%configure2_5x --enable-utf8 --enable-unicode-properties |
87 |
%make |
88 |
cd - |
89 |
done |
90 |
|
91 |
%check |
92 |
export LC_ALL=C |
93 |
# Tests, patch out actual pcre_study_size in expected results |
94 |
#echo 'int main() { printf("%d", sizeof(pcre_study_data)); return 0; }' | \ |
95 |
#%{__cc} -xc - -include "pcre_internal.h" -I. -o study_size |
96 |
#STUDY_SIZE=`./study_size` |
97 |
#perl -pi -e "s,(Study size\s+=\s+)\d+,\${1}$STUDY_SIZE," testdata/testoutput* |
98 |
make check |
99 |
|
100 |
%install |
101 |
rm -rf $RPM_BUILD_ROOT |
102 |
%if %{build_pcreposix_compat} |
103 |
%makeinstall_std -C pcre-with-pcreposix_compat |
104 |
%endif |
105 |
%makeinstall_std |
106 |
|
107 |
%multiarch_binaries $RPM_BUILD_ROOT%{_bindir}/pcre-config |
108 |
|
109 |
mkdir -p $RPM_BUILD_ROOT/%_lib |
110 |
mv $RPM_BUILD_ROOT/%_libdir/lib%{name}.so.%{major}.* $RPM_BUILD_ROOT/%_lib |
111 |
cd $RPM_BUILD_ROOT/%_libdir |
112 |
ln -s ../../%_lib/lib%{name}.so.%{major}.* . |
113 |
|
114 |
# Remove unwanted files |
115 |
rm -f $RPM_BUILD_ROOT/%_docdir/pcre/{AUTHORS,ChangeLog,COPYING,LICENCE,NEWS} |
116 |
rm -f $RPM_BUILD_ROOT/%_docdir/pcre/{pcre-config.txt,pcre.txt,pcregrep.txt} |
117 |
rm -f $RPM_BUILD_ROOT/%_docdir/pcre/{pcretest.txt,README} |
118 |
rm -rf $RPM_BUILD_ROOT/%_docdir/pcre/html |
119 |
|
120 |
%clean |
121 |
rm -rf $RPM_BUILD_ROOT |
122 |
|
123 |
%files |
124 |
%defattr(-,root,root) |
125 |
|
126 |
%_mandir/man1/pcregrep.1* |
127 |
%_mandir/man1/pcretest.1* |
128 |
%_bindir/pcregrep |
129 |
%_bindir/pcretest |
130 |
|
131 |
|
132 |
# |
133 |
%files -n %{libname} |
134 |
%defattr(-,root,root) |
135 |
%doc AUTHORS COPYING LICENCE NEWS README |
136 |
|
137 |
/%_lib/lib*.so.%{major}* |
138 |
%_libdir/lib*.so.%{major}* |
139 |
%_libdir/libpcreposix.so.%{pcreposix_major}* |
140 |
|
141 |
|
142 |
# |
143 |
%files -n %{develname} |
144 |
%defattr(-,root,root) |
145 |
%doc doc/html |
146 |
%doc ChangeLog |
147 |
|
148 |
%_libdir/lib*.a |
149 |
%_libdir/lib*.la |
150 |
%_libdir/lib*.so |
151 |
%_includedir/*.h |
152 |
%_libdir/pkgconfig/libpcre.pc |
153 |
%_libdir/pkgconfig/libpcrecpp.pc |
154 |
%_libdir/pkgconfig/libpcreposix.pc |
155 |
|
156 |
%_bindir/pcre-config |
157 |
%multiarch %{multiarch_bindir}/pcre-config |
158 |
|
159 |
%_mandir/man1/pcre-config.1* |
160 |
%_mandir/man3/*.3* |
161 |
|
162 |
|