File libsolv.spec of Package libsolv

#
# spec file for package libsolv
#
# 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/
#

Name:           libsolv
Version:        0.7.4
Release:        0
Url:            git://gitorious.org/opensuse/libsolv.git
Source:         libsolv-%{version}.tar.bz2
Patch0:		disable_demo.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build


%if 0%{?rhel_version} == 700
BuildRequires:  libdb-devel
%else
%if 0%{?fedora_version} || 0%{?rhel_version} >= 500 || 0%{?centos_version} >= 600
BuildRequires:  db4-devel
%endif
%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
BuildRequires:  gcc-c++
BuildRequires:  rpm-devel
BuildRequires:  zlib-devel

Summary:        A new approach to package dependency solving
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++

%description
A new approach to package dependency solving

%package devel
Summary:        A new approach to package dependency solving
Group:          Development/Libraries/C and C++
Requires:       rpm-devel
Conflicts:      libsatsolver-devel

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

%package tools
Summary:        A new approach to package dependency solving
Group:          Development/Libraries/C and C++
Obsoletes:      satsolver-tools < 0.18
Provides:       satsolver-tools = 0.18
Conflicts:      satsolver-tools-obsolete
Requires:       gzip bzip2 coreutils findutils

%description tools
A new approach to package dependency solving.

%prep
%setup -n libsolv-%{version}
%patch0

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

CMAKE_FLAGS=
%if 0%{?fedora_version} || 0%{?rhel_version} >= 500 || 0%{?centos_version} >= 600
CMAKE_FLAGS="-DFEDORA=1 -DENABLE_APPDATA=1"
%endif
%if 0%{?suse_version}
CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=1"
%endif

cmake   $CMAKE_FLAGS \
	-DCMAKE_INSTALL_PREFIX=%{_prefix} \
	-DLIB=%{_lib} \
	-DCMAKE_VERBOSE_MAKEFILE=TRUE \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
	-DENABLE_STATIC=1 -DDISABLE_SHARED=1 \
	-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1 \
	-DUSE_VENDORDIRS=1 \
	-DCMAKE_SKIP_RPATH=1
make %{?jobs:-j %jobs}

%install
make DESTDIR=$RPM_BUILD_ROOT install
# we want to leave the .a file untouched
export NO_BRP_STRIP_DEBUG=true

%clean
rm -rf "$RPM_BUILD_ROOT"

%files tools
%defattr(-,root,root)
%if 0%{?suse_version}
%exclude %{_bindir}/helix2solv
%endif
%{_bindir}/*

%files devel
%defattr(-,root,root)
%{_libdir}/libsolv.a
%{_libdir}/libsolvext.a
%{_includedir}/solv
%if 0%{?suse_version}
%{_bindir}/helix2solv
%endif
%{_datadir}/cmake/Modules/*
%{_libdir}/pkgconfig/libsolv*.pc
%{_mandir}/man?/*

%changelog
openSUSE Build Service is sponsored by