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