File ohcount.spec of Package ohcount

#
# spec file for package ohcount
#
# Copyright (c) 2013 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:           ohcount
%define lname	libohcount
Version:        3.0.0.g312
Release:        0
# git-describe:	2.0.1-312-g4fb66a8
Url:            http://ohloh.net/p/ohcount
Summary:        The Ohloh source code line counter
License:        GPL-2.0
Group:          Development/Tools/Other

# http://sourceforge.net/projects/ohcount/files/ is no longer updated it seems.
#Git-Clone:	git://github.com/blackducksw/ohcount
Source:         %name-%version.tar.xz
Patch1:         cflags.diff
Patch2:         shared.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bash
BuildRequires:  file-devel
BuildRequires:  gcc >= 4.1.2
BuildRequires:  gperf
BuildRequires:  pcre-devel
BuildRequires:  pkg-config
BuildRequires:  ragel >= 6.3
BuildRequires:  ruby-devel
BuildRequires:  swig
BuildRequires:  xz
BuildRequires:  pkgconfig(ruby-1.9)

%description
Ohcount supports over 70 popular programming languages, and has been
used to count over 6 billion lines of code by 300,000 developers.
Ohcount does more more than just count lines of code. It can also
detect popular open source licenses such as GPL within a large
directory of source code. It can also detect code that targets a
particular programming API, such as Win32 or KDE.

%package -n %lname
Summary:        Ohcount source code analyzer library
Group:          System/Libraries

%description -n %lname
The core parsing library for the Ohcount source code analyzer program
and for its ruby bindings.

%prep
%setup -qn %name
%patch -P 1 -P 2 -p1

%build
export CFLAGS="%optflags $(pkg-config ruby-2.0 --cflags)";
export SHARED="-Wl,-soname,libohcount.so";
./build ohcount;

%install
b="%buildroot";
mkdir -p "$b/%_bindir" "$b/%_libdir";
install -pm0755 bin/ohcount "$b/%_bindir/";
install -pm0755 src/libohcount*.so "$b/%_libdir/";

%post   -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc COPYING
%_bindir/ohcount

%files -n %lname
%defattr(-,root,root)
%_libdir/libohcount.so

%changelog
openSUSE Build Service is sponsored by