#
# Conditional build:
-%bcond_without ide # build with ide
-%bcond_without doc # build without doc
+%bcond_with gdb # GDB support in FPC IDE
+%bcond_without doc # documentation
-Summary: 32-bit compiler for the i386 and m68k processors
-Summary(pl.UTF-8): 32 bitowy kompilator dla procesorów i386 i m68k
+Summary: Free Pascal - 32-bit Pascal compiler
+Summary(pl.UTF-8): Free Pascal - 32-bitowy kompilator języka Pascal
Summary(ru.UTF-8): Свободный компилятор Pascal
Summary(uk.UTF-8): Вільний компілятор Pascal
Name: fpc
-Version: 2.6.2
-Release: 7
+Version: 3.2.2
+Release: 2
License: GPL v2+
Group: Development/Languages
Source0: ftp://ftp.freepascal.org/pub/fpc/dist/%{version}/source/%{name}build-%{version}.tar.gz
-# Source0-md5: 89c7e60db6280f3d5cc006a4a9ff43a9
+# Source0-md5: 3681ae4a208be4f64ec65e832a9a702d
Source1: ftp://ftp.freepascal.org/pub/fpc/dist/%{version}/i386-linux/%{name}-%{version}.i386-linux.tar
-# Source1-md5: 3474affc41d6106c498fc5b79f883588
+# Source1-md5: 18354e51309a34b0efe7702633568a1e
Source2: ftp://ftp.freepascal.org/pub/fpc/dist/%{version}/x86_64-linux/%{name}-%{version}.x86_64-linux.tar
-# Source2-md5: c32c4c8e94aed6f84b34407e7ea84ecd
-Source3: ftp://ftp.freepascal.org/pub/fpc/dist/%{version}/powerpc-linux/%{name}-%{version}.powerpc-linux.tar
-# Source3-md5: 07f891e7552aeb21908940b05c3062a3
+# Source2-md5: 0186779de0c9caee073fc1394afbee56
Patch0: %{name}-skip-dev-dot.patch
Patch1: %{name}-link.patch
-Patch2: %{name}-gdb.patch
-Patch3: %{name}-r22920.patch
+Patch2: glibc-2.34.patch
+Patch3: dwarf-debug.patch
+Patch4: fpcdocs-r1260.patch
+Patch5: fpc-man.patch
URL: http://www.freepascal.org/
+BuildRequires: babeltrace-devel
BuildRequires: binutils-devel >= 3:2.17.50
+BuildRequires: expat-devel
BuildRequires: gpm-devel
+BuildRequires: guile-devel
+BuildRequires: libselinux-devel
BuildRequires: ncurses-devel
-BuildRequires: rpmbuild(macros) >= 1.213
-%if %{with ide}
-BuildRequires: expat-devel
-BuildRequires: gdb-lib >= 7.2-7
-BuildRequires: python-devel
BuildRequires: readline-devel
-BuildRequires: libselinux-devel
+BuildRequires: rpmbuild(macros) >= 1.213
BuildRequires: xz-devel
BuildRequires: zlib-devel
+%if %{with gdb}
+BuildRequires: gdb-lib >= 7.2-7}
+BuildRequires: python-devel
%endif
%if %{with doc}
BuildRequires: tetex-fonts-jknappen
BuildRequires: tetex-format-pdflatex
+BuildRequires: tetex-latex-imakeidx
BuildRequires: tetex-makeindex
BuildRequires: tetex-metafont
+BuildRequires: texlive-latex-enumitem
+BuildRequires: texlive-latex-ucs
+BuildRequires: texlive-tex-xkeyval
BuildRequires: texlive-xetex
%endif
Requires: binutils
Provides: fpc-bootstrap
-ExclusiveArch: %{ix86} %{x8664} ppc
+ExclusiveArch: %{ix86} %{x8664}
+# TODO:
+# %{arm} ftp://ftp.freepascal.org/pub/fpc/dist/3.0.0/arm-linux/fpc-3.0.0.arm-linux-raspberry1wq.tar
+# ppc64 ftp://ftp.freepascal.org/pub/fpc/dist/3.0.0/powerpc64-linux/fpc-3.0.0.powerpc64-linux.tar
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-Free Pascal is a 32-bit compiler for the i386 and m68k processors.
-Free Pascal is designed to be, as much as possible, source compatible
-with Turbo Pascal 7.0 and Delphi 4 (although this goal is not yet
-attained), but it also enhances these languages with elements like
-function overloading. And, unlike these ancestors, it supports
-multiple platforms.
+Free Pascal is a 32-bit Pascal compiler. Free Pascal is designed to
+be, as much as possible, source compatible with Turbo Pascal 7.0 and
+Delphi 4 (although this goal is not yet attained), but it also
+enhances these languages with elements like function overloading. And,
+unlike these ancestors, it supports multiple platforms.
%description -l pl.UTF-8
-Free Pascal to 32 bitowy kompilator dla procesorów i386 oraz m86k.
-Free Pascal został zaprojektowany by być (jak tylko to możliwe)
-kompatybilnym z Turbo Pascal 7.0 oraz Delphi 4. Free Pascal również
-rozszerza te języki elementami takimi jak przeciążanie funkcji.
+Free Pascal to 32-bitowy kompilator języka Pascal. Free Pascal został
+zaprojektowany by być (na ile to tylko możliwe) kompatybilnym z Turbo
+Pascalem 7.0 oraz Delphi 4. Free Pascal również rozszerza te języki
+elementami takimi jak przeciążanie funkcji.
%description -l ru.UTF-8
FPC -- 32-битный компилятор Pascal, совместимый с Turbo Pascal 7.0 и
(бібліотекою вільних компонент), інтерфейсами до gtk, ncurses, zlib,
mysql, postgres, ibase.
+%package ide
+Summary: Free Pascal IDE (integrated development environment)
+Summary(pl.UTF-8): Zintegrowane środowisko programistyczne (IDE) Free Pascala
+Group: Development/Tools
+Requires: %{name} = %{version}-%{release}
+
+%description ide
+Free Pascal IDE (integrated development environment).
+
+%description ide -l pl.UTF-8
+Zintegrowane środowisko programistyczne (IDE) Free Pascala.
+
%package src
Summary: Free Pascal Compiler source files
Summary(pl.UTF-8): Pliki źródłowe kompilatora Free Pascal
%setup -q -n %{name}build-%{version}
%patch0 -p1
%patch1 -p1
+cd fpcsrc
%patch2 -p1
%patch3 -p0
+cd ..
+%patch4 -p0
+%patch5 -p1
%ifarch %{ix86}
tar xf %{SOURCE1}
%define _bname x64
%define _barch x86_64
%endif
-%ifarch ppc
-tar xf %{SOURCE3}
+%ifarch %{arm}
%define _bver %{version}
+%define _bname arm
+%define _barch arm
+%endif
+%ifarch ppc
+%define _bver ?
%define _bname ppc
-%define _barch powepc
+%define _barch powerpc
+%endif
+%ifarch ppc64
+%define _bver %{version}
+%define _bname ppc64
+%define _barch powerpc64
+%endif
+%ifarch sparc sparcv9
+%define _bver ?
+%define _bname sparc
+%define _barch sparc
%endif
cd %{name}-%{version}.%{_barch}-linux
ln -sf `pwd`/lib/%{name}/%{_bver}/ppc* bin
cd ..
+find fpcsrc -name Makefile -o -name fpcmake.ini -o -name fpmkunit.pp | \
+ xargs %{__sed} -i -e 's|/usr/lib/|%{_libdir}/|g'
+
+# remove precompiled objects from fpc-src
+%{__rm} fpcsrc/rtl/palmos/m68k/{libcrt.a,*.o}
+
# save for fpc-src
install -d fpc-src
cp -af fpcsrc/* fpc-src
-rm -r fpc-src/{ide,tests}
+rm -r fpc-src/tests
%if 0%{?debug:1}
find fpcsrc -name Makefile | xargs %{__sed} -i -e 's/-Xs//'
%endif
-%build
-# use ld.bfd
-[ -d our-ld ] || install -d our-ld
-ln -sf %{_bindir}/ld.bfd our-ld/ld
-export PATH=$(pwd)/our-ld:$PATH
+%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+bash(\s|$),#!/bin/bash\1,' \
+ fpc-src/packages/fpmkunit/examples/ppu2fpmake.sh \
+ fpc-src/packages/gdbint/gen-gdblib-inc.sh \
+ fpc-src/packages/gtk2/src/gtk2x11/scripts/gdkx11_h2pas.sh \
+ fpc-src/rtl/unix/scripts/check_consts.sh \
+ fpc-src/rtl/unix/scripts/check_errno.sh \
+ fpc-src/rtl/unix/scripts/check_errnostr.sh \
+ fpc-src/rtl/unix/scripts/check_sys.sh
+%build
PP=`pwd`/bin/lib/%{name}/%{_bver}/ppc%{_bname}
NEWPP=`pwd`/fpcsrc/compiler/ppc%{_bname}
-NEWFPDOC=`pwd`/fpcsrc/utils/fpdoc/fpdoc
+NEWFPDOC=`pwd`/fpcsrc/utils/fpdoc/bin/%{_barch}-linux/fpdoc
+DATA2INC=`pwd`/fpcsrc/utils/bin/%{_barch}-linux/data2inc
+FPCSRCDIR=`pwd`/fpcsrc
# DO NOT PUT $RPM_OPT_FLAGS IN OPT, IT DOES NOT WORK - baggins
case "%{_build_cpu}" in
- i386) OPTF="-OG2p1" ;;
- i486) OPTF="-OG2p1" ;;
+ i386|i486) OPTF="-OG2p1" ;;
i586) OPTF="-OG2p2" ;;
- i686) OPTF="-Og2p3" ;;
- athlon) OPTF="-Og2p3" ;;
+ i686|athlon|pentium3|pentium4|x86_64|amd64|ia32e) OPTF="-Og2p3" ;;
*) OPTF="-O2" ;;
esac
%{__make} -C fpcsrc compiler_cycle \
- OPT="$OPTF %{!?debug:-Xs} -n" \
+ OPT="$OPTF -k--build-id -gl -gw %{!?debug:-Xs} -n" \
RELEASE="1" \
BASEINSTALLDIR=%{_libdir}/%{name}/%{version} \
BININSTALLDIR=%{_bindir} \
+ DATA2INC="$DATA2INC" \
PP="$PP" \
FPC="$PP" \
LINKSMART=YES
-%{__make} -C fpcsrc OPT="$OPTF %{!?debug:-Xs} -n" \
+%{__make} -C fpcsrc \
+ OPT="$OPTF -k--build-id -gl -gw %{!?debug:-Xs} -n" \
RELEASE="1" \
BASEINSTALLDIR=%{_libdir}/%{name}/%{version} \
BININSTALLDIR=%{_bindir} \
- GDBLIBDIR=%{_libdir} \
+ %{?with_gdb:GDBLIBDIR=%{_libdir}} \
+ %{!?with_gdb:NOGDB=YES} \
+ DATA2INC="$DATA2INC" \
PP="$NEWPP" \
FPC="$NEWPP" \
FPDOC=$NEWFPDOC \
- DATA2INC=`pwd`/utils/data2inc \
LINKSMART=YES \
NODOCS=YES \
rtl_clean \
packages_clean \
utils_clean \
- %{?with_ide: ide_clean installer_clean} \
+ installer_clean \
rtl_all \
packages_all \
- utils_all %{?with_ide:ide_all installer_all}
+ utils_all \
+ installer_all
%if %{with doc}
export save_size=10000
%{__make} -j1 -C fpcdocs \
FPDOC=$NEWFPDOC \
FPC="$NEWPP" \
+ FPCSRCDIR="$FPCSRCDIR" \
pdf
%endif
cp -af fpc-src/* $RPM_BUILD_ROOT%{_datadir}/fpcsrc
NEWPP=`pwd`/fpcsrc/compiler/ppc%{_bname}
-FPCMAKE=`pwd`/fpcsrc/utils/fpcm/fpcmake
+FPCMAKE=`pwd`/fpcsrc/utils/fpcm/bin/%{_barch}-linux/fpcmake
%{__make} -j1 -C fpcsrc \
compiler_distinstall \
rtl_distinstall \
packages_distinstall \
- %{?with_ide:ide_distinstall} \
utils_distinstall \
PP="$NEWPP" \
FPCMAKE="$FPCMAKE" \
SMARTLINK=YES \
+ FPCDIR=%{_libdir}/%{name}/%{version} \
INSTALL_PREFIX=$RPM_BUILD_ROOT%{_prefix} \
INSTALL_BINDIR=$RPM_BUILD_ROOT%{_bindir} \
INSTALL_LIBDIR=$RPM_BUILD_ROOT%{_libdir} \
ln -sf ../%{_lib}/%{name}/%{version}/ppc%{_bname} $RPM_BUILD_ROOT%{_bindir}
-ln -sf %{_bindir}/ld.bfd $RPM_BUILD_ROOT%{_libdir}/%{name}/%{version}/ld
-
sh fpc-src/compiler/utils/samplecfg $RPM_BUILD_ROOT%{_libdir}/%{name}/%{version} $RPM_BUILD_ROOT%{_sysconfdir}
%{__sed} -i -e "s,$RPM_BUILD_ROOT,,g" $RPM_BUILD_ROOT%{_sysconfdir}/{*.cfg,fppkg/default}
+%if "%{_lib}" != "lib"
+%{__mv} $RPM_BUILD_ROOT%{_prefix}/lib/%{name}/lexyacc $RPM_BUILD_ROOT%{_libdir}/%{name}
+%endif
+
+# Fix examples, make seems to ignore INSTALL_EXAMPLEDIR
+%{__mv} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/* $RPM_BUILD_ROOT%{_examplesdir}/fpc/
+
+%ifnarch %{ix86}
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/ppc386.1
+%endif
+%ifnarch %{arm}
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/ppcarm.1
+%endif
+%ifnarch ppc ppc64
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/ppcppc.1
+%endif
+%ifnarch sparc sparcv9
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/ppcsparc.1
+%endif
+%ifnarch %{x8664}
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/ppcx64.1
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/*
+%attr(755,root,root) %{_bindir}/bin2obj
+%attr(755,root,root) %{_bindir}/chmcmd
+%attr(755,root,root) %{_bindir}/chmls
+%attr(755,root,root) %{_bindir}/cldrparser
+%attr(755,root,root) %{_bindir}/compileserver
+%attr(755,root,root) %{_bindir}/data2inc
+%attr(755,root,root) %{_bindir}/delp
+%attr(755,root,root) %{_bindir}/fd2pascal
+%attr(755,root,root) %{_bindir}/fpc*
+%attr(755,root,root) %{_bindir}/fpdoc
+%attr(755,root,root) %{_bindir}/fppkg
+%attr(755,root,root) %{_bindir}/fprcp
+%attr(755,root,root) %{_bindir}/grab_vcsa
+%attr(755,root,root) %{_bindir}/h2pas
+%attr(755,root,root) %{_bindir}/h2paspp
+%attr(755,root,root) %{_bindir}/instantfpc
+%attr(755,root,root) %{_bindir}/json2pas
+%attr(755,root,root) %{_bindir}/makeskel
+%attr(755,root,root) %{_bindir}/mka64ins
+%attr(755,root,root) %{_bindir}/mkarmins
+%attr(755,root,root) %{_bindir}/mkinsadd
+%attr(755,root,root) %{_bindir}/mkx86ins
+%attr(755,root,root) %{_bindir}/pas2fpm
+%attr(755,root,root) %{_bindir}/pas2jni
+%attr(755,root,root) %{_bindir}/pas2js
+%attr(755,root,root) %{_bindir}/pas2ut
+%attr(755,root,root) %{_bindir}/plex
+%attr(755,root,root) %{_bindir}/postw32
+%attr(755,root,root) %{_bindir}/ppc%{_bname}
+%attr(755,root,root) %{_bindir}/ppdep
+%attr(755,root,root) %{_bindir}/ppudump
+%attr(755,root,root) %{_bindir}/ppufiles
+%attr(755,root,root) %{_bindir}/ppumove
+%attr(755,root,root) %{_bindir}/ptop
+%attr(755,root,root) %{_bindir}/pyacc
+%attr(755,root,root) %{_bindir}/rmcvsdir
+%attr(755,root,root) %{_bindir}/rstconv
+%attr(755,root,root) %{_bindir}/unihelper
+%attr(755,root,root) %{_bindir}/unitdiff
+%attr(755,root,root) %{_bindir}/webidl2pas
+# TODO: move the below files to data dir
+# - JSON resources(?)
+%{_bindir}/makeskel.rsj
+%{_bindir}/ptop.rsj
+%{_bindir}/pas2ut.rsj
+%{_bindir}/rstconv.rsj
+%{_bindir}/unitdiff.rsj
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fpc.cfg
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fppkg.cfg
%dir %{_sysconfdir}/fppkg
%dir %{_libdir}/%{name}/lexyacc
%{_libdir}/%{name}/%{version}/msg
%{_libdir}/%{name}/%{version}/units
-%if %{with ide}
-%{_libdir}/%{name}/%{version}/ide
-%endif
+%{_libdir}/%{name}/%{version}/fpmkinst
%{_libdir}/%{name}/lexyacc/*
-%attr(755,root,root) %{_libdir}/%{name}/%{version}/ld
%attr(755,root,root) %{_libdir}/%{name}/%{version}/ppc%{_bname}
%attr(755,root,root) %{_libdir}/%{name}/%{version}/samplecfg
-%{_mandir}/man*/*
+%attr(755,root,root) %{_libdir}/libpas2jslib.so
+%{_mandir}/man1/bin2obj.1*
+%{_mandir}/man1/chmcmd.1*
+%{_mandir}/man1/chmls.1*
+%{_mandir}/man1/data2inc.1*
+%{_mandir}/man1/delp.1*
+%{_mandir}/man1/fd2pascal.1*
+%{_mandir}/man1/fp.1*
+%{_mandir}/man1/fpc*.1*
+%{_mandir}/man1/fpdoc.1*
+%{_mandir}/man1/fppkg.1*
+%{_mandir}/man1/fprcp.1*
+%{_mandir}/man1/grab_vcsa.1*
+%{_mandir}/man1/h2pas.1*
+%{_mandir}/man1/h2paspp.1*
+%{_mandir}/man1/makeskel.1*
+%{_mandir}/man1/pas2fpm.1*
+%{_mandir}/man1/pas2jni.1*
+%{_mandir}/man1/pas2ut.1*
+%{_mandir}/man1/plex.1*
+%{_mandir}/man1/postw32.1*
+%ifarch ppc64
+%{_mandir}/man1/ppcppc.1*
+%else
+%{_mandir}/man1/ppc%{_bname}.1*
+%endif
+%{_mandir}/man1/ppdep.1*
+%{_mandir}/man1/ppudump.1*
+%{_mandir}/man1/ppufiles.1*
+%{_mandir}/man1/ppumove.1*
+%{_mandir}/man1/ptop.1*
+%{_mandir}/man1/pyacc.1*
+%{_mandir}/man1/rmcvsdir.1*
+%{_mandir}/man1/rstconv.1*
+%{_mandir}/man1/unitdiff.1*
+%{_mandir}/man5/fpc.cfg.5*
+%{_mandir}/man5/fpcmake.5*
+%{_mandir}/man5/ptop.cfg.5*
+
+%files ide
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/fp
+# TODO: move the below files to data dir
+# - ANSI art file used by fp binary
+%{_bindir}/fp.ans
+%{_bindir}/fp.rsj
+# - IDE command templates
+%{_bindir}/cvsco.tdf
+%{_bindir}/cvsdiff.tdf
+%{_bindir}/cvsup.tdf
+%{_bindir}/grep.tdf
+%{_bindir}/tpgrep.tdf
+# - Pascal code skeletons
+%{_bindir}/gplprog.pt
+%{_bindir}/gplunit.pt
+%{_bindir}/program.pt
+%{_bindir}/unit.pt
+%{_libdir}/%{name}/%{version}/ide
%files src
%defattr(644,root,root,755)