File libustr.spec of Package libustr

#
# spec file for package libustr
#
# 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:           libustr
Version:        1.0.4
Release:        0
Url:            http://www.and.org/ustr/
Summary:        String library, very low memory overhead, simple to import
License:        MIT or LGPL-2.1+ or BSD-2-Clause
Group:          Development/Libraries/C and C++
Source:         http://www.and.org/ustr/%{version}/ustr-%{version}.tar.bz2
Source1:        rpmlintrc
Source2:        baselibs.conf
Patch0:         %{name}-%{version}-c99-inline.patch
Patch1:         libustr-warning.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkg-config

%description
Micro string library, very low overhead from plain strdup() (Ave. 44% for
0-20B strings). Very easy to use in existing C code. At it's simplest you can
just include a single header file into your .c and start using it.
This package also distributes pre-built shared libraries.

%package -n libustr-1_0-1
Summary:        String library, very low memory overhead, simple to import
Group:          System/Libraries

%description -n libustr-1_0-1
Micro string library, very low overhead from plain strdup() (Ave. 44%
for 0-20B strings). Very easy to use in existing C code. At it's
simplest you can just include a single header file into your .c and
start using it. This package also distributes pre-built shared
libraries.

%package devel
Summary:        Development files for libustr
Group:          Development/Libraries/C and C++
Requires:       libustr-1_0-1 = %{version}
Requires:       pkgconfig

%description devel
Header files for the Ustr string library, and the .so to link with.
Also includes a %{name}.pc file for pkg-config usage.
Includes the ustr-import tool, for if you just want to include
the code in your projects ... you don't have to link to the shared lib.

%package devel-static
Summary:        Static development files for libustr
Group:          Development/Libraries
Requires:       %{name}-devel

%description devel-static
Static library for the Ustr string library.

%prep
%setup -q -n ustr-%{version}
%patch0
%patch1 -p1

%build
make all-shared %{?_smp_mflags} HIDE= CFLAGS="%optflags -fPIC" CC="%{__cc} -std=gnu89"

%check
%if !0%{?qemu_user_space_build:1}
# bad interaction with qemu (2011-10-02)
make check %{?_smp_mflags} HIDE= CFLAGS="%optflags -fPIC"
%endif

%install
make install-multilib-linux \
    prefix=%{_prefix} \
    bindir=%{_bindir} \
    mandir=%{_mandir} \
    datadir=%{_datadir} \
    libdir=/%{_lib} \
    includedir=%{_includedir} \
    libexecdir=%{_libexecdir} \
    DESTDIR=$RPM_BUILD_ROOT \
    LDCONFIG=/bin/true \
    HIDE=
rm -f $RPM_BUILD_ROOT/%{_lib}/*.so
rm -f $RPM_BUILD_ROOT/%{_lib}/{,pkgconfig}/*debug*
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mv $RPM_BUILD_ROOT/%{_lib}/pkgconfig $RPM_BUILD_ROOT/%{_libdir}
mv $RPM_BUILD_ROOT/%{_lib}/*.a $RPM_BUILD_ROOT/%{_libdir}
ln -sf  /%{_lib}/libustr-1.0.so.1 $RPM_BUILD_ROOT/%{_libdir}/libustr.so

%post -n libustr-1_0-1 -p /sbin/ldconfig

%postun -n libustr-1_0-1 -p /sbin/ldconfig

%files -n libustr-1_0-1
%defattr(-,root,root,-)
%doc ChangeLog LICENSE* README NEWS
/%{_lib}/libustr-1.0.so.*

%files devel
%defattr(-,root,root,-)
%doc README-DEVELOPERS TODO Documentation/*.html Documentation/*.gnumeric
%{_datadir}/ustr-%{version}
%{_bindir}/ustr-import
%{_libexecdir}/ustr-%{version}
%{_includedir}/ustr.h
%{_includedir}/ustr-*.h
%{_libdir}/pkgconfig/ustr.pc
%{_libdir}/libustr.so
%{_mandir}/man1/*
%{_mandir}/man3/*

%files devel-static
%defattr(-,root,root,-)
%{_libdir}/libustr.a

%changelog
openSUSE Build Service is sponsored by