]> git.pld-linux.org Git - packages/libcomps.git/blob - libcomps.spec
8f1f71f5696bf10487fa87228e05b9fe530807fa
[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.11
15 Release:        1
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:  e63cf17441e1c7e167405e364fd52fdd
21 Patch0:         %{name}-build.patch
22 Patch1:         python-install-dir.patch
23 Patch2:         python-3.8.patch
24 URL:            https://github.com/rpm-software-management/libcomps
25 BuildRequires:  check-devel
26 BuildRequires:  cmake >= 2.6
27 %{?with_doc:BuildRequires:      doxygen}
28 BuildRequires:  expat-devel >= 1.95
29 BuildRequires:  libxml2-devel >= 2.0
30 %if %{with python2}
31 BuildRequires:  python-devel
32 BuildRequires:  python-modules
33 %{?with_doc:BuildRequires:      sphinx-pdg-2}
34 %endif
35 %if %{with python3}
36 BuildRequires:  python3-devel
37 BuildRequires:  python3-modules
38 %{?with_doc:BuildRequires:      sphinx-pdg}
39 %endif
40 BuildRequires:  rpm-pythonprov
41 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42
43 %description
44 Libcomps is library for structure-like manipulation with content of
45 comps XML files. Supports read/write XML file, structure(s)
46 modification.
47
48 %description -l pl.UTF-8
49 Libcomps to bibliotek do operacji strukturalnych na treści plików
50 comps XML. Obsługiwany jest odczyt i zapis pliku XML oraz modyfikacja
51 struktury.
52
53 %package devel
54 Summary:        Development files for libcomps library
55 Summary(pl.UTF-8):      Pliki programistyczne biblioteki libcomps
56 Group:          Development/Libraries
57 Requires:       %{name} = %{version}-%{release}
58 Requires:       expat-devel >= 1.95
59 Requires:       libxml2-devel >= 2.0
60
61 %description devel
62 Development files for libcomps library
63
64 %description devel -l pl.UTF-8
65 Pliki programistyczne biblioteki libcomps.
66
67 %package -n python-libcomps
68 Summary:        Python 2.x bindings for libcomps library
69 Summary(pl.UTF-8):      Wiązania Pythona 2.x do biblioteki libcomps
70 Group:          Libraries/Python
71 Requires:       %{name} = %{version}-%{release}
72
73 %description -n python-libcomps
74 Python 2.x bindings for libcomps library.
75
76 %description -n python-libcomps -l pl.UTF-8
77 Wiązania Pythona 2.x do biblioteki libcomps.
78
79 %package -n python3-libcomps
80 Summary:        Python 3.x bindings for libcomps library
81 Summary(pl.UTF-8):      Wiązania Pythona 3.x do biblioteki libcomps
82 Group:          Libraries/Python
83 Requires:       %{name} = %{version}-%{release}
84
85 %description -n python3-libcomps
86 Python 3.x bindings for libcomps library.
87
88 %description -n python3-libcomps -l pl.UTF-8
89 Wiązania Pythona 3.x do biblioteki libcomps.
90
91 %prep
92 %setup -qn %{name}-%{name}-%{version}
93 %patch0 -p1
94 %patch1 -p1
95 %patch2 -p1
96
97 %build
98 install -d build
99 cd build
100 %cmake ../libcomps \
101         -DPYTHON_DESIRED:STRING=2 \
102         -DPYTHON_INSTALL_DIR="%{py_sitedir}" \
103         -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-2 \
104         -DCMAKE_CXX_COMPILER_WORKS=1 \
105         -DCMAKE_CXX_COMPILER="%{__cc}"
106
107 %{__make}
108 %{__make} docs
109 %{__make} pydocs
110 cd ..
111
112 %if %{with python3}
113 install -d build-py3
114 cd build-py3
115 %cmake ../libcomps \
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.1.11
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 %endif
185
186 %if %{with python3}
187 %files -n python3-libcomps
188 %doc build-py3/src/python/docs/html/{*.html,*.js,_static}
189 %defattr(644,root,root,755)
190 %dir %{py3_sitedir}/libcomps
191 %{py3_sitedir}/libcomps/__init__.py
192 %attr(755,root,root) %{py3_sitedir}/libcomps/_libpycomps.so
193 %{py3_sitedir}/libcomps/__pycache__
194 %endif
This page took 0.120374 seconds and 2 git commands to generate.