File xwiimote-bindings.spec of Package xwiimote-bindings

%define xwiimote_bind xwiimote

Name:       xwiimote-bindings
Version:	1
Release:	1
License:	MIT
Summary:	Provides bindings for the xwiimote library for languages other than C
Url:		http://pingus.seul.org/~grumbel/xboxdrv
Group:		Hardware/Joystick
Source:		%{name}-%{version}.tar.gz
Packager:  	Ivan Gonzalez
#BuildRequires:	build, make, autoconf, automake, libudev1, ncurses, libtool, libudev-devel, ncurses-devel, pkgconfig, libncurses5, chrpath
BuildRequires:	build, make, autoconf, automake, libtool, pkgconfig, chrpath, xwiimote, swig, python, python-devel
BuildRequires:	python-base, python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Requires:	xwiimote
Requires:	python

%description
xwiimote-bindings provides bindings for the xwiimote library for languages
other than C. You need to install xwiimote before you can use xwiimote-bindings.

%prep
%setup -q -n %{name}-%{version}

%build
export XWIIMOTE_CFLAGS="-I/usr/include/xwiimote"
export XWIIMOTE_LIBS="-L/usr/lib/libxwiimote"
./autogen.sh --prefix=%{buildroot}/usr --with-perl-options='INSTALLDIRS=vendor'
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
C_INCLUDE_PATH=/usr/include/python2.7
export C_INCLUDE_PATH
make

%install
make install
#Remove files
#rm %{buildroot}/%{python_sitelib}/%{xwiimote_bind}.pyc
#Recompile pyc
# temp hack to fix rpmlint file-contains-buildroot for *.pyc
# http://lists.opensuse.org/opensuse-factory/2012-01/msg00235.html
find "%{buildroot}/%{python_sitearch}/" -name '*.pyc' -delete
%__python -c 'import compileall; compileall.compile_dir("%{buildroot}%{python_sitearch}/", ddir="%{python_sitearch}/", force=1)'

# perl: cleanup various perl tempfiles from the build which get installed
find %{buildroot} -name "*.bs" |xargs rm -f
find %{buildroot} -name ".packlist" |xargs rm -f
find %{buildroot} -name "perllocal.pod" |xargs rm -f
#Folders
install -d %{buildroot}/%{perl_vendorlib}
cp -a %{buildroot}/%{perl_sitelib} %{buildroot}/%{perl_vendorlib}
rm -R %{buildroot}/%{perl_sitelib}
%perl_process_packlist
%perl_gen_filelist
echo finish install

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

#%post -p /sbin/ldconfig
#%postun -p /sbin/ldconfig

%files -f %{name}.files
%defattr(-,root,root)
#python
%{python_sitearch}/_%{xwiimote_bind}.so
%{python_sitearch}/%{xwiimote_bind}.py
%{python_sitearch}/%{xwiimote_bind}.pyc
%{python_sitearch}/%{xwiimote_bind}-%{version}-py%{py_ver}.egg-info

%changelog
* Wed Nov 05 2014 Ivan Gonzalez <cain1986@gmail.com> 2
- First package version
openSUSE Build Service is sponsored by