Add ENABLE_COMPLEX_DEPS flag
[platform/upstream/libsolv.git] / packaging / libsolv.spec
1 Name:           libsolv
2 Version:        0.7.27
3 Release:        0
4 Url:            https://github.com/openSUSE/libsolv
5 License:        BSD-3-Clause
6 Source:         libsolv-%{version}.tar.bz2
7 Source10:           add_pie_compile_option.patch
8 Source1001:     libsolv.manifest
9 Summary:        A new approach to package dependency solving
10 Group:          System/Package Management
11
12 BuildRequires:  db4-devel
13 BuildRequires:  expat-devel
14 BuildRequires:  fdupes
15 BuildRequires:  cmake
16 BuildRequires:  gcc-c++
17 BuildRequires:  rpm-devel
18 BuildRequires:  zlib-devel
19
20 %bcond_without enable_static
21 %bcond_without perl_binding
22 %bcond_without python_binding
23
24 %if %{with perl_binding}
25 BuildRequires:  perl
26 BuildRequires:  swig
27 %endif
28 %if %{with python_binding}
29 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
30 BuildRequires:  python-devel
31 BuildRequires:  swig
32 %endif
33
34 %description
35 A new approach to package dependency solving.
36
37 %package devel
38 Summary:        A new approach to package dependency solving
39 Group:          Development/Libraries
40 Requires:       libsolv-tools = %version
41 Requires:       libsolv = %version
42 Requires:       rpm-devel
43
44 %description devel
45 Development files for libsolv, a new approach to package dependency solving
46
47 %package tools
48 Summary:        A new approach to package dependency solving
49 Group:          Development/Libraries
50 Obsoletes:      satsolver-tools < 0.18
51 Provides:       satsolver-tools = 0.18
52 Requires:       gzip bzip2 coreutils findutils
53
54 %description tools
55 A new approach to package dependency solving.
56
57 %package -n python-solv
58 Requires:       python
59 Summary:        Python bindings for the libsolv library
60 Group:          Platfrom Development/Python
61
62 %description -n python-solv
63 Python bindings for sat solver.
64
65 %package -n perl-solv
66 Requires:       perl = %{perl_version}
67 Summary:        Perl bindings for the libsolv library
68 Group:          Platfrom Development/Perl
69
70 %description -n perl-solv
71 Perl bindings for sat solver.
72
73 %prep
74 %setup -n libsolv-%{version}
75 cp %{SOURCE1001} .
76 %{__patch} -p1 < %{SOURCE10}
77
78 %build
79 export CFLAGS="$RPM_OPT_FLAGS"
80 export CXXFLAGS="$CFLAGS"
81
82 CMAKE_FLAGS=
83 CMAKE_FLAGS="-DSUSE=1"
84
85 cmake   $CMAKE_FLAGS \
86         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
87         -DLIB=%{_lib} \
88         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
89         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
90         %{?with_enable_static:-DENABLE_STATIC=1} \
91         %{?with_perl_binding:-DENABLE_PERL=1} \
92         %{?with_python_binding:-DENABLE_PYTHON=1} \
93     -DENABLE_COMPLEX_DEPS=1 \
94         -DUSE_VENDORDIRS=1 \
95         -DCMAKE_SKIP_RPATH=1
96 make %{?jobs:-j %jobs}
97
98 %install
99 make DESTDIR=$RPM_BUILD_ROOT install
100 %if %{with python_binding}
101 pushd $RPM_BUILD_ROOT/%{python_sitearch}
102 python %py_libdir/py_compile.py *.py
103 python -O %py_libdir/py_compile.py *.py
104 popd
105 %endif
106 install -D -m0755 examples/repo2solv.sh %{buildroot}%{_bindir}
107
108 %remove_docs
109 # we want to leave the .a file untouched
110 export NO_BRP_STRIP_DEBUG=true
111
112 %post  -p /sbin/ldconfig
113
114 %postun  -p /sbin/ldconfig
115
116 %files
117 %manifest %{name}.manifest
118 %license LICENSE.BSD
119 %{_libdir}/libsolv.so.*
120 %{_libdir}/libsolvext.so.*
121
122 %files tools
123 %manifest %{name}.manifest
124 %license LICENSE.BSD
125 %{_bindir}/solv
126 %{_bindir}/*
127
128 %files devel
129 %manifest %{name}.manifest
130 %license LICENSE.BSD
131 %{_libdir}/pkgconfig/libsolv.pc
132 %{_libdir}/pkgconfig/libsolvext.pc
133 %if %{with enable_static}
134 %{_libdir}/libsolv.a
135 %{_libdir}/libsolvext.a
136 %endif
137 %if !%{with disable_shared}
138 %{_libdir}/libsolv.so
139 %{_libdir}/libsolvext.so
140 %endif
141 %{_includedir}/solv
142 %{_datadir}/cmake/Modules/*
143
144 %if %{with perl_binding}
145 %files -n perl-solv
146 %manifest %{name}.manifest
147 %license LICENSE.BSD
148 %{perl_vendorarch}/*
149 %endif
150
151 %if %{with python_binding}
152 %files -n python-solv
153 %manifest %{name}.manifest
154 %license LICENSE.BSD
155 %{python_sitearch}/*
156 %endif