File libalfont2.spec of Package libalfont2

%define _name  alfont
%define soname 2

Name:           lib%{_name}%{soname}
Version:        2.0.9
Release:        0
Summary:        Font rendering library for the Allegro game library
License:        FTL
Group:          System Environment/Libraries
URL:            http://chernsha.sitesled.com/
# http://chernsha.sitesled.com/AlFont209.rar
Source0:        AlFont209.tar.bz2
Patch0:         %{name}-%{version}-segfault.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  liballeg-devel freetype2-devel

%description
%{_name} also known as AllegroFont or AlFont is a wrapper around the freetype2
library for use with the Allegro game library. Thus allowing the display of
text using freetype fonts on Allegro bitmaps.

%package -n lib%{_name}-devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}

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

%prep
%setup -q -n %{_name}
%patch0
%{__rm} -rf freetype
%{__rm} -rf libiconv
%{__rm} -f include/iconv.h  include/libcharset.h
iconv -f WINDOWS-1252 -t UTF-8 -o docs/FTL.txt.UTF-8 docs/FTL.txt && \
%{__mv} -f docs/FTL.txt.UTF-8 docs/FTL.txt
sed -i '/^#define ALFONT_WINDOWS/ d' include/%{_name}.h
sed -i 's/_msize/malloc_usable_size/g' src/%{_name}.c

%build
# Stupid Makefile...
export CFLAGS="-fPIC -DPIC %{optflags} -DALFONT_LINUX -fomit-frame-pointer \
    -finline-functions -ffast-math -Iinclude $(allegro-config --cflags) \
    $(freetype-config --cflags)"
export LDFLAGS="$(allegro-config --libs) $(freetype-config --libs)"
gcc $CFLAGS -o src/%{_name}.o -c src/%{_name}.c    
gcc $CFLAGS -shared -Wl,-soname,lib%{_name}.so.2 -o lib%{_name}.so.%{version} \
    src/%{_name}.o $LDFLAGS

%install
%{__install} -d -m 0755 '%{buildroot}%{_libdir}'
%{__install} -d -m 0755 '%{buildroot}%{_includedir}'
%{__install} -p -m 0644 lib%{_name}.so.%{version} '%{buildroot}%{_libdir}'
ln -s lib%{_name}.so.%{version} '%{buildroot}%{_libdir}/lib%{_name}.so.2'
ln -s lib%{_name}.so.%{version} '%{buildroot}%{_libdir}/lib%{_name}.so'
%{__install} -p -m 0644 include/%{_name}*.h '%{buildroot}%{_includedir}'

%clean
%{__rm} -rf '%{buildroot}'

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(0644, root, root, 0755)
%doc CHANGES.txt README.txt docs/AUTHORS.txt docs/FTL.txt
%{_libdir}/lib%{_name}.so.*

%files -n lib%{_name}-devel
%defattr(0644, root, root, 0755)
%doc docs/ALFONT.txt
%{_includedir}/%{_name}*.h
%{_libdir}/lib%{_name}.so

%changelog
* Mon Mar 30 2009 - cmorve69@yahoo.es
- Initial package
openSUSE Build Service is sponsored by