File libalfont.spec of Package libalfont
#
# spec file for package libalfont
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define _name alfont
%define soname 2
Name: libalfont
Version: 2.0.9
Release: 1
Summary: Font rendering library for the Allegro game library
License: FTL
Group: System/Libraries
Url: http://opensnc.sourceforge.net/alfont/
Source0: AlFont209.tar.bz2
Source1: alfont.c
BuildRequires: freetype2-devel
BuildRequires: liballeg-devel
%description
AllegroFont also known as AlFont is an Allegro wrapper for the FreeType2
library that makes Allegro (amongst other things) able to load and render
TTF and many other famous font formats. Other feature is that it is able
to render the fonts antialiased.
%package -n %{name}%{soname}
Summary: Library files for alfont
%description -n %{name}%{soname}
The libalfont2 package contains libraries for libalfont.
%package devel
Summary: Development files for alfont
Group: Development/Libraries/C and C++
Requires: %{name}%{soname} = %{version}
%description devel
The libalfont-devel package contains libraries and header files for
developing applications that use libalfont.
%prep
%setup -q -n %{_name}
cp -af %{S:1} src
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
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,%{name}.so.2 -o %{name}.so.%{version} \
src/%{_name}.o $LDFLAGS
%install
install -d -m 0755 '%{buildroot}%{_libdir}'
install -d -m 0755 '%{buildroot}%{_includedir}'
install -p -m 0644 %{name}.so.%{version} '%{buildroot}%{_libdir}'
ln -s %{name}.so.%{version} '%{buildroot}%{_libdir}/%{name}.so.2'
ln -s %{name}.so.%{version} '%{buildroot}%{_libdir}/%{name}.so'
install -p -m 0644 include/%{_name}*.h '%{buildroot}%{_includedir}'
%post -n %{name}%{soname} -p /sbin/ldconfig
%postun -n %{name}%{soname} -p /sbin/ldconfig
%files -n %{name}%{soname}
%defattr(-,root,root,-)
%{_libdir}/%{name}.so.*
%files devel
%defattr(-,root,root,-)
%doc CHANGES.txt README.txt docs
%{_includedir}/%{_name}*.h
%{_libdir}/%{name}.so
%changelog