File satsolver-bindings.spec of Package satsolver-bindings
#
# spec file for package satsolver-bindings
#
# Copyright (c) 2012 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/
#
%define run_testsuite 1
Name: satsolver-bindings
Version: 0.45.0
Release: 0
Url: http://github.com/openSUSE/sat-solver-bindings
Source: satsolver-bindings-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Placeholder for subpackages of satsolver-bindings
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Prefix: /usr
BuildRequires: doxygen
BuildRequires: libsatsolver-devel
%if 0%{?mandriva_version}
# force this version on mandriva
BuildRequires: libneon0.26-devel
%endif
%if 0%{?fedora_version}
BuildRequires: db4-devel
BuildRequires: perl-devel
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: ruby
%if 0%{?fedora_version} || 0%{?rhel_version} > 500 || 0%{?centos_version} > 500
BuildRequires: ruby-rdoc
%endif
%endif
%if 0%{?suse_version}
BuildRequires: pkg-config
%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
BuildRequires: gcc-c++
BuildRequires: perl
BuildRequires: python-devel
BuildRequires: rpm-devel
BuildRequires: ruby-devel
BuildRequires: swig
BuildRequires: zlib-devel
# the testsuite uses the check framework
BuildRequires: check-devel
# add macros if not already defined
%{!?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_sitelib: %global ruby_sitelib %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"] ')}
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"] ')}
%description
This is not a package but a .spec placeholder fo subpackages of
satsolver-bindings.
%package -n libsatsolverapp0
Summary: Sat-solver application layer
Group: Development/Libraries/C and C++
%description -n libsatsolverapp0
An application layer to make using satsolver easier for developers.
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
%package -n libsatsolverapp0-devel
Summary: Sat-solver application layer
Group: Development/Libraries/C and C++
Requires: libsatsolverapp0 = %version
%description -n libsatsolverapp0-devel
Development files for libsatsolverapp
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
%package -n ruby-satsolver
Summary: Ruby bindings for sat solver
Group: Development/Languages/Ruby
%description -n ruby-satsolver
Ruby bindings for sat solver.
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
Duncan Mac-Vicar P. <dmacvicar@suse.de>
%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.
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
Duncan Mac-Vicar P. <dmacvicar@suse.de>
%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.
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
Duncan Mac-Vicar P. <dmacvicar@suse.de>
Bernhard Wiedemann <bwiedemann@suse.de>
%package -n satsolver-bindings-devel
Requires: %{name}-devel
Requires: swig
Summary: Swig input files for satsolver bindings
Group: Development/Libraries/Other
%description -n satsolver-bindings-devel
The Swig input files for satsolver bindings allow for reuse of the
bindings concept in other projects, i.e. libzypp-bindings.
Authors:
--------
Klaus Kaempf <kkaempf@suse.de>
%prep
%setup -n %{name}-%{version}
%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$CFLAGS"
CMAKE_FLAGS=
%if 0%{?fedora_version}
CMAKE_FLAGS="-DFEDORA=1"
%endif
# Hack for distributions not defining SATSOLVER_VERSION
%if 0%{?suse_version} == 1110 && 0%{?sles_version} == 0
CMAKE_FLAGS="-DSATSOLVER_VERSION=1110"
%endif
rm -rf build
mkdir build
cd build
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}
CTEST_OUTPUT_ON_FAILURE=1 make test
%endif
%install
cd build
make DESTDIR=$RPM_BUILD_ROOT install
# we want to leave the .a file untouched
export NO_BRP_STRIP_DEBUG=true
%if 0%{?suse_version} > 1020 && 0%{?suse_version} < 1220
%fdupes -s build/bindings/ruby/html
%endif
cd ..
%clean
rm -rf "$RPM_BUILD_ROOT"
%files -n libsatsolverapp0
%defattr(-,root,root)
%doc LICENSE* README
%files -n libsatsolverapp0-devel
%defattr(-,root,root)
%_libdir/libsatsolverapp.a
%dir /usr/include/satsolver-app
/usr/include/satsolver-app/*
%files -n ruby-satsolver
%defattr(-,root,root,-)
# SUSE
%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
# Mandriva
%if 0%{?mandriva_version}
%dir %{ruby_sitelibdir}/satsolver
%{ruby_sitelibdir}/satsolver/*.rb
%{ruby_sitelibdir}/satsolver.rb
%{ruby_sitearchdir}/satsolver.so
%endif
# Fedora/RHEL/Centos
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%dir %{ruby_sitelib}/satsolver
%{ruby_sitelib}/satsolver.rb
%{ruby_sitelib}/satsolver/*.rb
%{ruby_sitearch}/satsolver.so
%endif
# rdoc-swig doesn't work with Ruby 1.8.1 on RHEL4
%if 0%{?rhel_version} == 0 || 0%{?rhel_version} >= 500
%if 0%{?suse_version} == 0 || 0%{?suse_version} < 1220
%doc build/bindings/ruby/html
%endif
%endif
%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
%files -n satsolver-bindings-devel
%defattr(-,root,root,-)
%dir %{prefix}/share/satsolver-bindings
%{prefix}/share/satsolver-bindings/*.i
%{prefix}/share/satsolver-bindings/*.h
%changelog