diff --git a/fpc-3.2.2-fix-lib-paths-on-aarch64.patch b/fpc-3.2.2-fix-lib-paths-on-aarch64.patch new file mode 100644 index 0000000..a84fcab --- /dev/null +++ b/fpc-3.2.2-fix-lib-paths-on-aarch64.patch @@ -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} diff --git a/fpc-3.2.2-glibc-2.34.patch b/fpc-3.2.2-glibc-2.34.patch new file mode 100644 index 0000000..12d7876 --- /dev/null +++ b/fpc-3.2.2-glibc-2.34.patch @@ -0,0 +1,141 @@ +From a6c82b6642871e1c68f3839e090b055bee4254b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +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 + diff --git a/fpc.spec b/fpc.spec index a2d6cda..e76c72f 100644 --- a/fpc.spec +++ b/fpc.spec @@ -1,6 +1,6 @@ Name: fpc Version: 3.2.2 -Release: 1mamba +Release: 2mamba Summary: A Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler Group: Applications/Development Vendor: openmamba @@ -8,6 +8,8 @@ Distribution: openmamba Packager: Silvan Calarco URL: https://www.freepascal.org/ 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 ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -19,10 +21,26 @@ Requires(preun): %{__install_info} %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. +%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 %prep %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 # bootstrap %ifarch %{ix86} @@ -30,21 +48,37 @@ if [ ! -e %{_bindir}/fpc ]; then %else BINARY_ARCH=%{_target_cpu} %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" - curl $BINARY_SRC -o fpc.tar + BINARY_SRC="https://downloads.sourceforge.net/project/freepascal/Linux/%{version}/fpc-%{version}.${BINARY_ARCH}-linux.tar" + curl -L $BINARY_SRC -o fpc.tar tar xf fpc.tar - mv fpc-2.6.4.$BINARY_ARCH-linux bootstrap + mv fpc-%{version}.$BINARY_ARCH-linux bootstrap cd bootstrap echo `pwd`/../bootstrap | ./install.sh + cd .. fi dos2unix ./fpcsrc/compiler/utils/samplecfg dos2unix ./install/beos/samplecfg %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 +cd fpcsrc/compiler +../../bootstrap/bin/fpcmake -Tall +cd ../.. + %make build NOGDB=1 FPCPROG=`pwd`/bootstrap/bin/fpc else + +cd fpcsrc/compiler +fpcmake -Tall +cd ../.. + %make build NOGDB=1 fi @@ -55,29 +89,50 @@ if [ ! -e %{_bindir}/fpc ]; then INSTALL_PREFIX=%{buildroot}%{_prefix} \ INSTALL_LIBDIR=%{buildroot}%{_libdir} \ 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 %makeinstall \ INSTALL_PREFIX=%{buildroot}%{_prefix} \ INSTALL_LIBDIR=%{buildroot}%{_libdir} \ 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 %ifarch x86_64 -ln -s %{_prefix}/lib/fpc/%{version}/ppcx64 %{buildroot}%{_bindir}/ppcx64 +ln -s %{_libdir}/fpc/%{version}/ppcx64 %{buildroot}%{_bindir}/ppcx64 %endif %ifarch %{ix86} -ln -s %{_prefix}/lib/fpc/%{version}/ppc386 %{buildroot}%{_bindir}/ppc386 +ln -s %{_libdir}/fpc/%{version}/ppc386 %{buildroot}%{_bindir}/ppc386 %endif -%ifarch arm -ln -s %{_prefix}/lib/fpc/%{version}/ppcarm %{buildroot}%{_bindir}/ppcarm +%ifarch aarch64 +ln -s %{_libdir}/fpc/%{version}/ppcaarch64 %{buildroot}%{_bindir}/ppcaarch64 %endif -install -d %{buildroot}%{_sysconfdir} -%{buildroot}%{_prefix}/lib/fpc/%{version}/samplecfg \ - %{buildroot}%{_prefix}/lib/fpc/%{version} \ - %{buildroot}%{_sysconfdir} +# Strip buildroot from paths +sed -i "s|%{buildroot}||" %{buildroot}%{_sysconfdir}/fpc.cfg # use -fPIC by default cat >> %{buildroot}%{_sysconfdir}/fpc.cfg << _EOF @@ -87,33 +142,46 @@ cat >> %{buildroot}%{_sysconfdir}/fpc.cfg << _EOF #endif _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 %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" %files -#-f %{name}.lang %defattr(-,root,root) %config %{_sysconfdir}/fpc.cfg +%ifnarch aarch64 %config %{_sysconfdir}/fppkg.cfg %dir %{_sysconfdir}/fppkg %config %{_sysconfdir}/fppkg/default +%endif %{_bindir}/* %{_libdir}/libpas2jslib.so %dir %{_libdir}/fpc %{_libdir}/fpc/* -%ifarch x86_64 -%dir %{_prefix}/lib/fpc -%{_prefix}/lib/fpc/* -%endif %{_mandir}/man1/*.1* %{_mandir}/man5/*.5* %dir %{_docdir}/fpc-* %{_docdir}/fpc-*/* +%dir %{_docdir}/fpc +%{_docdir}/fpc/* %doc fpcsrc/rtl/COPYING.FPC +%files src +%defattr(-,root,root) +%dir %{_datadir}/fpcsrc +%{_datadir}/fpcsrc/* + %changelog +* Wed Nov 27 2024 Silvan Calarco 3.2.2-2mamba +- add fpc-src subpackage + * Thu May 27 2021 Automatic Build System 3.2.2-1mamba - automatic version update by autodist