]> git.pld-linux.org Git - packages/libcomps.git/blob - libcomps.spec
be9ac9dcb15db4878e5d4303136312747ee46084
[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.8
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:  0461077e6720ea206af8d8bae004a0b7
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         -DPYTHON_DESIRED:STRING=2 \
100         -DPYTHON_INSTALL_DIR="%{py_sitedir}" \
101         -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-2 \
102         -DCMAKE_CXX_COMPILER_WORKS=1 \
103         -DCMAKE_CXX_COMPILER="%{__cc}"
104
105 %{__make}
106 %{__make} docs
107 %{__make} pydocs
108 cd ..
109
110 %if %{with python3}
111 install -d build-py3
112 cd build-py3
113 %cmake ../libcomps \
114         -DPYTHON_DESIRED:STRING=3 \
115         -DPYTHON_INSTALL_DIR="%{py3_sitedir}" \
116         -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \
117         -DCMAKE_CXX_COMPILER_WORKS=1 \
118         -DCMAKE_CXX_COMPILER="%{__cc}"
119
120 %{__make}
121 %{__make} pydocs
122 cd ..
123 %endif
124
125 %if %{with tests}
126 %{__make} -C build test
127 %if %{with python3}
128 %{__make} -C build-py3 pytest
129 %endif
130 %endif
131
132 %install
133 rm -rf $RPM_BUILD_ROOT
134 %{__make} -C build install \
135         DESTDIR=$RPM_BUILD_ROOT
136
137 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
138 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
139 %py_postclean
140
141 %if %{with python3}
142 %{__make} -C build-py3 install \
143         DESTDIR=$RPM_BUILD_ROOT
144
145 %py3_ocomp $RPM_BUILD_ROOT%{py3_sitedir}
146 %py3_comp $RPM_BUILD_ROOT%{py3_sitedir}
147 %endif
148
149 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
150 %{__sed} -e 's,^prefix=.*,prefix=%{_prefix},' \
151         -e 's,@LIB_SUFFIX@,%{_lib},' \
152         -e 's,@VERSION@,%{version},' \
153         libcomps.pc.in > $RPM_BUILD_ROOT%{_pkgconfigdir}/libcomps.pc
154
155 /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
156
157 %clean
158 rm -rf $RPM_BUILD_ROOT
159
160 %post   -p /sbin/ldconfig
161 %postun -p /sbin/ldconfig
162
163 %files
164 %defattr(644,root,root,755)
165 %doc README.md COPYING
166 %attr(755,root,root) %{_libdir}/libcomps.so.0.1.6
167
168 %files devel
169 %defattr(644,root,root,755)
170 %doc build/docs/libcomps-doc/html/*
171 %attr(755,root,root) %{_libdir}/libcomps.so
172 %{_includedir}/libcomps
173 %{_pkgconfigdir}/libcomps.pc
174
175 %if %{with python2}
176 %files -n python-libcomps
177 %defattr(644,root,root,755)
178 %doc build/src/python/docs/html/{*.html,*.js,_images,_static}
179 %dir %{py_sitedir}/libcomps
180 %{py_sitedir}/libcomps/__init__.py[co]
181 %attr(755,root,root) %{py_sitedir}/libcomps/_libpycomps.so
182 %endif
183
184 %if %{with python3}
185 %files -n python3-libcomps
186 %doc build-py3/src/python/docs/html/{*.html,*.js,_images,_static}
187 %defattr(644,root,root,755)
188 %dir %{py3_sitedir}/libcomps
189 %{py3_sitedir}/libcomps/__init__.py
190 %attr(755,root,root) %{py3_sitedir}/libcomps/_libpycomps.so
191 %{py3_sitedir}/libcomps/__pycache__
192 %endif
This page took 0.144654 seconds and 2 git commands to generate.