add fpc-src subpackage [release 3.2.2-2mamba;Wed Nov 27 2024]

This commit is contained in:
Silvan Calarco 2024-11-30 17:13:04 +01:00
parent 8e78181c04
commit c1aaceb554
3 changed files with 249 additions and 19 deletions

View File

@ -0,0 +1,21 @@
--- compiler/systems/t_linux.pas 2020-01-26 12:38:49.026082370 +0100
+++ compiler/systems/t_linux.pas 2020-01-28 02:28:20.365389393 +0100
@@ -141,10 +141,17 @@
if target_info.abi<>abi_powerpc_elfv2 then
LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64;=/usr/lib64;=/usr/X11R6/lib64',true)
else
LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64;=/usr/lib/powerpc64le-linux-gnu;=/usr/X11R6/powerpc64le-linux-gnu',true);
-{$else powerpc64}
+{$else}
+{$ifdef aarch64}
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib',true);
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib',true);
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/usr/lib64',true);
+ LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib64',true);
+{$else}
LibrarySearchPath.AddLibraryPath(sysrootpath,'=/lib;=/usr/lib;=/usr/X11R6/lib',true);
+{$endif aarch64}
{$endif powerpc64}
{$endif x86_64}
{$ifdef arm}

141
fpc-3.2.2-glibc-2.34.patch Normal file
View File

@ -0,0 +1,141 @@
From a6c82b6642871e1c68f3839e090b055bee4254b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Tue, 21 Sep 2021 12:47:28 +0200
Subject: [PATCH] update startup data structs for glibc >= 2.34
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2005910
Fixes: https://gitlab.com/freepascal.org/fpc/source/-/issues/39295
---
rtl/linux/aarch64/cprt0.as | 6 ++----
rtl/linux/i386/si_c21.inc | 7 +++----
rtl/linux/powerpc64/cprt0.as | 4 ++--
rtl/linux/powerpc64/gprt0.as | 4 ++--
rtl/linux/powerpc64/si_c.inc | 7 ++-----
rtl/linux/powerpc64/si_g.inc | 7 ++-----
6 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/rtl/linux/aarch64/cprt0.as b/rtl/linux/aarch64/cprt0.as
index fd83610fbc..c8f2ca4baa 100644
--- a/rtl/linux/aarch64/cprt0.as
+++ b/rtl/linux/aarch64/cprt0.as
@@ -41,10 +41,8 @@ _start:
init, fini, rtld_fini, stack_end) */
adrp x0,:got:PASCALMAIN
ldr x0,[x0,#:got_lo12:PASCALMAIN]
- adrp x3,:got:__libc_csu_init
- ldr x3,[x3,#:got_lo12:__libc_csu_init]
- adrp x4,:got:__libc_csu_fini
- ldr x4,[x4,#:got_lo12:__libc_csu_fini]
+ mov x3, #0 /* Used to be init. */
+ mov x4, #0 /* Used to be fini. */
bl __libc_start_main
/* This should never happen */
diff --git a/rtl/linux/i386/si_c21.inc b/rtl/linux/i386/si_c21.inc
index 71df29b6ef..084cdcf3ce 100644
--- a/rtl/linux/i386/si_c21.inc
+++ b/rtl/linux/i386/si_c21.inc
@@ -35,8 +35,6 @@
{$asmmode att}
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
procedure libc_start_main; external name '__libc_start_main';
procedure libc_exit(code: longint); cdecl; external name 'exit';
@@ -93,8 +91,9 @@ procedure _FPC_libc21_start; assembler; nostackframe; public name '_start';
pushl %esp { stack_end }
pushl %edx { function to be registered with
atexit(), passed by loader }
- pushl $__libc_csu_fini
- pushl $__libc_csu_init
+ { This used to be the addresses of .fini and .init. }
+ pushl $0
+ pushl $0
pushl %esi { Push second argument: argv. }
pushl %ecx { Push first argument: argc. }
diff --git a/rtl/linux/powerpc64/cprt0.as b/rtl/linux/powerpc64/cprt0.as
index 2b8309d4bf..3eace2813d 100644
--- a/rtl/linux/powerpc64/cprt0.as
+++ b/rtl/linux/powerpc64/cprt0.as
@@ -351,8 +351,8 @@ _restvr_31: addi r12,r0,-16
start_addresses:
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
.quad main_stub
- .quad __libc_csu_init
- .quad __libc_csu_fini
+ .quad 0 /* Used to be init. */
+ .quad 0 /* Used to be fini. */
.size start_adresses, .-start_addresses
/*
diff --git a/rtl/linux/powerpc64/gprt0.as b/rtl/linux/powerpc64/gprt0.as
index de31b6b08d..6b6fc9011b 100644
--- a/rtl/linux/powerpc64/gprt0.as
+++ b/rtl/linux/powerpc64/gprt0.as
@@ -351,8 +351,8 @@ _restvr_31: addi r12,r0,-16
start_addresses:
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
.quad main_stub
- .quad __libc_csu_init
- .quad __libc_csu_fini
+ .quad 0 /* Used to be init. */
+ .quad 0 /* Used to be fini. */
.size start_adresses, .-start_addresses
/*
diff --git a/rtl/linux/powerpc64/si_c.inc b/rtl/linux/powerpc64/si_c.inc
index c7e5e353a0..2833258c93 100644
--- a/rtl/linux/powerpc64/si_c.inc
+++ b/rtl/linux/powerpc64/si_c.inc
@@ -657,9 +657,6 @@ procedure _restfpr_30; cdecl; public; assembler; nostackframe;
Process start/halt
******************************************************************************}
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
-
procedure __libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl; external;
var
@@ -724,8 +721,8 @@ procedure main_stub(argc: longint; argv, envp: ppchar); cdecl; assembler; nostac
end
= (sda_base: nil; {* was _SDA_BASE_ but not in 64-bit ABI }
main: @main_stub;
- libc_csu_init: @__libc_csu_init;
- libc_csu_fini: @__libc_csu_fini
+ libc_csu_init: nil;
+ libc_csu_fini: nil
);
diff --git a/rtl/linux/powerpc64/si_g.inc b/rtl/linux/powerpc64/si_g.inc
index 8c99a39bc6..58cdf19f9c 100644
--- a/rtl/linux/powerpc64/si_g.inc
+++ b/rtl/linux/powerpc64/si_g.inc
@@ -657,9 +657,6 @@ procedure _restfpr_30; cdecl; public; assembler; nostackframe;
Process start/halt
******************************************************************************}
-procedure __libc_csu_init; cdecl; external;
-procedure __libc_csu_fini; cdecl; external;
-
procedure __libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl; external;
type
@@ -745,8 +742,8 @@ procedure main_stub(argc: longint; argv, envp: ppchar); cdecl; assembler; nostac
end
= (sda_base: nil; {* was _SDA_BASE_ but not in 64-bit ABI }
main: @main_stub;
- libc_csu_init: @__libc_csu_init;
- libc_csu_fini: @__libc_csu_fini
+ libc_csu_init: nil;
+ libc_csu_fini: nil
);
procedure call_libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl;
--
2.31.1

106
fpc.spec
View File

@ -1,6 +1,6 @@
Name: fpc Name: fpc
Version: 3.2.2 Version: 3.2.2
Release: 1mamba Release: 2mamba
Summary: A Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler Summary: A Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler
Group: Applications/Development Group: Applications/Development
Vendor: openmamba Vendor: openmamba
@ -8,6 +8,8 @@ Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.freepascal.org/ URL: https://www.freepascal.org/
Source: http://downloads.sourceforge.net/project/freepascal/Source/%{version}/fpcbuild-%{version}.zip Source: http://downloads.sourceforge.net/project/freepascal/Source/%{version}/fpcbuild-%{version}.zip
Patch0: fpc-3.2.2-fix-lib-paths-on-aarch64.patch
Patch1: fpc-3.2.2-glibc-2.34.patch
License: GPL License: GPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
@ -19,10 +21,26 @@ Requires(preun): %{__install_info}
%description %description
Free Pascal is a 32, 64 and 16 bit professional Pascal compiler. It can target multiple processor architectures: Intel x86, AMD64/x86-64, PowerPC, PowerPC64, SPARC, and ARM. Supported operating systems include Linux, FreeBSD, Haiku, Mac OS X/iOS/Darwin, DOS, Win32, Win64, WinCE, OS/2, MorphOS, Nintendo GBA, Nintendo DS, and Nintendo Wii. Additionally, support for the JVM, MIPS (big and little endian variants), i8086, Motorola 68k and AArch64 architectures is available in the development versions. Free Pascal is a 32, 64 and 16 bit professional Pascal compiler. It can target multiple processor architectures: Intel x86, AMD64/x86-64, PowerPC, PowerPC64, SPARC, and ARM. Supported operating systems include Linux, FreeBSD, Haiku, Mac OS X/iOS/Darwin, DOS, Win32, Win64, WinCE, OS/2, MorphOS, Nintendo GBA, Nintendo DS, and Nintendo Wii. Additionally, support for the JVM, MIPS (big and little endian variants), i8086, Motorola 68k and AArch64 architectures is available in the development versions.
%package src
Summary: Free Pascal Compiler - sources
Group: Development/Libraries
%description src
The fpc-src package contains the sources of Free Pascal, for documentation or automatical-code generation purposes.
%debug_package %debug_package
%prep %prep
%setup -q -n %{name}build-%{version} %setup -q -n %{name}build-%{version}
#-D -T
#:<< _EOF
cd fpcsrc
dos2unix -R compiler/systems/t_linux.pas
dos2unix -R rtl/linux/*/*
%patch 0 -p0 -b .fix-lib-paths-on-aarch64
%patch 1 -p1 -b .glibc-2.34
cd ..
if [ ! -e %{_bindir}/fpc ]; then if [ ! -e %{_bindir}/fpc ]; then
# bootstrap # bootstrap
%ifarch %{ix86} %ifarch %{ix86}
@ -30,21 +48,37 @@ if [ ! -e %{_bindir}/fpc ]; then
%else %else
BINARY_ARCH=%{_target_cpu} BINARY_ARCH=%{_target_cpu}
%endif %endif
BINARY_SRC="ftp://gd.tuwien.ac.at/languages/pascal/fpc/dist/2.6.4/$BINARY_ARCH-linux/fpc-2.6.4.$BINARY_ARCH-linux.tar" BINARY_SRC="https://downloads.sourceforge.net/project/freepascal/Linux/%{version}/fpc-%{version}.${BINARY_ARCH}-linux.tar"
curl $BINARY_SRC -o fpc.tar curl -L $BINARY_SRC -o fpc.tar
tar xf fpc.tar tar xf fpc.tar
mv fpc-2.6.4.$BINARY_ARCH-linux bootstrap mv fpc-%{version}.$BINARY_ARCH-linux bootstrap
cd bootstrap cd bootstrap
echo `pwd`/../bootstrap | ./install.sh echo `pwd`/../bootstrap | ./install.sh
cd ..
fi fi
dos2unix ./fpcsrc/compiler/utils/samplecfg dos2unix ./fpcsrc/compiler/utils/samplecfg
dos2unix ./install/beos/samplecfg dos2unix ./install/beos/samplecfg
%build %build
#:<< _EOF
# Save the source-files
mkdir -p fpc_src
cp -a fpcsrc/rtl fpc_src
cp -a fpcsrc/packages fpc_src
if [ ! -e %{_bindir}/fpc ]; then if [ ! -e %{_bindir}/fpc ]; then
cd fpcsrc/compiler
../../bootstrap/bin/fpcmake -Tall
cd ../..
%make build NOGDB=1 FPCPROG=`pwd`/bootstrap/bin/fpc %make build NOGDB=1 FPCPROG=`pwd`/bootstrap/bin/fpc
else else
cd fpcsrc/compiler
fpcmake -Tall
cd ../..
%make build NOGDB=1 %make build NOGDB=1
fi fi
@ -55,29 +89,50 @@ if [ ! -e %{_bindir}/fpc ]; then
INSTALL_PREFIX=%{buildroot}%{_prefix} \ INSTALL_PREFIX=%{buildroot}%{_prefix} \
INSTALL_LIBDIR=%{buildroot}%{_libdir} \ INSTALL_LIBDIR=%{buildroot}%{_libdir} \
INSTALL_MANDIR=%{buildroot}%{_mandir} \ INSTALL_MANDIR=%{buildroot}%{_mandir} \
NOGDB=1 FPCPROG=`pwd`/bootstrap/bin/fpc INSTALL_BASEDIR=%{buildroot}%{_libdir}/%{name}/%{version} \
CODPATH=%{buildroot}%{_libdir}/%{name}/lexyacc \
INSTALL_DOCDIR=%{buildroot}%{_docdir}/%{name} \
INSTALL_BINDIR=%{buildroot}%{_bindir} \
INSTALL_EXAMPLEDIR=%{buildroot}%{_docdir}/%{name}/examples \
FPCPROG=`pwd`/bootstrap/bin/fpc
install -d %{buildroot}%{_sysconfdir}
sed -i "s|^FPCBIN=.*|FPCBIN=fpc|" bootstrap/lib/fpc/%{version}/samplecfg
PATH=$PWD/bootstrap/bin:$PATH \
bootstrap/lib/fpc/%{version}/samplecfg \
%{_libdir}/fpc/%{version} \
%{buildroot}%{_sysconfdir}
else else
%makeinstall \ %makeinstall \
INSTALL_PREFIX=%{buildroot}%{_prefix} \ INSTALL_PREFIX=%{buildroot}%{_prefix} \
INSTALL_LIBDIR=%{buildroot}%{_libdir} \ INSTALL_LIBDIR=%{buildroot}%{_libdir} \
INSTALL_MANDIR=%{buildroot}%{_mandir} \ INSTALL_MANDIR=%{buildroot}%{_mandir} \
NOGDB=1 INSTALL_BASEDIR=%{buildroot}%{_libdir}/%{name}/%{version} \
CODPATH=%{buildroot}%{_libdir}/%{name}/lexyacc \
INSTALL_DOCDIR=%{buildroot}%{_docdir}/%{name} \
INSTALL_BINDIR=%{buildroot}%{_bindir} \
INSTALL_EXAMPLEDIR=%{buildroot}%{_docdir}/%{name}/examples
install -d %{buildroot}%{_sysconfdir}
%{buildroot}%{_libdir}/fpc/%{version}/samplecfg \
%{_libdir}/fpc/%{version} \
%{buildroot}%{_sysconfdir}
fi fi
%ifarch x86_64 %ifarch x86_64
ln -s %{_prefix}/lib/fpc/%{version}/ppcx64 %{buildroot}%{_bindir}/ppcx64 ln -s %{_libdir}/fpc/%{version}/ppcx64 %{buildroot}%{_bindir}/ppcx64
%endif %endif
%ifarch %{ix86} %ifarch %{ix86}
ln -s %{_prefix}/lib/fpc/%{version}/ppc386 %{buildroot}%{_bindir}/ppc386 ln -s %{_libdir}/fpc/%{version}/ppc386 %{buildroot}%{_bindir}/ppc386
%endif %endif
%ifarch arm %ifarch aarch64
ln -s %{_prefix}/lib/fpc/%{version}/ppcarm %{buildroot}%{_bindir}/ppcarm ln -s %{_libdir}/fpc/%{version}/ppcaarch64 %{buildroot}%{_bindir}/ppcaarch64
%endif %endif
install -d %{buildroot}%{_sysconfdir} # Strip buildroot from paths
%{buildroot}%{_prefix}/lib/fpc/%{version}/samplecfg \ sed -i "s|%{buildroot}||" %{buildroot}%{_sysconfdir}/fpc.cfg
%{buildroot}%{_prefix}/lib/fpc/%{version} \
%{buildroot}%{_sysconfdir}
# use -fPIC by default # use -fPIC by default
cat >> %{buildroot}%{_sysconfdir}/fpc.cfg << _EOF cat >> %{buildroot}%{_sysconfdir}/fpc.cfg << _EOF
@ -87,33 +142,46 @@ cat >> %{buildroot}%{_sysconfdir}/fpc.cfg << _EOF
#endif #endif
_EOF _EOF
# Install the source-files
mkdir -p %{buildroot}%{_datadir}/fpcsrc
cp -a fpc_src/* %{buildroot}%{_datadir}/fpcsrc/
rm -rf %{buildroot}/usr/lib/%{name}/lexyacc
%find_lang %{name} || touch %{name}.lang %find_lang %{name} || touch %{name}.lang
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files %files
#-f %{name}.lang
%defattr(-,root,root) %defattr(-,root,root)
%config %{_sysconfdir}/fpc.cfg %config %{_sysconfdir}/fpc.cfg
%ifnarch aarch64
%config %{_sysconfdir}/fppkg.cfg %config %{_sysconfdir}/fppkg.cfg
%dir %{_sysconfdir}/fppkg %dir %{_sysconfdir}/fppkg
%config %{_sysconfdir}/fppkg/default %config %{_sysconfdir}/fppkg/default
%endif
%{_bindir}/* %{_bindir}/*
%{_libdir}/libpas2jslib.so %{_libdir}/libpas2jslib.so
%dir %{_libdir}/fpc %dir %{_libdir}/fpc
%{_libdir}/fpc/* %{_libdir}/fpc/*
%ifarch x86_64
%dir %{_prefix}/lib/fpc
%{_prefix}/lib/fpc/*
%endif
%{_mandir}/man1/*.1* %{_mandir}/man1/*.1*
%{_mandir}/man5/*.5* %{_mandir}/man5/*.5*
%dir %{_docdir}/fpc-* %dir %{_docdir}/fpc-*
%{_docdir}/fpc-*/* %{_docdir}/fpc-*/*
%dir %{_docdir}/fpc
%{_docdir}/fpc/*
%doc fpcsrc/rtl/COPYING.FPC %doc fpcsrc/rtl/COPYING.FPC
%files src
%defattr(-,root,root)
%dir %{_datadir}/fpcsrc
%{_datadir}/fpcsrc/*
%changelog %changelog
* Wed Nov 27 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.2-2mamba
- add fpc-src subpackage
* Thu May 27 2021 Automatic Build System <autodist@mambasoft.it> 3.2.2-1mamba * Thu May 27 2021 Automatic Build System <autodist@mambasoft.it> 3.2.2-1mamba
- automatic version update by autodist - automatic version update by autodist