Build static per default.
[platform/upstream/libsolv.git] / package / libsolv.spec.in
index e80f3cc..8d73267 100644 (file)
@@ -2,19 +2,24 @@ Name:           libsolv
 Version:        @VERSION@
 Release:        1
 License:        BSD 3-Clause
-Url:            git://gitorious.org/opensuse/sat-solver.git
+Url:            git://gitorious.org/opensuse/libsolv.git
 Source:         libsolv-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Group:          Development/Libraries/C and C++
 Prefix:         /usr
 
-BuildRequires:  doxygen
+%bcond_without enable_static
+%bcond_without disable_shared
+%bcond_without perl_binding
+%bcond_without python_binding
+%bcond_without ruby_binding
+
 %if 0%{?mandriva_version}
 # force this version on mandriva
 BuildRequires:  libneon0.26-devel
 %endif
 %if 0%{?fedora_version}
-BuildRequires:  db4-devel ruby ruby-rdoc
+BuildRequires:  db4-devel
 %endif
 %if 0%{?suse_version}
 %if 0%{?suse_version} < 1030
@@ -33,12 +38,29 @@ BuildRequires:  expat-devel
 %endif
 BuildRequires:  cmake rpm-devel gcc-c++
 BuildRequires:  zlib-devel
-# the testsuite uses the check framework
-%if 0%{?suse_version} >= 1030 || !0%{?suse_version}
-BuildRequires:  check-devel
+
+%if %{with perl_binding}
+BuildRequires: perl
+%if 0%{?fedora_version}
+BuildRequires: perl-devel
+%endif
+BuildRequires: swig
+%endif
+%if %{with ruby_binding}
+%if 0%{?fedora_version}
+%global ruby_vendorarch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')
 %else
-BuildRequires:  check
+%global ruby_vendorarch %(ruby -rrbconfig -e 'puts Config::CONFIG["vendorarchdir"]')
+%endif
+BuildRequires: ruby ruby-devel
+BuildRequires: swig
 %endif
+%if %{with python_binding}
+%global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
+BuildRequires: python-devel
+BuildRequires: swig
+%endif
+
 Summary:        A new approach to package dependency solving
 
 
@@ -53,16 +75,35 @@ Authors:
     Michael Matz <matz@suse.de>
     Duncan Mac-Vicar P. <dmacvicar@suse.de>
 
+%if !%{with disable_shared}
+%package -n libsolv@LIBSOLV_SOVERSION@
+Summary:        A new approach to package dependency solving
+Group:          Development/Libraries/C and C++
+
+%description -n libsolv@LIBSOLV_SOVERSION@
+A new approach to package dependency solving
+
+Authors:
+--------
+    Michael Schroeder <mls@suse.de>
+    Klaus Kaempf <kkaempf@suse.de>
+    Stephan Kulow <coolo@suse.de>
+    Michael Matz <matz@suse.de>
+    Duncan Mac-Vicar P. <dmacvicar@suse.de>
+
+%endif
 %package devel
 Summary:        A new approach to package dependency solving
 Group:          Development/Libraries/C and C++
 Requires:       libsolv-tools = %version
+%if !%{with disable_shared}
+Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
+%endif
 Requires:       rpm-devel
 
 %description devel
 Development files for libsolv, a new approach to package dependency solving
 
-
 Authors:
 --------
     Michael Schroeder <mls@suse.de>
@@ -95,6 +136,31 @@ Requires:       gpg2
 %description demo
 Applications demoing the libsolv library.
 
+%package -n ruby-solv
+Summary:        Ruby bindings for the libsolv library
+Group:          Development/Languages/Ruby
+
+%description -n ruby-solv
+Ruby bindings for sat solver.
+
+%package -n python-solv
+%if 0%{?py_requires:1}
+%py_requires
+%endif
+Summary:        Python bindings for the libsolv library
+Group:          Development/Languages/Python
+
+%description -n python-solv
+Python bindings for sat solver.
+
+%package -n perl-solv
+Requires:       perl = %{perl_version}
+Summary:        Perl bindings for the libsolv library
+Group:          Development/Languages/Perl
+
+%description -n perl-solv
+Perl bindings for sat solver.
+
 %prep
 %setup -n libsolv-%{version}
 
@@ -106,55 +172,83 @@ CMAKE_FLAGS=
 %if 0%{?fedora_version}
 CMAKE_FLAGS="-DFEDORA=1"
 %endif
-# Where does RHEL provide qsort_r ?
-%if 0%{?rhel_version} > 0 || 0%{?centos_version} > 0
-export CFLAGS="$RPM_OPT_FLAGS -DUSE_OWN_QSORT=1"
-%endif
 
 cmake   $CMAKE_FLAGS \
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DLIB=%{_lib} \
        -DCMAKE_VERBOSE_MAKEFILE=TRUE \
        -DCMAKE_BUILD_TYPE=Release \
-       -DCMAKE_SKIP_RPATH=1 
+       %{?with_enable_static:-DENABLE_STATIC=1} \
+       %{?with_disable_shared:-DDISABLE_SHARED=1} \
+       %{?with_perl_binding:-DENABLE_PERL=1} \
+       %{?with_python_binding:-DENABLE_PYTHON=1} \
+       %{?with_ruby_binding:-DENABLE_RUBY=1} \
+       -DUSE_VENDORDIRS=1 \
+       -DCMAKE_SKIP_RPATH=1
 make %{?jobs:-j %jobs}
-make doc_forced
-
-%if 0%{?run_testsuite}
-  ln -s . build
-  ctest .
-%endif
 
 %install
 make DESTDIR=$RPM_BUILD_ROOT install
+%if %{with python_binding}
+%if 0%{?suse_version}
+pushd $RPM_BUILD_ROOT/%{python_sitearch}
+python %py_libdir/py_compile.py *.py
+python -O %py_libdir/py_compile.py *.py
+popd
+%endif
+%endif
 # we want to leave the .a file untouched
 export NO_BRP_STRIP_DEBUG=true
-#pushd doc/autodoc
-#make install
-#popd
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
 
-%files tools
+%if !%{with disable_shared}
+%post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
+
+%postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
+
+%files -n libsolv@LIBSOLV_SOVERSION@
 %defattr(-,root,root)
 %doc LICENSE*
-%exclude /usr/bin/deptestomatic
-%exclude /usr/bin/helix2solv
-%exclude /usr/bin/solv
-/usr/bin/*
+%{_libdir}/libsolv.so.*
+%{_libdir}/libsolvext.so.*
+%endif
+
+%files tools
+%defattr(-,root,root)
+%exclude %{_bindir}/helix2solv
+%exclude %{_bindir}/solv
+%{_bindir}/*
 
 %files devel
 %defattr(-,root,root)
-%_libdir/libsolv.a
-%_libdir/libsolvext.a
-%dir /usr/include/libsolv
-/usr/include/libsolv/*
-/usr/bin/deptestomatic
-/usr/bin/helix2solv
+%{_libdir}/libsolv.so
+%{_libdir}/libsolvext.so
+%{_includedir}/solv
+%{_bindir}/helix2solv
+%{_datadir}/cmake/Modules/*
 
 %files demo
 %defattr(-,root,root)
-/usr/bin/solv
+%{_bindir}/solv
+
+%if %{with perl_binding}
+%files -n perl-solv
+%defattr(-,root,root)
+%{perl_vendorarch}/*
+%endif
+
+%if %{with ruby_binding}
+%files -n ruby-solv
+%defattr(-,root,root)
+%{ruby_vendorarch}/*
+%endif
+
+%if %{with python_binding}
+%files -n python-solv
+%defattr(-,root,root)
+%{python_sitearch}/*
+%endif
 
 %changelog