summaryrefslogtreecommitdiff
path: root/libkolabxml.spec
blob: 7366c574f8f38be23a48a0fc5cf8850b26b4b17b (plain)
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
%undefine __cmake_in_source_build

%{?!mono_arches: %global mono_arches x86_64 aarch64}

%ifarch %{mono_arches}
# Do not enable at this time
%global with_csharp 0
%endif
%global with_java 1
%global with_php 1
%global with_python 1

%if 0%{?with_php} > 0
%{!?php_extdir: %global php_extdir %{_libdir}/php/modules}
%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d/}
%{!?php_apiver: %global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)}
%global ini_name     40-kolabformat.ini
%endif

# Filter out private python and php libs
%if 0%{?with_php} > 0
%if 0%{?with_python} > 0
%{?filter_setup:
%filter_provides_in %{python3_sitearch}/.*\.so$
%filter_provides_in %{php_extdir}/.*\.so$
%filter_setup
}
%else
%{?filter_setup:
%filter_provides_in %{php_extdir}/.*\.so$
%filter_setup
}
%endif
%else
%if 0%{?with_python} > 0
%{?filter_setup:
%filter_provides_in %{python3_sitearch}/.*\.so$
%filter_setup
}
%endif
%endif

Name:           libkolabxml
Version:        1.2.0
Release:        1
Summary:        Kolab XML format collection parser library

License:        LGPLv3+
URL:            http://www.kolab.org

Source0:        https://cgit.kolab.org/libkolabxml/snapshot/libkolabxml-%{version}.tar.gz
Patch0:         0001-Fix-build-using-swig-4.patch

BuildRequires:  boost-devel
BuildRequires:  cmake >= 2.6
BuildRequires:  e2fsprogs-devel
BuildRequires:  gcc-c++
BuildRequires:  libcurl-devel
BuildRequires:  swig
BuildRequires:  uuid-devel
BuildRequires:  xerces-c-devel
BuildRequires:  xsd

%global libkolab_obsoletes 1.0.2-20
%if 0%{?libkolab_obsoletes:1}
Obsoletes: libkolab < %{libkolab_obsoletes}
Obsoletes: libkolab-devel < %{libkolab_obsoletes}
Obsoletes: python2-libkolab < %{libkolab_obsoletes}
%endif

%if 0%{?with_csharp} < 1
Obsoletes:      csharp-kolabformat < %{version}-%{release}
#Provides:       csharp-kolabformat = %{version}-%{release}
%endif

%if 0%{?with_java} < 1
Obsoletes:      java-kolabformat < %{version}-%{release}
#Provides:       java-kolabformat = %{version}-%{release}
%endif

%if 0%{?with_php} < 1
Obsoletes:      php-kolabformat < %{version}-%{release}
#Provides:       php-kolabformat = %{version}-%{release}
%endif

%if 0%{?with_python} < 1
Obsoletes:      python-kolabformat < %{version}-%{release}
Obsoletes:      python2-kolabformat < %{version}-%{release}
%endif

%description
The libkolabxml parsing library interprets Kolab XML formats (xCal, xCard)
with bindings for Python, PHP and other languages. The language bindings
are available through sub-packages.

%package devel
Summary:        Kolab XML library development headers
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       boost-devel
Requires:       libcurl-devel
Requires:       xerces-c-devel
Requires:       cmake

%description devel
Development headers for the Kolab XML libraries.

%if 0%{?with_csharp} > 0
%package -n csharp-kolabformat
Summary:        C# Bindings for libkolabxml
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  mono-core

%description -n csharp-kolabformat
C# bindings for libkolabxml
%endif

%if 0%{?with_java} > 0
%package -n java-kolabformat
Summary:        Java Bindings for libkolabxml
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n java-kolabformat
Java bindings for libkolabxml
%endif

%if 0%{?with_php} > 0
%package -n php-kolabformat
Summary:        PHP bindings for libkolabxml
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       php(zend-abi) = %{php_zend_api}
Requires:       php(api) = %{php_core_api}
BuildRequires:  php >= 5.3
BuildRequires:  php-devel >= 5.3

%description -n php-kolabformat
The PHP kolabformat package offers a comprehensible PHP library using the
bindings provided through libkolabxml.
%endif

%if 0%{?with_python} > 0
%package -n python3-kolabformat
Summary:        Python bindings for libkolabxml
Obsoletes:      python-kolabformat < 1.1.4
Provides:       python-kolabformat = %{version}-%{release}
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  python3-devel

%description -n python3-kolabformat
The PyKolab format package offers a comprehensive Python library using the
bindings provided through libkolabxml.
%endif

%prep
%autosetup -p1

sed -i "s/-php/-php7/g" src/php/CMakeLists.txt

%build
%cmake \
    -DBUILD_TESTS:BOOL=OFF \
%if 0%{?with_csharp} > 0
    -DCSHARP_BINDINGS=ON \
    -DCSHARP_INSTALL_DIR=%{_datadir}/%{name}/csharp/ \
%endif
%if 0%{?with_java} > 0
    -DJAVA_BINDINGS=ON \
    -DJAVA_INSTALL_DIR=%{_datadir}/%{name}/java/ \
%endif
%if 0%{?with_php} > 0
    -DPHP_BINDINGS=ON \
    -DPHP_INSTALL_DIR=%{php_extdir} \
%endif
%if 0%{?with_python} > 0
    -DPYTHON_BINDINGS=ON \
    -DPYTHON_INSTALL_DIR=%{python3_sitearch}
%endif

%make_build

%install
make install DESTDIR=%{buildroot}

%if 0%{?with_php} > 0
mkdir -p \
    %{buildroot}/%{_datadir}/php \
    %{buildroot}/%{php_inidir}/
cat > %{buildroot}/%{php_inidir}/%{ini_name} << EOF
extension=kolabformat.so
EOF
%endif

%check
export LD_LIBRARY_PATH=$( pwd )/src/
%if 0%{?with_php} > 0
php -d enable_dl=On -dextension=src/php/kolabformat.so src/php/test.php ||:
%endif
%if 0%{?with_python} > 0
python3 src/python/test.py ||:
%endif


%ldconfig_scriptlets

%files
%doc DEVELOPMENT NEWS README
%license COPYING*
%{_libdir}/libkolabxml.so.1*

%files devel
%{_includedir}/kolabxml/
%{_libdir}/libkolabxml.so
%{_libdir}/cmake/Libkolabxml/

%if 0%{?with_csharp} > 0
%files -n csharp-kolabformat
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/csharp
%endif

%if 0%{?with_java} > 0
%files -n java-kolabformat
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/java
%endif

%if 0%{?with_php} > 0
%files -n php-kolabformat
%{php_extdir}/kolabformat.so
%config(noreplace) %{php_inidir}/%{ini_name}
%exclude %{_libdir}/php/modules/kolabformat.php
%endif

%if 0%{?with_python} > 0
%files -n python3-kolabformat
%{python3_sitearch}/kolabformat.py
%{python3_sitearch}/_kolabformat.so
%{python3_sitearch}/__pycache__/*
%endif


%changelog
* Mon Jun 05 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.2.0-1
- Init package