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
Source0:        AlFont209.tar.bz2
Patch0:         %{name}-%{version}-segfault.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  liballeg-devel freetype2-devel

%{_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}.

%setup -q -n %{_name}
%{__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

# 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} -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}'

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

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%defattr(0644, root, root, 0755)
%doc CHANGES.txt README.txt docs/AUTHORS.txt docs/FTL.txt

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

* Mon Mar 30 2009 -
- Initial package
openSUSE Build Service is sponsored by