File libsatsolver.spec of Package libsatsolver.import4938

#
# spec file for package libsatsolver
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%if 0%{?fedora_version}
%{!?ruby_sitelib: %global ruby_sitelib %(ruby -rrbconfig -e 'puts Config::CONFIG["sitelibdir"] ')}
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')}
%endif

Name:           libsatsolver
Version:        0.16.3
Release:        0.<RELEASE2>
License:        BSD 3-Clause
Url:            git://git.opensuse.org/projects/zypp/sat-solver.git
Source:         satsolver-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Group:          Development/Libraries/C and C++
Prefix:         /usr

BuildRequires:  doxygen
%if 0%{?mandriva_version}
# force this version on mandriva
BuildRequires:  libneon0.26-devel
%endif
%if 0%{?fedora_version}
BuildRequires:  db4-devel perl-devel ruby ruby-rdoc
%endif
%if 0%{?suse_version}
%if 0%{?suse_version} < 1030
BuildRequires:  expat
%else
BuildRequires:  libexpat-devel
%endif
%if 0%{?suse_version} < 1100
BuildRequires:  graphviz
%endif
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
%endif
%else
BuildRequires:  expat-devel
%endif
BuildRequires:  cmake gcc-c++ perl python-devel rpm-devel ruby-devel swig
BuildRequires:  zlib-devel
# the testsuite uses the check framework
BuildRequires:  check-devel
Summary:        A new approach to package dependency solving

#define some macros missing on fedora
%if 0%{?fedora_version}
%{!?py_sitedir: %define py_sitedir %(%__python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?py_requires: %define py_requires Requires: python}
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')}
%endif

%description
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>

%package devel

Summary:        A new approach to package dependency solving
Group:          Development/Libraries/C and C++
Requires:       satsolver-tools = %version
Requires:       rpm-devel

#%package devel-doc
#Summary:        satsolver developer documentation
#Group:          Documentation/HTML

%description devel
Development files for satsolver, a new approach to package dependency solving

#%description devel-doc
#Developer documentation for satsolver, 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>

%package -n satsolver-tools

Summary:        A new approach to package dependency solving
Group:          Development/Libraries/C and C++
Obsoletes:      libsatsolver <= 0.0.15
Provides:       libsatsolver = %{version}-%{release}
Requires:       gzip bzip2 coreutils

%description -n satsolver-tools
A new approach to package dependency solving.

%package demo

Summary:        Applications demoing the satsolver library
Group:          System/Management
Requires:       curl
%if 0%{?fedora_version}
Requires:       gnupg2
%endif
%if 0%{?suse_version}
Requires:       gpg2
%endif

%description demo
Applications demoing the satsolver library.

%package -n ruby-satsolver

Summary:        Ruby bindings for sat solver
Group:          Development/Languages/Ruby

%description -n ruby-satsolver
Ruby bindings for sat solver.

%package -n python-satsolver

%py_requires
Summary:        Python bindings for sat solver
Group:          Development/Languages/Python

%description -n python-satsolver
Python bindings for sat solver.

%package -n perl-satsolver

Requires:       perl = %{perl_version}
Summary:        Perl bindings for sat solver
Group:          Development/Languages/Perl

%description -n perl-satsolver
Perl bindings for sat solver.


%prep
%setup -n satsolver-%{version}

%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$CFLAGS"

CMAKE_FLAGS=
%if 0%{?fedora_version}
CMAKE_FLAGS="-DFEDORA=1"
%endif

cmake   $CMAKE_FLAGS \
	-DCMAKE_INSTALL_PREFIX=%{_prefix} \
	-DPYTHON_SITEDIR=%{py_sitedir} \
	-DLIB=%{_lib} \
	-DCMAKE_VERBOSE_MAKEFILE=TRUE \
	-DCMAKE_BUILD_TYPE=Release \
	-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
# we want to leave the .a file untouched
export NO_BRP_STRIP_DEBUG=true
#pushd doc/autodoc
#make install
#popd
%if 0%{?suse_version} > 1020
# create symlinks for documentation
#%fdupes -s %{buildroot}%{_docdir}/ruby-satsolver
%fdupes -s bindings/ruby/html
%endif

%clean
rm -rf "$RPM_BUILD_ROOT"

%files -n satsolver-tools
%defattr(-,root,root)
%doc LICENSE*
%exclude /usr/bin/deptestomatic
%exclude /usr/bin/helix2solv
%exclude /usr/bin/solv
/usr/bin/*

%files devel
%defattr(-,root,root)
%_libdir/libsatsolver.a
%_libdir/libsatsolverext.a
%_libdir/libappsatsolver.a
%dir /usr/include/satsolver
/usr/include/satsolver/*
/usr/bin/deptestomatic
/usr/bin/helix2solv

%files demo
%defattr(-,root,root)
/usr/bin/solv

#%files devel-doc
#%defattr(-,root,root)
#%dir %_docdir/satsolver
#%_docdir/satsolver/*

%files -n ruby-satsolver
%defattr(-,root,root,-)
%if 0%{?suse_version}
%if 0%{?suse_version} < 1010
%dir %{_libdir}/ruby/site_ruby/%{rb_ver}/%{rb_arch}
%dir %{_libdir}/ruby/site_ruby/%{rb_ver}/satsolver
%{_libdir}/ruby/site_ruby/%{rb_ver}/satsolver/*.rb
%{_libdir}/ruby/site_ruby/%{rb_ver}/satsolver.rb
%{_libdir}/ruby/site_ruby/%{rb_ver}/%{rb_arch}/satsolver.so
%else
%dir %{_libdir}/ruby/vendor_ruby/%{rb_ver}/satsolver
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/satsolver/*.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/satsolver.rb
%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/satsolver.so
%endif
%endif
%if 0%{?mandriva_version}
%dir %{ruby_sitelibdir}/satsolver
%{ruby_sitelibdir}/satsolver/*.rb
%{ruby_sitelibdir}/satsolver.rb
%{ruby_sitearchdir}/satsolver.so
%endif
%if 0%{?fedora_version}
%dir %{ruby_sitelib}/satsolver
%{ruby_sitelib}/satsolver.rb
%{ruby_sitelib}/satsolver/*.rb
%{ruby_sitearch}/satsolver.so
%endif
%doc bindings/ruby/html

%files -n python-satsolver
%defattr(-,root,root,-)
#%doc swig/python/examples/*.py
%{py_sitedir}/_satsolver.so
%{py_sitedir}/satsolver.py*

%files -n perl-satsolver
%defattr(-,root,root,-)
%{perl_vendorarch}/satsolver.so
%{perl_vendorlib}/satsolver.pm

%changelog