File libwiiuse0.spec of Package wiiuse

%define soname 0

Name:           libwiiuse%{soname}
Version:        0.12
Release:        1%{?dist}
Summary:        Connects with several Nintendo Wii remotes

Group:          Development/Libraries/C and C++
License:        GPL-3.0-only
URL:            http://wiiuse.sourceforge.net/
Source0:        wiiuse_v0.12_src.tar.gz
Patch0:		wiiuse-0.12-destdir.patch
Patch1:         wiiuse-0.12-arraysubscript.patch
Patch2:		wiiuse-0.12-example-libs.patch
Patch3:		wiiuse-0.12-example-sdl.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  bluez-devel libSDL-devel freeglut-devel dos2unix
# Requires:       

%description

Wiiuse is a library written in C that connects with several Nintendo
Wii remotes.  Supports motion sensing, IR tracking, nunchuk, classic
controller, and the Guitar Hero 3 controller.  Single threaded and
nonblocking makes a light weight and clean API.

%package -n     libwiiuse-devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}
Requires:	bluez-devel

%description  -n     libwiiuse-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -q -n wiiuse_v0.12
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build

make -C src %{?_smp_mflags} LDFLAGS="-Wl,-soname,libwiiuse.so.%{soname} -shared -lm -lbluetooth" CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -funroll-loops"
make -C example-sdl mkdir
make -C example %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
make -C example-sdl %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"


%install
install -d %{buildroot}%{_includedir}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_libdir}
make install DESTDIR=%{buildroot} LIBDIR=%{_libdir}
find %{buildroot} -name '*.la' -exec rm -f {} ';'
strip  %{buildroot}%{_bindir}/wiiuse-example
strip  %{buildroot}%{_bindir}/wiiuse-sdl
strip  %{buildroot}%{_libdir}/libwiiuse.so
mv %{buildroot}%{_libdir}/libwiiuse.so %{buildroot}%{_libdir}/libwiiuse.so.0
(cd %{buildroot}%{_libdir} && \
    ln -s libwiiuse.so.0 libwiiuse.so )
dos2unix README
dos2unix CHANGELOG

%clean
rm -rf %{buildroot}


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc README LICENSE LICENSE_noncommercial CHANGELOG
%{_libdir}/*.so.*

%files -n libwiiuse-devel
%defattr(-,root,root,-)
%doc
%{_includedir}/*
%{_libdir}/*.so
%{_bindir}/wiiuse-example
%{_bindir}/wiiuse-sdl

%changelog
openSUSE Build Service is sponsored by