File fpc.spec of Package fpc
# Set this flag to 1 if you need a precompiled binary of the compiler
# to build this package
%if 0%{?suse_version} || 0%{?mandriva_version} || 0%{?rhel} || 1
%define _useprebuiltcompiler 1
%else
%define _useprebuiltcompiler 0
%endif
Name: fpc
Version: 3.2.2
Release: 1
Summary: Free Pascal Compiler
Group: Development/Languages
License: GPL and modified LGPL
URL: http://www.freepascal.org/
Source0: %{name}_%{version}.orig.tar.gz
# This is only needed when _useprebuiltcompiler is defined.
# But it's not in an 'if defined' block, since the file has to be included in the srpm
# Thus you should enable this line when useprebuildcompiler is defined for any target
%if "%{_useprebuiltcompiler}" == "1"
Source1: %{name}-3.2.0.compiler.bin.tar.bz2
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#Requires: gpm, gpm-devel, glibc, ncurses, binutils
Requires: glibc, binutils
#BuildRequires: tetex, tetex-latex, tetex-fonts, binutils, gpm-devel, glibc-devel
BuildRequires: binutils, glibc-devel
%if "%{_useprebuiltcompiler}" == "0"
BuildRequires: fpc = 3.2.0
%endif
%description
Freepascal is a free 32/64bit Pascal Compiler. It comes with a run-time
library fully compatible with Turbo Pascal 7.0 and nearly Delphi compatible.
Some extensions are added to the language, like function overloading. Shared
libraries can be linked. This package contains commandline compiler and
utils. Provided units are the runtime library (RTL), free component library
(FCL) and bindings for among others gtk1, gtk2, ncurses, zlib, mysql, postgres
and ibase.
#%package doc
#Summary: Free Pascal Compiler - documentation and examples
#Group: Development/Languages
#
#%description doc
#
#The fpc-doc package contains the documentation (in pdf format) and examples
#of Freepascal.
%package src
Summary: Free Pascal Compiler - sources
Group: Development/Languages
%description src
The fpc-doc package contains the sources of Freepascal, for documentation or
automatical-code generation purposes.
%ifarch aarch64
%define ppcname ppca64
%else
%ifarch x86_64
%define ppcname ppcx64
%else
%define ppcname ppc386
%endif
%endif
%prep
%if "%{_useprebuiltcompiler}" == "1"
%setup -q -n %{name}-%{version} -a1
%else
%setup -q -n %{name}-%{version}
%endif
%build
# The source-files:
mkdir -p fpcsrc
cp -a rtl fpcsrc/
cp -a packages fpcsrc/
rm -rf packages/extra/amunits
rm -rf packages/extra/winunits
%if "%{_useprebuiltcompiler}" == "1"
STARTPP=`pwd`/startcompiler/%{ppcname}
%else
STARTPP=`which %{ppcname}`
%endif
make clean all FPC=${STARTPP}
# disable the debuginfo package
%define debug_package %{nil}
%define __spec_install_post /usr/lib/rpm/brp-compress
%install
rm -rf %{buildroot}
NEWPP=`pwd`/compiler/%{ppcname}
FPCARCH=`${NEWPP} -iTP`
FPCVERSION=`${NEWPP} -iV`
FPCFULLVERSION=`${NEWPP} -iW`
DATA2INC=`pwd`/utils/bin/${FPCARCH}-linux/data2inc
FPCMAKE=`pwd`/utils/fpcm/bin/${FPCARCH}-linux/fpcmake
INSTALLOPTS="FPC=${NEWPP} FPCMAKE=${FPCMAKE} DATA2INC=${DATA2INC} \
INSTALL_PREFIX=%{buildroot}%{_prefix} \
INSTALL_LIBDIR=%{buildroot}%{_libdir} \
INSTALL_BASEDIR=%{buildroot}%{_libdir}/%{name}/${FPCVERSION} \
CODPATH=%{buildroot}%{_libdir}/%{name}/lexyacc \
INSTALL_DOCDIR=%{buildroot}%{_defaultdocdir}/%{name}-${FPCVERSION} \
INSTALL_BINDIR=%{buildroot}%{_bindir}
INSTALL_EXAMPLEDIR=%{buildroot}%{_defaultdocdir}/%{name}-${FPCVERSION}/examples"
make compiler_install ${INSTALLOPTS}
make rtl_install ${INSTALLOPTS}
make packages_install ${INSTALLOPTS}
make utils_install ${INSTALLOPTS}
# create link
ln -sf ../%{_lib}/%{name}/${FPCVERSION}/%{ppcname} %{buildroot}%{_bindir}/%{ppcname}
# The source-files:
mkdir -p %{buildroot}%{_datadir}/fpcsrc
cp -a fpcsrc/* %{buildroot}%{_datadir}/fpcsrc/
# Workaround:
# newer rpm versions do not allow garbage
# delete lexyacc
rm -rf %{buildroot}/usr/lib/%{name}/lexyacc
rm -rf %{buildroot}%{_libdir}/%{name}/lexyacc
# Workaround: we do not install documentation
rm -rf %{buildroot}/usr/share/doc/%{name}-${FPCVERSION}
%clean
rm -rf %{buildroot}
%post
# Create a version independent config
%define fpcversion %{version}
%{_libdir}/%{name}/%{fpcversion}/samplecfg %{_libdir}/%{name}/%{fpcversion} > /dev/null
%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/%{name}
%{_libdir}/libpas2jslib.so
%files src
%defattr(-,root,root,-)
%{_datadir}/fpcsrc
%changelog
* Sat Oct 01 2011 Alexander Koblov <alexx2000@mail.ru> 2.4.4-1
- Update to version 2.4.4
- Merge changes from Toni Graffy <toni@links2linux.de>
* Thu Jul 28 2005 Joost van der Sluis <joost@cnoc.nl> 2.0.0-1
- Added some requirements
- Added COPYING-info to %%doc