summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Antonio Leal <antonioleal@yahoo.com>2024-01-15 07:57:30 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2024-01-15 08:20:19 +0700
commitd730b54836fddf6e20ffb9eb142eb54b4a93ec39 (patch)
tree90571fc2d0c8a09ea48f6bda66ed7819173f13f4
parent431f1a204cd7cb0c9f9407367d5203a934ade392 (diff)
downloadslackbuilds-d730b54836fddf6e20ffb9eb142eb54b4a93ec39.tar.gz
slackbuilds-d730b54836fddf6e20ffb9eb142eb54b4a93ec39.tar.xz
development/fpc: Update script.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--development/fpc/README9
-rw-r--r--development/fpc/fpc.SlackBuild48
-rw-r--r--development/fpc/fpc.info12
-rw-r--r--development/fpc/patches/Fix-liking-with-libc-when-PIC-is-enabled.patch24
-rw-r--r--development/fpc/patches/fix-IDE-data-file-location.patch (renamed from development/fpc/fix-IDE-data-file-location.patch)0
-rw-r--r--development/fpc/patches/glibc2.34.patch188
-rw-r--r--development/fpc/patches/honor_SOURCE_DATE_EPOCH_in_date.patch55
7 files changed, 321 insertions, 15 deletions
diff --git a/development/fpc/README b/development/fpc/README
index 021197c14e..b41437b58a 100644
--- a/development/fpc/README
+++ b/development/fpc/README
@@ -6,3 +6,12 @@ Amd64/x86_64, PowerPC, PowerPC64, Sparc, ARM. The discontinued 1.0
version also supports the Motorola 680x0. The following operating
systems are supported: Linux, FreeBSD, Mac OS X/Darwin, DOS, Win32,
Win64, WinCE, OS/2, Netware (libc and classic) and MorphOS.
+
+The fpc source code is included by default. It is needed by
+some applications (e.g Lazarus IDE) but it can be excluded with:
+
+ SRC=no ./fpc.Slackbuild
+
+Note: if you plan to use lazarus 3.0 make sure first to remove
+any previous lazarus installation, then upgrade fpc to
+version 3.2.2 build 3, and only then install lazarus 3.0
diff --git a/development/fpc/fpc.SlackBuild b/development/fpc/fpc.SlackBuild
index ee1dc37e3f..a7399aec49 100644
--- a/development/fpc/fpc.SlackBuild
+++ b/development/fpc/fpc.SlackBuild
@@ -2,10 +2,10 @@
# Slackware build script for Free Pascal
-# Written by Andre Barboza <email removed>.
-# Modified by the SlackBuilds.org project.
+# Maintained by Antonio Leal <antonioleal@yahoo.com>.
# Previously maintained by B. Watson <urchlay@slackware.uk>.
-# Now maintained by Antonio Leal <antonioleal@yahoo.com>.
+# Modified by the SlackBuilds.org project.
+# Written by Andre Barboza <email removed>.
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@@ -24,7 +24,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# 20230814 AL: BUILD=2
+# 20231229 ALe: BUILD=3
+# Imported Debian patches to support -fPIC option, improved timestamps.
+# Added fpc source code with option to exclude it.
+
+# 20230814 ALe: BUILD=2
# - tested conflict with ptop: it no longer exists because in ptop SlackBuild
# the name /usr/bin/ptop.py is now being used.
@@ -49,7 +53,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=fpc
VERSION=${VERSION:-3.2.2}
BINVER=${BINVER:-3.2.2}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -85,6 +89,13 @@ OUTPUT=${OUTPUT:-/tmp}
set -e
+fixperms() {
+ chown -R root:root .
+ find -L . -type l -o \
+ -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+}
+
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
@@ -123,9 +134,15 @@ cd $TMP/${PRGNAM}build-$VERSION/${PRGNAM}build-$VERSION
sed -i "s,\\(as\\|control\\) it's,\\1 its," install/man/man?/*.?
# 20210905 bkw: patch taken from Debian with many thanks. Installs the
-# IDE's data files somewhere besides /usr/bin, and patches the IDE to
-# look for them there.
-patch -p1 < $CWD/fix-IDE-data-file-location.patch
+# - IDE's data files somewhere besides /usr/bin, and patches the IDE to look for them there.
+patch -p1 < $CWD/patches/fix-IDE-data-file-location.patch
+# 20240113 ALe: Patches imported from Debian fpc_3.2.2+dfsg-20.debian.tar.xz :
+# - Fixed liking with libc when PIC is enabled (x86_64 specific)
+patch -p1 < $CWD/patches/Fix-liking-with-libc-when-PIC-is-enabled.patch
+# - Add glibc2.34.patch to adjust startup code for glibc2.34 (Closes: #1016556)
+patch -p1 < $CWD/patches/glibc2.34.patch
+# - Reproducibility never ends: add honor_SOURCE_DATE_EPOCH_in_date.patch to improve some timestamps in binaries
+patch -p1 < $CWD/patches/honor_SOURCE_DATE_EPOCH_in_date.patch
# 20210905 bkw: don't let the NOGDB=1 scare you. During the compile
# we get this message:
@@ -145,6 +162,17 @@ else
ln -s ../lib$LIBDIRSUFFIX/fpc/$VERSION/ppc386
fi
+# 20231229 ALe: Optionally exclude the source from the package.
+# Source is required by some apps (e.g lazarus IDE).
+if [ "${SRC:-yes}" = "yes" ]; then
+ mkdir -p $PKG/usr/src
+ ( cd $PKG/usr/src
+ tar xvf $CWD/fpc-$VERSION.source.tar.gz
+ fixperms
+ ln -s fpc-$VERSION fpc
+ )
+fi
+
# copy docs
mv $PKG/usr/share/doc $PKG/usr/doc
rmdir $PKG/usr/share
@@ -193,8 +221,6 @@ cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
# fix permissions for program docs and demos.
-chown -R root:root .
-find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
- \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+fixperms
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/fpc/fpc.info b/development/fpc/fpc.info
index f5ef5ad9b2..2006462d53 100644
--- a/development/fpc/fpc.info
+++ b/development/fpc/fpc.info
@@ -2,13 +2,17 @@ PRGNAM="fpc"
VERSION="3.2.2"
HOMEPAGE="https://www.freepascal.org/"
DOWNLOAD="https://downloads.sourceforge.net/project/freepascal/Linux/3.2.2/fpc-3.2.2.i386-linux.tar \
- https://downloads.sourceforge.net/project/freepascal/Source/3.2.2/fpcbuild-3.2.2.tar.gz"
+ https://downloads.sourceforge.net/project/freepascal/Source/3.2.2/fpcbuild-3.2.2.tar.gz \
+ https://downloads.sourceforge.net/freepascal/fpc-3.2.2.source.tar.gz"
MD5SUM="18354e51309a34b0efe7702633568a1e \
- 3681ae4a208be4f64ec65e832a9a702d"
+ 3681ae4a208be4f64ec65e832a9a702d \
+ e7649ad0fc9230fdd9493a7fcabbd426"
DOWNLOAD_x86_64="https://downloads.sourceforge.net/project/freepascal/Linux/3.2.2/fpc-3.2.2.x86_64-linux.tar \
- https://downloads.sourceforge.net/project/freepascal/Source/3.2.2/fpcbuild-3.2.2.tar.gz"
+ https://downloads.sourceforge.net/project/freepascal/Source/3.2.2/fpcbuild-3.2.2.tar.gz \
+ https://downloads.sourceforge.net/freepascal/fpc-3.2.2.source.tar.gz"
MD5SUM_x86_64="0186779de0c9caee073fc1394afbee56 \
- 3681ae4a208be4f64ec65e832a9a702d"
+ 3681ae4a208be4f64ec65e832a9a702d \
+ e7649ad0fc9230fdd9493a7fcabbd426"
REQUIRES=""
MAINTAINER="Antonio Leal"
EMAIL="antonioleal@yahoo.com"
diff --git a/development/fpc/patches/Fix-liking-with-libc-when-PIC-is-enabled.patch b/development/fpc/patches/Fix-liking-with-libc-when-PIC-is-enabled.patch
new file mode 100644
index 0000000000..096c058912
--- /dev/null
+++ b/development/fpc/patches/Fix-liking-with-libc-when-PIC-is-enabled.patch
@@ -0,0 +1,24 @@
+From: Florian Klämpfl <florian@freepascal.org>
+Date: Mon Aug 3 19:42:14 2020 UTC
+Description: @PLT is needed for calls to link it properly with pic code
+
+--- fpc.orig/fpcsrc/rtl/linux/x86_64/si_c.inc
++++ fpc/fpcsrc/rtl/linux/x86_64/si_c.inc
+@@ -86,7 +86,7 @@
+
+ { start the program }
+ xorq %rbp,%rbp
+- call PASCALMAIN
++ call PASCALMAIN@PLT
+ {$endif FPC_HAS_INDIRECT_ENTRY_INFORMATION}
+ hlt
+ end;
+@@ -162,7 +162,7 @@
+
+ { Call the user's main function, and exit with its value.
+ But let the libc call main. }
+- call libc_start_main
++ call libc_start_main@PLT
+
+ hlt { Crash if somehow `exit' does return. }
+ end;
diff --git a/development/fpc/fix-IDE-data-file-location.patch b/development/fpc/patches/fix-IDE-data-file-location.patch
index 3ab047f40a..3ab047f40a 100644
--- a/development/fpc/fix-IDE-data-file-location.patch
+++ b/development/fpc/patches/fix-IDE-data-file-location.patch
diff --git a/development/fpc/patches/glibc2.34.patch b/development/fpc/patches/glibc2.34.patch
new file mode 100644
index 0000000000..5a54a6bd1c
--- /dev/null
+++ b/development/fpc/patches/glibc2.34.patch
@@ -0,0 +1,188 @@
+Description: Adjust startup code for glibc 2.34
+ Based on the corresponding changes made in glibc:
+ https://sourceware.org/git/?p=glibc.git;a=commit;h=035c012e32c11e84d64905efaf55e74f704d3668
+Bug: https://gitlab.com/freepascal.org/fpc/source/-/issues/39295
+Author: Graham Inggs <ginggs@debian.org>
+Last-Update: 2022-08-12
+
+--- a/fpcsrc/rtl/linux/powerpc64/cprt0.as
++++ b/fpcsrc/rtl/linux/powerpc64/cprt0.as
+@@ -351,8 +351,8 @@
+ 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
++ .quad 0
+ .size start_adresses, .-start_addresses
+
+ /*
+--- a/fpcsrc/rtl/linux/powerpc64/gprt0.as
++++ b/fpcsrc/rtl/linux/powerpc64/gprt0.as
+@@ -351,8 +351,8 @@
+ 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
++ .quad 0
+ .size start_adresses, .-start_addresses
+
+ /*
+--- a/fpcsrc/rtl/linux/aarch64/cprt0.as
++++ b/fpcsrc/rtl/linux/aarch64/cprt0.as
+@@ -41,10 +41,8 @@
+ 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
++ mov x4, #0
+ bl __libc_start_main
+
+ /* This should never happen */
+--- a/fpcsrc/rtl/linux/i386/si_c21.inc
++++ b/fpcsrc/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,8 @@
+ pushl %esp { stack_end }
+ pushl %edx { function to be registered with
+ atexit(), passed by loader }
+- pushl $__libc_csu_fini
+- pushl $__libc_csu_init
++ pushl $0
++ pushl $0
+ pushl %esi { Push second argument: argv. }
+ pushl %ecx { Push first argument: argc. }
+
+--- a/fpcsrc/rtl/linux/x86_64/cprt0.as
++++ b/fpcsrc/rtl/linux/x86_64/cprt0.as
+@@ -61,9 +61,8 @@
+ which grow downwards). */
+ pushq %rsp
+
+- /* Pass address of our own entry points to .fini and .init. */
+- movq __libc_csu_init@GOTPCREL(%rip), %rcx
+- movq __libc_csu_fini@GOTPCREL(%rip), %r8
++ xorl %r8d, %r8d
++ xorl %ecx, %ecx
+
+ movq main_stub@GOTPCREL(%rip), %rdi
+
+--- a/fpcsrc/rtl/linux/arm/cprt0.as
++++ b/fpcsrc/rtl/linux/arm/cprt0.as
+@@ -82,10 +82,10 @@
+
+ /* Set up the other arguments in registers */
+ ldr a1, =PASCALMAIN
+- ldr a4, =_init
++ ldr a4, = #0
+
+ /* Push fini */
+- str ip, [sp, #-4]!
++ str a4, [sp, #-4]!
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+
+--- a/fpcsrc/rtl/linux/powerpc64/si_g.inc
++++ b/fpcsrc/rtl/linux/powerpc64/si_g.inc
+@@ -657,9 +657,6 @@
+ 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 @@
+ 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: pointer(0);
++ libc_csu_fini: pointer(0)
+ );
+
+ procedure call_libc_start_main(r3,r4,r5,r6,r7,r8,r9: pointer); cdecl;
+--- a/fpcsrc/rtl/linux/powerpc64/si_c.inc
++++ b/fpcsrc/rtl/linux/powerpc64/si_c.inc
+@@ -657,9 +657,6 @@
+ 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 @@
+ 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: pointer(0);
++ libc_csu_fini: pointer(0)
+ );
+
+
+--- a/fpcsrc/rtl/linux/powerpc/cprt0.as
++++ b/fpcsrc/rtl/linux/powerpc/cprt0.as
+@@ -35,8 +35,8 @@
+ start_addresses:
+ .long _SDA_BASE_
+ .long main_stub
+- .long __libc_csu_init
+- .long __libc_csu_fini
++ .long 0
++ .long 0
+ .size start_adresses, .-start_addresses
+
+ .section ".text"
+--- a/fpcsrc/rtl/linux/mips/cprt0.as
++++ b/fpcsrc/rtl/linux/mips/cprt0.as
+@@ -113,10 +113,9 @@
+ and $29, -2 * 4
+ subu $29, 32
+
+- lw $7,%got(__libc_csu_init)($gp) /* init */
+- lw $8,%got(__libc_csu_fini)($gp) /* fini */
++ move $7, $0
+
+- sw $8, 16($29) /* fini */
++ sw $0, 16($29)
+ sw $2, 20($29) /* rtld_fini */
+ sw $29, 24($29) /* stack_end */
+
+--- a/fpcsrc/rtl/linux/m68k/cprt0.as
++++ b/fpcsrc/rtl/linux/m68k/cprt0.as
+@@ -41,8 +41,10 @@
+
+ pea (%sp) /* highest available stack address */
+ pea (%a1) /* termination function provided by kernel */
+- pea __libc_csu_fini
+- pea __libc_csu_init
++
++ clr.l -(%sp)
++ clr.l -(%sp)
++
+ pea (%a0) /* argv */
+ move.l %d0,-(%sp) /* argc */
+ pea PASCALMAIN
diff --git a/development/fpc/patches/honor_SOURCE_DATE_EPOCH_in_date.patch b/development/fpc/patches/honor_SOURCE_DATE_EPOCH_in_date.patch
new file mode 100644
index 0000000000..ffe63809b2
--- /dev/null
+++ b/development/fpc/patches/honor_SOURCE_DATE_EPOCH_in_date.patch
@@ -0,0 +1,55 @@
+Description: Reproducible builds requires that the build time stamp is not
+ recorded in binaries. In FPC they are fuild in via the $INCLUDE %DATE%
+ directive which calls getdatestr in globals.pas. To allow reproducible builds
+ we should honor the SOURCE_DATE_EPOCH environment variable. To not depend on
+ the dateutil unit, we include the required code from that package here.
+Author: Paul Gevers <elbrus@debian.org>
+Author: Abou Al Montacir <abou.almontacir@sfr.fr>
+
+Index: fpc/fpcsrc/compiler/globals.pas
+===================================================================
+--- fpc.orig/fpcsrc/compiler/globals.pas
++++ fpc/fpcsrc/compiler/globals.pas
+@@ -559,6 +559,7 @@ interface
+ startsystime : TSystemTime;
+
+ function getdatestr:string;
++ Function UnixToDateTime(const AValue: Int64): TDateTime;
+ function gettimestr:string;
+ function filetimestring( t : longint) : string;
+ function getrealtime(const st: TSystemTime) : real;
+@@ -816,12 +817,34 @@ implementation
+ get the current date in a string YY/MM/DD
+ }
+ var
++ Year,Month,Day: Word;
+ st: TSystemTime;
++ SourceDateEpoch: string;
+ begin
++ SourceDateEpoch := GetEnvironmentVariable('SOURCE_DATE_EPOCH');
++ if Length(SourceDateEpoch)>0 then
++ begin
++ DecodeDate(UnixToDateTime(StrToInt64(SourceDateEpoch)),Year,Month,Day);
++ getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
++ end
++ else
++ begin
+ GetLocalTime(st);
+ getdatestr:=L0(st.Year)+'/'+L0(st.Month)+'/'+L0(st.Day);
++ end;
+ end;
+
++ Function UnixToDateTime(const AValue: Int64): TDateTime;
++ { Code copied from fpcsrc/packages/rtl-objpas/src/inc/dateutil.inc and
++ fpcsrc/rtl/objpas/sysutils/datih.inc }
++ const
++ TDateTimeEpsilon = 2.2204460493e-16 ;
++ UnixEpoch = TDateTime(-2415018.5) + TDateTime(2440587.5) ;
++ begin
++ Result:=UnixEpoch + AValue/SecsPerDay;
++ if (UnixEpoch>=0) and (Result<-TDateTimeEpsilon) then
++ Result:=int(Result-1.0+TDateTimeEpsilon)-frac(1.0+frac(Result));
++ end;
+
+ function filetimestring( t : longint) : string;
+ {