c13f0f
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
c13f0f
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')}
c13f0f
c13f0f
c13f0f
Name:		stfl
c13f0f
Version:	0.21
c13f0f
Release:	7%{?dist}
c13f0f
Summary:	The Structured Terminal Forms Language/Library
c13f0f
c13f0f
Group:		System Environment/Libraries
c13f0f
License:	LGPLv3+
c13f0f
URL:		http://www.clifford.at/stfl/
c13f0f
Source0:	http://www.clifford.at/stfl/%{name}-%{version}.tar.gz
c13f0f
c13f0f
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
c13f0f
c13f0f
BuildRequires:	ncurses-devel
c13f0f
BuildRequires:	swig
c13f0f
BuildRequires:	perl-devel
c13f0f
BuildRequires:	python-devel
c13f0f
BuildRequires:	ruby, ruby-devel
c13f0f
c13f0f
%description
c13f0f
STFL is a library which implements a curses-based widget set for text
c13f0f
terminals.
c13f0f
c13f0f
c13f0f
%package	devel
c13f0f
Summary:	Development files for %{name}
c13f0f
Group:		Development/Libraries
c13f0f
Requires:	%{name} = %{version}-%{release}
c13f0f
Requires:	pkgconfig
c13f0f
c13f0f
%description	devel
c13f0f
The %{name}-devel package contains libraries and header files for
c13f0f
developing applications that use %{name}.
c13f0f
c13f0f
c13f0f
%package	perl
c13f0f
Summary:	Perl binding for STFL
c13f0f
Group:		Development/Libraries
c13f0f
Requires:	%{name} = %{version}-%{release}
c13f0f
Requires:	perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
c13f0f
c13f0f
%description	perl
c13f0f
Perl binding for STFL
c13f0f
c13f0f
c13f0f
%package	python
c13f0f
Summary:	Python binding for STFL
c13f0f
Group:		Development/Libraries
c13f0f
Requires:	%{name} = %{version}-%{release}
c13f0f
c13f0f
%description	python
c13f0f
Python binding for STFL.
c13f0f
c13f0f
c13f0f
%package	ruby
c13f0f
Summary:	Ruby binding for STFL
c13f0f
Group:		Development/Libraries
c13f0f
Requires:	%{name} = %{version}-%{release}
c13f0f
Requires:	ruby(abi) = 1.8
c13f0f
c13f0f
%description	ruby
c13f0f
Ruby binding for STFL.
c13f0f
c13f0f
c13f0f
%prep
c13f0f
%setup -q
c13f0f
## ensures that _stfl.so doesn't end up in lib-dynload
c13f0f
## - http://www.rocklinux.net/pipermail/stfl/2009-June/000113.html
c13f0f
sed -i.path \
c13f0f
 -e '/mkdir.*lib-dynload/d' \
c13f0f
 -e '/cp/s|lib-dynload||' \
c13f0f
 python/Makefile.*
c13f0f
## creates an soname symlink for the shared library
c13f0f
## - http://www.rocklinux.net/pipermail/stfl/2009-June/000114.html
c13f0f
## add the new line needed (the part starting with \n) If you know a better way with sed to do it, please educate me
c13f0f
sed -i.soname \
c13f0f
 -e 's|\(.*ln -fs.*/\)\(libstfl\.so\)$|\1\2\n\1\$(SONAME)|' \
c13f0f
 Makefile
c13f0f
## fixes undefined-non-weak-symbol rpmlint warnings
c13f0f
## - http://www.rocklinux.net/pipermail/stfl/2009-October/000116.html
c13f0f
sed -i.ldflags -e 's|\(-shared\)|\1 \$(LDLIBS)|' Makefile
c13f0f
## fixes libdir for other arch than x86 
c13f0f
## - http://www.rocklinux.net/pipermail/stfl/2009-October/000118.html
c13f0f
sed -i.path -e 's|libdir=.*|libdir=%{_libdir}|' stfl.pc.in
c13f0f
sed -i.cflags -e 's|-Os||' Makefile
c13f0f
c13f0f
%build
c13f0f
# building with smp flags causes random failures
c13f0f
export CFLAGS="%{optflags}"
c13f0f
make prefix=%{_prefix} libdir=%{_lib}
c13f0f
c13f0f
c13f0f
%install
c13f0f
rm -rf %{buildroot}
c13f0f
make install prefix=%{_prefix} libdir=%{_lib} DESTDIR=%{buildroot}
c13f0f
# give the shared libraries executable permissions so they get stripped
c13f0f
# also fixes the 0555 permissions on the perl bindings
c13f0f
find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
c13f0f
# perl ignores empty .bs files
c13f0f
find %{buildroot} -name '*.bs' -size 0c -exec rm -f {} ';'
c13f0f
# fedora doesn't ship static libraries
c13f0f
rm -f %{buildroot}%{_libdir}/libstfl.a
c13f0f
## remove unneeded files
c13f0f
rm -f %{buildroot}%{perl_vendorarch}/example.pl
c13f0f
rm -f %{buildroot}%{perl_vendorarch}/auto/stfl/.packlist
c13f0f
rm -f %{buildroot}%{perl_archlib}/perllocal.pod
c13f0f
c13f0f
%clean
c13f0f
rm -rf %{buildroot}
c13f0f
c13f0f
c13f0f
%post -p /sbin/ldconfig
c13f0f
c13f0f
c13f0f
%postun -p /sbin/ldconfig
c13f0f
c13f0f
c13f0f
%files
c13f0f
%defattr(-,root,root,-)
c13f0f
%doc README COPYING
c13f0f
%{_libdir}/*.so.*
c13f0f
c13f0f
%files devel
c13f0f
%defattr(-,root,root,-)
c13f0f
%{_includedir}/*
c13f0f
%{_libdir}/*.so
c13f0f
%{_libdir}/pkgconfig/stfl.pc
c13f0f
c13f0f
%files perl
c13f0f
%defattr(-,root,root,-)
c13f0f
%dir %{perl_vendorarch}/auto/stfl
c13f0f
%{perl_vendorarch}/*.pm
c13f0f
%{perl_vendorarch}/auto/stfl/*
c13f0f
c13f0f
%files python
c13f0f
%defattr(-,root,root,-)
c13f0f
%{python_sitearch}/stfl.py*
c13f0f
%{python_sitearch}/_stfl.so
c13f0f
c13f0f
%files ruby
c13f0f
%defattr(-,root,root,-)
c13f0f
%{ruby_sitearch}/stfl.so
c13f0f
c13f0f
%changelog
c13f0f
* Tue Oct 20 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-7
c13f0f
- Removed empty %%doc
c13f0f
- Changed sed commands
c13f0f
c13f0f
* Tue Oct 06 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-6
c13f0f
- Changed CFLAGS again
c13f0f
c13f0f
* Tue Oct 06 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-5
c13f0f
- Better use of sed
c13f0f
- Fixed CFLAGS
c13f0f
- Use of rm instead of exclude
c13f0f
- Removed empty doc
c13f0f
c13f0f
* Mon Oct 05 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-4
c13f0f
- Removed unneeded requires
c13f0f
- Removed dupe docs
c13f0f
- removed patches and make use of sed
c13f0f
- fixed stfl.pc.in for x86_64
c13f0f
c13f0f
* Fri Oct 02 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-3
c13f0f
- fixed installed rpmlint output
c13f0f
c13f0f
* Fri Oct 02 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.21-2
c13f0f
- Added Requires: pkgconfig
c13f0f
- Mentioned to upstream the rpmlint warnings
c13f0f
- http://www.rocklinux.net/pipermail/stfl/2009-October/000115.html
c13f0f
- Minor spec changes
c13f0f
c13f0f
* Sun Jun 28 2009 Byron Clark <byron@theclarkfamily.name> 0.21-1
c13f0f
- New upstream release
c13f0f
- Stop placing _stfl.so in lib-dynload
c13f0f
- Add patch to properly create soname symlink for shared lib.
c13f0f
c13f0f
* Wed Jun 10 2009 Byron Clark <byron@theclarkfamily.name> 0.20-5
c13f0f
- Stop using both python_sitelib and python_sitearch
c13f0f
- Modify stfl-pythonpaths.patch to only use python_sitearch
c13f0f
c13f0f
* Sat Jun 6 2009 Byron Clark <byron@theclarkfamily.name> 0.20-4
c13f0f
- Don't explicitly require python and perl
c13f0f
c13f0f
* Thu May 21 2009 Byron Clark <byron@theclarkfamily.name> 0.20-3
c13f0f
- Use the patches that have been sent upstream
c13f0f
c13f0f
* Thu May 21 2009 Byron Clark <byron@theclarkfamily.name> 0.20-2
c13f0f
- Add the minimal docs
c13f0f
c13f0f
* Thu May 21 2009 Byron Clark <byron@theclarkfamily.name> 0.20-1
c13f0f
- Initial release