File linenoise.spec of Package linenoise

%define sover 0
Name: linenoise
%define libname lib%name
Version: 1.0
Release: 3
Summary: A minimal, zero-config, readline replacement
License: BSD-2-Clause
Group: Development/Libraries/C and C++
Url: https://github.com/antirez/%name
Source: %name-%version.tar.gz
Patch0: %name-1.0-git.patch
Patch1: fix-type-ppc.patch
Patch2: rest-arguments.diff
Patch3: %name-1.0-fix-includes.patch

%description
Guerrilla line editing library against the idea that a line editing lib needs to
be 20,000 lines of C code


%package -n %libname%sover
Summary: A minimal, zero-config, readline replacement
Group: System/Libraries
Provides: %libname = %version-%release

%description -n %libname%sover
Guerrilla line editing library against the idea that a line editing
lib needs to be 20,000 lines of C code. This is the runtime library.


%package devel
Summary: A minimal, zero-config, readline replacement
Group: Development/Libraries/C and C++
Requires: %libname = %version-%release

%description devel
Guerrilla line editing library against the idea that a line editing lib needs to
be 20,000 lines of C code.
This devel package contains the actual linenoise stuff, it's distributed as .c
and .h, the lib is built by your humble packager.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2
%patch3 -p1


%build
%__cc \
%if 0%{?suse_version} > 1320
	-D_DEFAULT_SOURCE=1 \
%else
	-D_BSD_SOURCE=1 \
%endif
	%optflags -std=c99 -pedantic -W -Wextra -Werror -fPIC -shared -Wl,-soname,%libname.so.%sover -flto \
	-o %libname.so.%sover.0.0 %name.c


%install
install -d -m 0755 %buildroot%_includedir %buildroot%_libdir
install -p -m 0644 %name.h %buildroot%_includedir/
install -p -m 0755 %libname.so.%sover.0.0 %buildroot%_libdir/
ln -sf %libname.so.%sover.0.0 %buildroot%_libdir/%libname.so.%sover
ln -sf %libname.so.%sover.0.0 %buildroot%_libdir/%libname.so
install -pD -m 0644 README.m* %buildroot%_docdir/%name/README.md
install -p -m 0644 example.c %buildroot%_docdir/%name/


%post -n %libname%sover -p /sbin/ldconfig

%postun -n %libname%sover -p /sbin/ldconfig


%files -n %{libname}%{sover}
%defattr(-,root,root,-)
%_libdir/*.so.*


%files devel
%defattr(-,root,root,-)
%doc %_docdir/%name
%_includedir/*
%_libdir/*.so


%changelog
openSUSE Build Service is sponsored by