From 890b2531a2b48b78dd243d0a874664498840f3a0 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Wed, 13 Mar 2024 12:58:57 +0000 Subject: [PATCH] extra/fpc to 3.2.2-10 --- extra/fpc/.SRCINFO | 6 +- extra/fpc/PKGBUILD | 18 ++++-- .../fpc/honor_SOURCE_DATE_EPOCH_in_date.patch | 55 +++++++++++++++++++ extra/fpc/prevent_date_in_fpcdocs.patch | 17 ++++++ 4 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 extra/fpc/honor_SOURCE_DATE_EPOCH_in_date.patch create mode 100644 extra/fpc/prevent_date_in_fpcdocs.patch diff --git a/extra/fpc/.SRCINFO b/extra/fpc/.SRCINFO index d9188031a..6dd601f11 100644 --- a/extra/fpc/.SRCINFO +++ b/extra/fpc/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = fpc pkgdesc = Free Pascal Compiler, Turbo Pascal 7.0 and Delphi compatible. pkgver = 3.2.2 - pkgrel = 9 + pkgrel = 10 url = http://www.freepascal.org/ arch = x86_64 license = GPL @@ -18,6 +18,10 @@ pkgbase = fpc options = staticlibs backup = etc/fpc.cfg source = https://downloads.sourceforge.net/project/freepascal/Source/3.2.2/fpcbuild-3.2.2.tar.gz + source = honor_SOURCE_DATE_EPOCH_in_date.patch + source = prevent_date_in_fpcdocs.patch sha512sums = 75889bb54adc70a6e2cbd291476b9b12d61c8f943a05b7d16d2024de3215c935465ff43b1400c412e128e260c7f49a9c66e35c21f86cb866e671b5b60a282d82 + sha512sums = a2261628760e85fc0a8f427b56b6054b9bd2b3641bd5c1a9e757a4d0c307162c8cce84c4623789606bddf14f4a010fd6f3020c38928d8e8825b05e6f7e390fa1 + sha512sums = 26c036ba37982881ce9ae318e32b0ccdda54a6e477dbb54953b2f64dec2ff5a484282558da821d8ec43d7616593d8482813b42623acc7b4655f739b82aa3834f pkgname = fpc diff --git a/extra/fpc/PKGBUILD b/extra/fpc/PKGBUILD index 9aebd99a2..b4ec02afa 100644 --- a/extra/fpc/PKGBUILD +++ b/extra/fpc/PKGBUILD @@ -13,7 +13,7 @@ pkgname=fpc pkgver=3.2.2 -pkgrel=9 +pkgrel=10 pkgdesc="Free Pascal Compiler, Turbo Pascal 7.0 and Delphi compatible." arch=('x86_64') url="http://www.freepascal.org/" @@ -23,8 +23,18 @@ depends=('ncurses' 'zlib' 'expat' 'binutils' 'make') makedepends=(fpc) options=(zipman libtool staticlibs !lto) validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3') -source=("https://downloads.sourceforge.net/project/freepascal/Source/${pkgver}/fpcbuild-${pkgver}.tar.gz") -sha512sums=('75889bb54adc70a6e2cbd291476b9b12d61c8f943a05b7d16d2024de3215c935465ff43b1400c412e128e260c7f49a9c66e35c21f86cb866e671b5b60a282d82') +source=("https://downloads.sourceforge.net/project/freepascal/Source/${pkgver}/fpcbuild-${pkgver}.tar.gz" + honor_SOURCE_DATE_EPOCH_in_date.patch + prevent_date_in_fpcdocs.patch) +sha512sums=('75889bb54adc70a6e2cbd291476b9b12d61c8f943a05b7d16d2024de3215c935465ff43b1400c412e128e260c7f49a9c66e35c21f86cb866e671b5b60a282d82' + 'a2261628760e85fc0a8f427b56b6054b9bd2b3641bd5c1a9e757a4d0c307162c8cce84c4623789606bddf14f4a010fd6f3020c38928d8e8825b05e6f7e390fa1' + '26c036ba37982881ce9ae318e32b0ccdda54a6e477dbb54953b2f64dec2ff5a484282558da821d8ec43d7616593d8482813b42623acc7b4655f739b82aa3834f') + +prepare() { + cd "${srcdir}"/fpcbuild-${pkgver} + patch -Np1 -i ../honor_SOURCE_DATE_EPOCH_in_date.patch + patch -Np1 -i ../prevent_date_in_fpcdocs.patch +} build() { cd "${srcdir}"/fpcbuild-${pkgver} @@ -41,7 +51,7 @@ package() { export HOME="${srcdir}" - make -j1 PREFIX="${pkgdir}"/usr install + make -j1 PREFIX="${pkgdir}"/usr NO_MAN_COMPRESS=1 install export PATH="${pkgdir}"/usr/bin:$PATH diff --git a/extra/fpc/honor_SOURCE_DATE_EPOCH_in_date.patch b/extra/fpc/honor_SOURCE_DATE_EPOCH_in_date.patch new file mode 100644 index 000000000..ffe63809b --- /dev/null +++ b/extra/fpc/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 +Author: Abou Al Montacir + +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; + { diff --git a/extra/fpc/prevent_date_in_fpcdocs.patch b/extra/fpc/prevent_date_in_fpcdocs.patch new file mode 100644 index 000000000..deba80171 --- /dev/null +++ b/extra/fpc/prevent_date_in_fpcdocs.patch @@ -0,0 +1,17 @@ +Description: Timestamps in fpc documentation are hindering reproducible builds + Don't add the date to the footer of docs generated by fpdoc +Author: Paul Gevers +Forwarded: no +Index: fpc/fpcdocs/Makefile.fpc +=================================================================== +--- fpc.orig/fpcdocs/Makefile.fpc ++++ fpc/fpcdocs/Makefile.fpc +@@ -115,7 +115,7 @@ ifeq ($(HIDEPROTECTED),YES) + FCLOPTS+= --hide-protected + endif + +-FPDOCHTMLOPTS=--footer-date="mmm dd yyyy" ++FPDOCHTMLOPTS= + + ifeq (chm,$(HTMLFMT)) + HTMLSUFFIX:=.chm