File libcidr.spec of Package libcidr

#
# spec file for package 
#
# Copyright (c) 2014 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:           libcidr
Version:        1.2.3
Release:        0
License:        BSD-2-Clause
Summary:        CIDR manipulating library
Url:            https://www.over-yonder.net/~fullermd/projects/libcidr
Group:          Development/Libraries/C and C++
Source:         https://www.over-yonder.net/~fullermd/projects/%{name}/%{name}-%{version}.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  xz

%description
This is libcidr, a library to handle manipulating CIDR netblocks in IPv4 and
IPv6 in a host of ways.  It's useful for parsing textual representations of
addresses and blocks, comparing blocks in various ways, and outputting them in
different formats.

%package devel
Summary:        Development files for %{name}
Group:          Development/Languages/C and C++
Requires:       %{name}0 = %{version}

%description devel
CIDR manipulating library. This package contains shared library, include file and manual page.

%package -n cidrcalc
Summary:    CIDR calculator based on %{name}
Group:          Development/Languages/C and C++

%description -n cidrcalc
CIDR manipulating library. This package containst cidrcalc tool.

%package -n %{name}0
Summary:        Shared library for %{name}
Group:          Development/Languages/C and C++

%description -n %{name}0
CIDR manipulating library. This package contains shared library.

%prep
%setup -q

%build
export CFLAGS="%{optflags}"
# make PREFIX=/usr did not worked to me
sed -i \
 -e 's@^PREFIX.*@PREFIX=%{_prefix}@' \
 -e 's@^CIDR_LIBDIR.*@CIDR_LIBDIR=%{_libdir}@' \
 -e 's@CIDR_MANDIR=.*@CIDR_MANDIR=%{_mandir}@' \
 -e 's@CIDR_DOCDIR=.*@CIDR_DOCDIR=%{_defaultdocdir}/%{name}@' \
 GNUmakefile.inc
make %{_smp_mflags}

%install
%make_install
mkdir -p %{buildroot}/%{_mandir}/man3/
mv  %{buildroot}/%{_prefix}/man/man3/ \
    %{buildroot}/%{_mandir}/
rm -rf %{buildroot}/%{_prefix}/man/

#remove docs and examples
rm -rf %{buildroot}/%{_prefix}/share/%{name}

%post -n %{name}0 -p /sbin/ldconfig

%postun -n %{name}0 -p /sbin/ldconfig

%files -n cidrcalc
%defattr(-,root,root)
%doc RELNOTES LICENSE README
%{_bindir}/cidrcalc

%files -n %{name}0
%defattr(-,root,root)
%attr(0755,root,root) %{_libdir}/%{name}.so.0

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}.h
%{_libdir}/%{name}.so
%{_mandir}/man3/%{name}.3*

%changelog

openSUSE Build Service is sponsored by