]> git.pld-linux.org Git - packages/libcomps.git/blob - libcomps.spec
rebuild with python 3.10
[packages/libcomps.git] / libcomps.spec
1 #
2 # TODO
3 # - fix missing -lm
4 # - convince upstream to fix SONAME: libcomps.so.0.1.6
5 #
6 # Conditional build:
7 %bcond_without  doc     # don't build (doxygen and sphinx) docs
8 %bcond_without  python2 # CPython 2.x module
9 %bcond_without  python3 # CPython 3.x module
10
11 Summary:        Comps XML file manipulation library
12 Summary(pl.UTF-8):      Biblioteka operacji na plikach Comps XML
13 Name:           libcomps
14 Version:        0.1.15
15 Release:        3
16 License:        GPL v2+
17 Group:          Libraries
18 #Source0Download: https://github.com/rpm-software-management/libcomps/releases
19 Source0:        https://github.com/rpm-software-management/libcomps/archive/%{name}-%{version}.tar.gz
20 # Source0-md5:  5e899d213a28496f3b37236b47293bdf
21 Patch0:         %{name}-build.patch
22 Patch1:         python-install-dir.patch
23 URL:            https://github.com/rpm-software-management/libcomps
24 BuildRequires:  check-devel
25 BuildRequires:  cmake >= 2.6
26 %{?with_doc:BuildRequires:      doxygen}
27 BuildRequires:  expat-devel >= 1.95
28 BuildRequires:  libxml2-devel >= 2.0
29 %if %{with python2}
30 BuildRequires:  python-devel
31 BuildRequires:  python-modules
32 %{?with_doc:BuildRequires:      sphinx-pdg-2}
33 %endif
34 %if %{with python3}
35 BuildRequires:  python3-devel
36 BuildRequires:  python3-modules
37 %{?with_doc:BuildRequires:      sphinx-pdg}
38 %endif
39 BuildRequires:  rpm-pythonprov
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 Libcomps is library for structure-like manipulation with content of
44 comps XML files. Supports read/write XML file, structure(s)
45 modification.
46
47 %description -l pl.UTF-8
48 Libcomps to bibliotek do operacji strukturalnych na treści plików
49 comps XML. Obsługiwany jest odczyt i zapis pliku XML oraz modyfikacja
50 struktury.
51
52 %package devel
53 Summary:        Development files for libcomps library
54 Summary(pl.UTF-8):      Pliki programistyczne biblioteki libcomps
55 Group:          Development/Libraries
56 Requires:       %{name} = %{version}-%{release}
57 Requires:       expat-devel >= 1.95
58 Requires:       libxml2-devel >= 2.0
59
60 %description devel
61 Development files for libcomps library
62
63 %description devel -l pl.UTF-8
64 Pliki programistyczne biblioteki libcomps.
65
66 %package -n python-libcomps
67 Summary:        Python 2.x bindings for libcomps library
68 Summary(pl.UTF-8):      Wiązania Pythona 2.x do biblioteki libcomps
69 Group:          Libraries/Python
70 Requires:       %{name} = %{version}-%{release}
71
72 %description -n python-libcomps
73 Python 2.x bindings for libcomps library.
74
75 %description -n python-libcomps -l pl.UTF-8
76 Wiązania Pythona 2.x do biblioteki libcomps.
77
78 %package -n python3-libcomps
79 Summary:        Python 3.x bindings for libcomps library
80 Summary(pl.UTF-8):      Wiązania Pythona 3.x do biblioteki libcomps
81 Group:          Libraries/Python
82 Requires:       %{name} = %{version}-%{release}
83
84 %description -n python3-libcomps
85 Python 3.x bindings for libcomps library.
86
87 %description -n python3-libcomps -l pl.UTF-8
88 Wiązania Pythona 3.x do biblioteki libcomps.
89
90 %prep
91 %setup -qn %{name}-%{name}-%{version}
92 %patch0 -p1
93 %patch1 -p1
94
95 %build
96 install -d build
97 cd build
98 %cmake ../libcomps \
99         -DENABLE_TESTS:BOOL=NO \
100         -DPYTHON_DESIRED:STRING=2 \
101         -DPYTHON_INSTALL_DIR="%{py_sitedir}" \
102         -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-2 \
103         -DCMAKE_CXX_COMPILER_WORKS=1 \
104         -DCMAKE_CXX_COMPILER="%{__cc}"
105
106 %{__make}
107 %{__make} docs
108 %{__make} pydocs
109 cd ..
110
111 %if %{with python3}
112 install -d build-py3
113 cd build-py3
114 %cmake ../libcomps \
115         -DENABLE_TESTS:BOOL=NO \
116         -DPYTHON_DESIRED:STRING=3 \
117         -DPYTHON_INSTALL_DIR="%{py3_sitedir}" \
118         -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \
119         -DCMAKE_CXX_COMPILER_WORKS=1 \
120         -DCMAKE_CXX_COMPILER="%{__cc}"
121
122 %{__make}
123 %{__make} pydocs
124 cd ..
125 %endif
126
127 %if %{with tests}
128 %{__make} -C build test
129 %if %{with python3}
130 %{__make} -C build-py3 pytest
131 %endif
132 %endif
133
134 %install
135 rm -rf $RPM_BUILD_ROOT
136 %{__make} -C build install \
137         DESTDIR=$RPM_BUILD_ROOT
138
139 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
140 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
141 %py_postclean
142
143 %if %{with python3}
144 %{__make} -C build-py3 install \
145         DESTDIR=$RPM_BUILD_ROOT
146
147 %py3_ocomp $RPM_BUILD_ROOT%{py3_sitedir}
148 %py3_comp $RPM_BUILD_ROOT%{py3_sitedir}
149 %endif
150
151 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
152 %{__sed} -e 's,^prefix=.*,prefix=%{_prefix},' \
153         -e 's,@LIB_SUFFIX@,%{_lib},' \
154         -e 's,@VERSION@,%{version},' \
155         libcomps.pc.in > $RPM_BUILD_ROOT%{_pkgconfigdir}/libcomps.pc
156
157 /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
158
159 %clean
160 rm -rf $RPM_BUILD_ROOT
161
162 %post   -p /sbin/ldconfig
163 %postun -p /sbin/ldconfig
164
165 %files
166 %defattr(644,root,root,755)
167 %doc README.md COPYING
168 %attr(755,root,root) %{_libdir}/libcomps.so.0
169
170 %files devel
171 %defattr(644,root,root,755)
172 %doc build/docs/libcomps-doc/html/*
173 %attr(755,root,root) %{_libdir}/libcomps.so
174 %{_includedir}/libcomps
175 %{_pkgconfigdir}/libcomps.pc
176
177 %if %{with python2}
178 %files -n python-libcomps
179 %defattr(644,root,root,755)
180 %doc build/src/python/docs/html/{*.html,*.js,_static}
181 %dir %{py_sitedir}/libcomps
182 %{py_sitedir}/libcomps/__init__.py[co]
183 %attr(755,root,root) %{py_sitedir}/libcomps/_libpycomps.so
184 %{py_sitedir}/libcomps-*-py*.egg-info
185 %endif
186
187 %if %{with python3}
188 %files -n python3-libcomps
189 %doc build-py3/src/python/docs/html/{*.html,*.js,_static}
190 %defattr(644,root,root,755)
191 %dir %{py3_sitedir}/libcomps
192 %{py3_sitedir}/libcomps/__init__.py
193 %attr(755,root,root) %{py3_sitedir}/libcomps/_libpycomps.so
194 %{py3_sitedir}/libcomps/__pycache__
195 %{py3_sitedir}/libcomps-*-py*.egg-info
196 %endif
This page took 0.06279 seconds and 3 git commands to generate.