git: d2209ba1fbe3 - main - lang/fpc-*: Update bootstrap to 3.2.2

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Sat, 18 Jun 2022 04:20:45 UTC
The branch main has been updated by acm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d2209ba1fbe3ab5176ccad59177ce6285254ce60

commit d2209ba1fbe3ab5176ccad59177ce6285254ce60
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2022-06-18 04:14:03 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2022-06-18 04:20:22 +0000

    lang/fpc-*: Update bootstrap to 3.2.2
    
    - Update i386 and amd64 bootstrap to 3.2.2
    - Fix issues with new stat struct
    - Now i386 is build using FPC_USE_LIBC
    - Fix build on i386 when FPC_USE_LIBC is used
    - Update fpc source code to newer kernel syscalls. It removes COMPAT11
      dependency. Now these ports support FreeBSD >= 12.x
    - Bump PORTREVISION
---
 graphics/fpc-rsvg/Makefile                       |  2 +-
 lang/fpc-source/Makefile                         |  3 +-
 lang/fpc/Makefile                                | 13 ++--
 lang/fpc/Makefile.units                          |  2 +-
 lang/fpc/distinfo                                | 10 ++--
 lang/fpc/files/patch-freebsd-i386_cprt0.as       | 26 ++++++++
 lang/fpc/files/patch-rtl-bsd_bunxsysc.inc        | 28 +++++++--
 lang/fpc/files/patch-rtl-bsd_ostypes.inc         | 76 ++++++++++++++++++++++++
 lang/fpc/files/patch-rtl-freebsd-x86_64_cprt0.as | 26 ++++++++
 lang/fpc/files/patch-rtl-freebsd_ptypes.inc      | 51 ++++++++++++++++
 lang/fpc/files/patch-rtl-freebsd_sysnr.inc       | 14 +++--
 lang/fpc/files/patch-rtl-unix_bunxh.inc          |  4 +-
 lang/fpc/files/patch-rtl-unix_oscdeclh.inc       | 11 ++++
 lang/fpc/files/patch-rtl_bsd_ossysc.inc          | 51 +++++++++++++++-
 net/fpc-ldap/Makefile                            |  2 +-
 textproc/fpc-libxml2/Makefile                    |  2 +-
 16 files changed, 289 insertions(+), 32 deletions(-)

diff --git a/graphics/fpc-rsvg/Makefile b/graphics/fpc-rsvg/Makefile
index 0085c6dd73ea..4a06d935a981 100644
--- a/graphics/fpc-rsvg/Makefile
+++ b/graphics/fpc-rsvg/Makefile
@@ -1,6 +1,6 @@
 # Created by: Christopher Key <cjk32@cam.ac.uk>
 
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	graphics lang
 PKGNAMESUFFIX=	-rsvg
 
diff --git a/lang/fpc-source/Makefile b/lang/fpc-source/Makefile
index 58c788c060e9..3eab6d0a4af1 100644
--- a/lang/fpc-source/Makefile
+++ b/lang/fpc-source/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	fpc
 PORTVERSION=	3.2.2
+PORTREVISION=	1
 DISTVERSIONSUFFIX=.source
 CATEGORIES=	lang
 MASTER_SITES=	ftp://ftp.freepascal.org/pub/fpc/dist/${PORTVERSION}/source/ \
@@ -13,7 +14,7 @@ PKGNAMESUFFIX=	-source
 DIST_SUBDIR=	freepascal
 
 MAINTAINER=	acm@FreeBSD.org
-COMMENT=	Free Pascal compiler with Turbo and Delphi (source)
+COMMENT=	Free Pascal compiler with Turbo and Delphi compatibility (source)
 
 ONLY_FOR_ARCHS=	amd64 i386
 NO_BUILD=	yes
diff --git a/lang/fpc/Makefile b/lang/fpc/Makefile
index b64e3d709aa0..2e89ee58da7a 100644
--- a/lang/fpc/Makefile
+++ b/lang/fpc/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	fpc
 PORTVERSION=	3.2.2
-PORTREVISION?=	1
+PORTREVISION?=	2
 CATEGORIES?=	lang
 MASTER_SITES=	ftp://ftp.freepascal.org/pub/fpc/dist/${PORTVERSION}/source/:source \
 		ftp://planetmirror.com/pub/fpc/dist/${PORTVERSION}/source/:source \
@@ -18,7 +18,7 @@ DISTFILES=	${DISTNAME:S/$/.source/}${EXTRACT_SUFX}:source
 DIST_SUBDIR=	freepascal
 
 MAINTAINER?=	acm@FreeBSD.org
-COMMENT?=	Free Pascal compiler with Turbo and Delphi
+COMMENT?=	Free Pascal compiler with Turbo and Delphi compatibility
 
 RUN_DEPENDS?=	${LOCALBASE}/bin/as:devel/binutils
 
@@ -26,14 +26,11 @@ ONLY_FOR_ARCHS=	amd64 i386
 
 USES+=		gmake iconv
 USE_BINUTILS=	yes
-BOOTVER=	3.0.4
+BOOTVER=	${PORTVERSION}
 MANVER=		${PORTVERSION}
 
 FPC_LDPATH?=	"${LOCALBASE}/bin/ld.bfd"
 
-#USE_GITHUB=	yes
-#GH_ACCOUNT=	fpc-svn
-#GH_PROJECT=	fpc
 FPCSRCDIR=	${PORTNAME}-${PORTVERSION}
 
 .include <bsd.port.pre.mk>
@@ -41,6 +38,7 @@ FPCSRCDIR=	${PORTNAME}-${PORTVERSION}
 .if ${ARCH} == "i386"
 PPNAME=		ppc386
 FPC_ARCH=	i386
+OPT=		"-dFPC_USE_LIBC"
 PLIST_SUB+=	FPC_I386="" \
 		FPC_AMD64="@comment "
 .elif ${ARCH} == "amd64"
@@ -108,7 +106,8 @@ do-extract:
 post-patch:
 .if ${OPSYS} == FreeBSD
 	@${REINPLACE_CMD} -i "" -e 's|900044|${OSVERSION}|g' \
-		${WRKSRC}/rtl/freebsd/${FPC_ARCH}/*.as
+		${WRKSRC}/rtl/freebsd/${FPC_ARCH}/*.as \
+		${WRKSRC}/rtl/freebsd/${FPC_ARCH}/*.inc
 .else
 	@${REINPLACE_CMD} -i "" -e 's|400000|${DFLYVERSION}|g' \
 		${WRKSRC}/rtl/dragonfly/${FPC_ARCH}/*.as
diff --git a/lang/fpc/Makefile.units b/lang/fpc/Makefile.units
index dfc2fc0e003a..7eeb7e06cb8c 100644
--- a/lang/fpc/Makefile.units
+++ b/lang/fpc/Makefile.units
@@ -12,7 +12,7 @@ WRKSRC=		${WRKDIR}/${FPCSRCDIR}
 BUILD_WRKSRC=	${WRKDIR}/${WRKUNITDIR}
 INSTALL_WRKSRC=	${WRKDIR}/${WRKUNITDIR}
 
-OPT+=		-Ur
+OPT+=		-Ur -va
 FPCDIR?=	${LOCALBASE}/lib/fpc/${PORTVERSION}
 UNITPREFIX=    	unit-
 UNITNAME=	${UNITPREFIX}${PKGNAMESUFFIX:S/-//}${BUILDNAME:S/^/./}${UNITEXTRACT_SUFX}
diff --git a/lang/fpc/distinfo b/lang/fpc/distinfo
index 7208db1b1c60..a457da702aa3 100644
--- a/lang/fpc/distinfo
+++ b/lang/fpc/distinfo
@@ -1,9 +1,9 @@
-TIMESTAMP = 1627713160
+TIMESTAMP = 1655522950
 SHA256 (freepascal/fpc-3.2.2.source.tar.gz) = d542e349de246843d4f164829953d1f5b864126c5b62fd17c9b45b33e23d2f44
 SIZE (freepascal/fpc-3.2.2.source.tar.gz) = 52240052
-SHA256 (freepascal/ppc386-3.0.4-freebsd.tar.gz) = 3f5fa4b24abde00a1dcfe7e28938e8b7bf908c7d6633182521916e2191ae867d
-SIZE (freepascal/ppc386-3.0.4-freebsd.tar.gz) = 1121653
-SHA256 (freepascal/ppcx64-3.0.4-freebsd.tar.gz) = fb57c418ec374ed99cd7914a4daa5fc6afccfbf41595a886c361e3fef8bbdbb3
-SIZE (freepascal/ppcx64-3.0.4-freebsd.tar.gz) = 1198576
+SHA256 (freepascal/ppc386-3.2.2-freebsd.tar.gz) = 146ed6ce89d3e566a89608021efe79774ca2ce6d996abf9f00bb5ac070cd060e
+SIZE (freepascal/ppc386-3.2.2-freebsd.tar.gz) = 1361735
+SHA256 (freepascal/ppcx64-3.2.2-freebsd.tar.gz) = ea29622ec89148d6d24360ca093e33b4d067fd1596c654c5371d7e870fb03342
+SIZE (freepascal/ppcx64-3.2.2-freebsd.tar.gz) = 2052926
 SHA256 (freepascal/fpc-3.2.2.man.tar.gz) = 4b7d7d50922531fa01e00d0bc913abb40426ba3001579240bf3db3f4ad640584
 SIZE (freepascal/fpc-3.2.2.man.tar.gz) = 47334
diff --git a/lang/fpc/files/patch-freebsd-i386_cprt0.as b/lang/fpc/files/patch-freebsd-i386_cprt0.as
new file mode 100644
index 000000000000..0e4b21d404c1
--- /dev/null
+++ b/lang/fpc/files/patch-freebsd-i386_cprt0.as
@@ -0,0 +1,26 @@
+--- rtl/freebsd/i386/cprt0.as	2022-06-16 22:38:18.787786000 -0500
++++ rtl/freebsd/i386/cprt0.as	2022-06-16 22:39:54.403673000 -0500
+@@ -35,16 +35,21 @@
+ 
+         .file   "cprt0.as"
+         .ident  "FreePascal 2.6.x/2.7.x series dynlinked to libc"
+-.section        .note.ABI-tag,"a",@progbits
++.section        .note.tag,"a",@note
+         .p2align 2
+         .type   abitag, @object
+-        .size   abitag, 24
++        .size   abitag, 48
+ abitag:
+         .long   8
+         .long   4
+         .long   1
+         .string "FreeBSD"
+         .long   900044
++        .long   8
++        .long   4
++        .long   1
++        .string "FreeBSD"
++        .long   0
+         .section	.rodata.str1.1,"aMS",@progbits,1
+ .LC0:
+         .string ""
diff --git a/lang/fpc/files/patch-rtl-bsd_bunxsysc.inc b/lang/fpc/files/patch-rtl-bsd_bunxsysc.inc
index 58cb0c24d934..835a089c15ec 100644
--- a/lang/fpc/files/patch-rtl-bsd_bunxsysc.inc
+++ b/lang/fpc/files/patch-rtl-bsd_bunxsysc.inc
@@ -1,6 +1,6 @@
---- rtl/bsd/bunxsysc.inc.orig	2015-07-14 16:58:27.000000000 -0500
-+++ rtl/bsd/bunxsysc.inc	2021-07-31 02:57:36.924782000 -0500
-@@ -374,39 +374,11 @@
+--- rtl/bsd/bunxsysc.inc	2015-07-14 16:58:27.000000000 -0500
++++ rtl/bsd/bunxsysc.inc	2022-05-27 11:25:13.139710000 -0500
+@@ -374,40 +374,12 @@
   FPutime:=do_syscall(syscall_nr_utimes,TSysParam(path),TSysParam(tvp));
  end;
  
@@ -33,12 +33,30 @@
 -    movl %edx, b
 -  {$endif}
 -  end;
--
+ 
 -  fpPipe := a; // eax is in a, no matter if it worked or not
 -  fildes[0] := a;
 -  fildes[1] := b;
 -end;
 -{$endif}
- 
+-
  function FPfcntl(fildes:cint;Cmd:cint;Arg:cint):cint;
  
+ begin
+@@ -497,9 +469,15 @@
+ {
+   Get all information on a link (the link itself), and return it in info.
+ }
+-
++const
++  AT_FDCWD=-100;
++  AT_SYMLINK_NOFOLLOW=$0200;
+ begin
++{$ifdef freebsd}
++ fpLStat:=do_syscall(syscall_nr_fstatat,AT_FDCWD,TSysParam(path),TSysParam(Info),AT_SYMLINK_NOFOLLOW);
++{$else}
+  fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
++{$endif}
+ end;
+ 
+ function fpNice(N:cint):cint;
diff --git a/lang/fpc/files/patch-rtl-bsd_ostypes.inc b/lang/fpc/files/patch-rtl-bsd_ostypes.inc
new file mode 100644
index 000000000000..df225b39632b
--- /dev/null
+++ b/lang/fpc/files/patch-rtl-bsd_ostypes.inc
@@ -0,0 +1,76 @@
+--- rtl/bsd/ostypes.inc	2019-05-04 17:02:10.000000000 -0500
++++ rtl/bsd/ostypes.inc	2022-05-24 17:03:10.944070000 -0500
+@@ -107,6 +107,45 @@
+         st_gen        : cuint32;           // file generation number
+         st_birthtime  : time_t;            // File creation time
+         st_birthtimensec : clong;          // nsec of file creation time
++{$elseif defined(freebsd)}
++{$ifdef i386}
++{$define __STAT_TIME_T_EXT}
++{$endif}
++        st_dev        : dev_t;             // inode's device
++        st_ino        : ino_t;             // inode's number
++        st_nlink      : nlink_t;           // number of hard links
++        st_mode       : mode_t;            // inode protection mode
++	st_padding0   : cint16;
++        st_uid        : uid_t;             // user ID of the file's owner
++        st_gid        : gid_t;             // group ID of the file's group
++	st_padding1   : cint32;
++        st_rdev       : dev_t;             // device type
++{$ifdef __STAT_TIME_T_EXT}
++        st_atim_ext   : cint32;
++{$endif}
++        st_atime      : time_t;            // time of last access
++        st_atimensec  : clong;             // nsec of last access
++{$ifdef __STAT_TIME_T_EXT}
++        st_mtim_ext   : cint32;
++{$endif}
++        st_mtime      : time_t;            // time of last data modification
++        st_mtimensec  : clong;             // nsec of last data modification
++{$ifdef __STAT_TIME_T_EXT}
++        st_ctim_ext   : cint32;
++{$endif}
++        st_ctime      : time_t;            // time of last file status change
++        st_ctimensec  : clong;             // nsec of last file status change
++{$ifdef __STAT_TIME_T_EXT}
++        st_birthtim_ext   : cint32;
++{$endif}
++        st_birthtime  : time_t;            // File creation time
++        st_birthtimensec : clong;          // nsec of file creation time
++        st_size       : off_t;             // file size, in bytes
++        st_blocks     : cint64;            // blocks allocated for file
++        st_blksize    : cint32;            // optimal blocksize for I/O
++        st_flags      : cuint32;           // user defined flags for file
++        st_gen        : cuint64;           // file generation number
++	st_spare      : array [0..10-1] of cuint64;
+ {$else}
+         st_dev        : dev_t;             // inode's device
+ {$ifdef darwin_new_iostructs}
+@@ -189,6 +228,17 @@
+         d_padding     : array[0..3] of cuint8;
+         d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
+    end;
++{$elseif defined(freebsd)}
++   dirent  = record
++        d_fileno      : ino_t;
++        d_off         : off_t;
++        d_reclen      : cuint16;                        // length of this record
++        d_type        : cuint8;                         // file type, see below
++	d_pad0        : cuint8;
++        d_namlen      : cuint16;                        // length of string in d_name
++	d_pad1        : cuint16;
++        d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
++   end;
+ {$else}
+    dirent  = record
+         d_fileno      : cuint32;                        // file number of entry
+@@ -242,6 +292,9 @@
+                 l_pid   : pid_t;        { lock owner }
+                 l_type  : cshort;       { lock type: read/write, etc. }
+                 l_whence: cshort;       { type of l_start }
++{$ifdef freebsd}
++                l_sysid : cint;
++{$endif}
+                 end;
+    TFlock   = flock;
+    pFlock   = ^flock;
diff --git a/lang/fpc/files/patch-rtl-freebsd-x86_64_cprt0.as b/lang/fpc/files/patch-rtl-freebsd-x86_64_cprt0.as
new file mode 100644
index 000000000000..66662b21416d
--- /dev/null
+++ b/lang/fpc/files/patch-rtl-freebsd-x86_64_cprt0.as
@@ -0,0 +1,26 @@
+--- rtl/freebsd/x86_64/cprt0.as	2022-06-16 22:35:12.252513000 -0500
++++ rtl/freebsd/x86_64/cprt0.as	2022-06-16 22:36:47.506865000 -0500
+@@ -32,16 +32,21 @@
+ #APP
+         .ident  "FreePascal 2.6.x/2.7.x series dynlinked to libc"
+ #NO_APP
+-	.section	.note.ABI-tag,"a",@progbits
++	.section	.note.tag,"a",@note
+ 	.align 4
+ 	.type	abitag, @object
+-	.size	abitag, 24
++	.size	abitag, 48
+ abitag:
+ 	.long	8
+ 	.long	4
+ 	.long	1
+ 	.string	"FreeBSD"
+ 	.long	900044
++	.long	8
++	.long	4
++	.long	1
++	.string	"FreeBSD"
++	.long	0
+ .globl __progname
+ 	.section	.rodata
+ .LC0:
diff --git a/lang/fpc/files/patch-rtl-freebsd_ptypes.inc b/lang/fpc/files/patch-rtl-freebsd_ptypes.inc
new file mode 100644
index 000000000000..5e19ec1792ae
--- /dev/null
+++ b/lang/fpc/files/patch-rtl-freebsd_ptypes.inc
@@ -0,0 +1,51 @@
+--- rtl/freebsd/ptypes.inc	2013-02-10 12:51:29.000000000 -0500
++++ rtl/freebsd/ptypes.inc	2022-05-29 19:24:36.804227000 -0500
+@@ -26,7 +26,7 @@
+     SEM_SAFE=255;
+ type
+ 
+-    dev_t    = cuint32;         { used for device numbers      }
++    dev_t    = cuint64;         { used for device numbers      }
+     TDev     = dev_t;
+     pDev     = ^dev_t;
+ 
+@@ -35,11 +35,7 @@
+     pGid     = ^gid_t;
+     TIOCtlRequest = cuLong;
+ 
+-    {$ifdef CPU64}
+-     ino_t    = cuint32;           { used for file serial numbers }
+-    {$else}	
+-     ino_t    = clong;           { used for file serial numbers }
+-    {$endif}
++    ino_t    = cuint64;           { used for file serial numbers }
+     TIno     = ino_t;
+     pIno     = ^ino_t;
+ 
+@@ -47,7 +43,7 @@
+     TMode    = mode_t;
+     pMode    = ^mode_t;
+ 
+-    nlink_t  = cuint16;         { used for link counts         }
++    nlink_t  = cuint64;         { used for link counts         }
+     TnLink   = nlink_t;
+     pnLink   = ^nlink_t;
+ 
+@@ -195,7 +191,7 @@
+ 
+ Type TStatFS =  {?} Record
+        case boolean of
+-       0 : ( // current FreeBSD
++       false : ( // current FreeBSD
+         version     : cuint32;        { structure version number }
+         ftype       : cuint32;        { type of filesystem }
+         fflags      : cuint64;        { copy of mount exported flags }
+@@ -219,7 +215,7 @@
+         mnfromname  : array[0..MNAMELEN-1]   of ansichar; { mounted filesystem }
+         mountpoint  : array[0..MNAMELEN-1]   of ansichar; { directory on which mounted }
+         );
+-        1:( // union for old fieldname's sake.
++        true:( // union for old fieldname's sake.
+         f_version     : cuint32;        { structure version number }
+         f_type        : cuint32;        { type of filesystem }
+         f_flags       : cuint64;        { copy of mount exported flags }
diff --git a/lang/fpc/files/patch-rtl-freebsd_sysnr.inc b/lang/fpc/files/patch-rtl-freebsd_sysnr.inc
index e8a14fb76f48..a4184c7bf5e7 100644
--- a/lang/fpc/files/patch-rtl-freebsd_sysnr.inc
+++ b/lang/fpc/files/patch-rtl-freebsd_sysnr.inc
@@ -1,5 +1,5 @@
---- rtl/freebsd/sysnr.inc	2020-02-21 13:23:53.181811000 -0500
-+++ rtl/freebsd/sysnr.inc	2020-02-21 17:55:07.026920000 -0500
+--- rtl/freebsd/sysnr.inc	2019-09-03 08:30:49.000000000 -0500
++++ rtl/freebsd/sysnr.inc	2022-05-27 11:07:33.577303000 -0500
 @@ -16,9 +16,9 @@
  {More or less checked/in use FreeBSD syscalls}
   syscall_nr_readv                       = 120;
@@ -13,16 +13,17 @@
   syscall_nr_msgsys                      = 170;
   syscall_nr_shmsys                      = 171;
   syscall_nr_mkfifo                      = 132;
-@@ -48,15 +48,15 @@
+@@ -48,15 +48,17 @@
   syscall_nr_fcntl                       =  92;
   syscall_nr_flock                       = 131;
   syscall_nr_fork                        =   2;
 - syscall_nr_fstat                       = 189;
-+ syscall_nr_fstat                       = 189;  // COMPAT11x
++ syscall_nr_fstat                       = 551;  // COMPAT11x 189
++ syscall_nr_fstatat                     = 552;
   syscall_nr_statfs4                     = 157;  // COMPAT4x
   syscall_nr_fstatfs4                    = 158;  // COMPAT4x
 - syscall_nr_getfsstat                   = 395;  
-+ syscall_nr_getfsstat                   = 395;  // COMPAT11x
++ syscall_nr_getfsstat                   = 557;  // COMPAT11x 395
   syscall_nr_statfs                      = 396;  
   syscall_nr_fstatfs                     = 397;  
   syscall_nr_fsync                       =  95;
@@ -30,10 +31,11 @@
 - syscall_nr_getdents                    = 272;
 + syscall_nr_ftruncate                   = 480;
 + syscall_nr_getdents                    = 272; 
++ syscall_nr_getdirentries               = 554; 
   syscall_nr_getegid                     =  43;
   syscall_nr_geteuid                     =  25;
   syscall_nr_getgid                      =  47;
-@@ -70,15 +70,16 @@
+@@ -70,15 +72,16 @@
   syscall_nr_ioctl                       =  54;
   syscall_nr_kill                        =  37;
   syscall_nr_link                        =   9;
diff --git a/lang/fpc/files/patch-rtl-unix_bunxh.inc b/lang/fpc/files/patch-rtl-unix_bunxh.inc
index bc8ae3f5a68a..5fb2ec529b41 100644
--- a/lang/fpc/files/patch-rtl-unix_bunxh.inc
+++ b/lang/fpc/files/patch-rtl-unix_bunxh.inc
@@ -1,5 +1,5 @@
---- rtl/unix/bunxh.inc	2020-02-21 18:37:42.890255000 -0500
-+++ rtl/unix/bunxh.inc	2020-02-21 18:38:00.256721000 -0500
+--- rtl/unix/bunxh.inc	2019-11-05 11:17:53.000000000 -0500
++++ rtl/unix/bunxh.inc	2022-05-27 15:51:22.481698000 -0500
 @@ -34,7 +34,7 @@
      Function  FpChmod      (path : pChar; Mode : TMode): cInt;
      Function  FpChown      (path : pChar; owner : TUid; group : TGid): cInt;
diff --git a/lang/fpc/files/patch-rtl-unix_oscdeclh.inc b/lang/fpc/files/patch-rtl-unix_oscdeclh.inc
new file mode 100644
index 000000000000..00b6f0021e10
--- /dev/null
+++ b/lang/fpc/files/patch-rtl-unix_oscdeclh.inc
@@ -0,0 +1,11 @@
+--- rtl/unix/oscdeclh.inc	2022-06-17 00:46:14.261191000 -0500
++++ rtl/unix/oscdeclh.inc	2022-06-17 00:48:10.379917000 -0500
+@@ -50,7 +50,7 @@
+     Function  FpChmod      (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
+     Function  FpChown   (path : pChar; owner : TUid; group : TGid): cInt; cdecl; external clib name 'chown';
+     Function  FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
+-    Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
++    Function  FpPipe       (var fildes : tfildes; flags:cint):cInt; cdecl;external clib name 'pipe2';
+     function  FpDup     (oldd:cint):cint; cdecl; external clib name 'dup';
+     function  FpDup2    (oldd:cint;newd:cint):cint; cdecl; external clib name 'dup2';
+     function  FpTimes	(var buffer : tms): TClock; cdecl; external clib name 'times';
diff --git a/lang/fpc/files/patch-rtl_bsd_ossysc.inc b/lang/fpc/files/patch-rtl_bsd_ossysc.inc
index 9642dbf97e80..f51a375198cc 100644
--- a/lang/fpc/files/patch-rtl_bsd_ossysc.inc
+++ b/lang/fpc/files/patch-rtl_bsd_ossysc.inc
@@ -1,5 +1,5 @@
---- rtl/bsd/ossysc.inc	2020-10-03 18:58:28.503033000 -0500
-+++ rtl/bsd/ossysc.inc	2020-10-03 19:01:01.207504000 -0500
+--- rtl/bsd/ossysc	2019-11-05 11:17:53.000000000 -0500
++++ rtl/bsd/ossysc.inc	2022-05-28 16:58:54.884379000 -0500
 @@ -76,9 +76,9 @@
  
  begin
@@ -36,3 +36,50 @@
           {$ifdef FPC_BIG_ENDIAN}    hi(offst),lo(offst){$endif}
           {$ifdef FPC_LITTLE_ENDIAN} lo(offst),hi(offst){$endif}
           )));
+@@ -138,10 +138,20 @@
+   Fprename:=do_syscall(syscall_nr_rename,TSysParam(old),TSysParam(newpath));
+ end;
+ 
+-function Fpstat(const path: pchar; var buf : stat):cint; [public, alias : 'FPC_SYSC_STAT'];
++Function fpFstatat(fd: cint; path: pchar; var sb: stat; flag: cint):cint;
++begin
++ fpFStatat:=do_syscall(syscall_nr_fstatat,fd,TSysParam(path),TSysParam(@sb),flag);
++end;
+ 
++function Fpstat(const path: pchar; var buf : stat):cint; [public, alias : 'FPC_SYSC_STAT'];
++const
++ AT_FDCWD=-100;
+ begin
++{$ifdef freebsd}
++ Fpstat:=FpFstatat(AT_FDCWD, path, buf, 0);
++{$else}
+  Fpstat:=do_syscall(syscall_nr_stat,TSysParam(path),TSysParam(@buf));
++{$endif}
+ end;
+ 
+ 
+@@ -171,6 +181,12 @@
+ 
+ const DIRBLKSIZ=1024;
+ 
++{$ifdef freebsd}
++function FpGetdirentries(fd : cint; buf : pchar; nbytes : clong) : cint;
++begin
++  FpGetdirentries:=do_syscall(syscall_nr_getdirentries,fd,TSysParam(buf), nbytes);
++end;
++{$endif}
+ 
+ function Fpfstat(fd : cint; var sb : stat): cint; forward;
+ 
+@@ -247,7 +263,11 @@
+ 
+ var retval :longint;
+ begin
++{$ifdef freebsd}
++ Retval:=FpGetdirentries(dirp^.dd_fd, @dirp^.dd_buf^, DIRBLKSIZ {sizeof(getdentsbuffer)});
++{$else}
+  Retval:=do_syscall(syscall_nr_getdents,TSysParam(dirp^.dd_fd),TSysParam(@dirp^.dd_buf^),DIRBLKSIZ {sizeof(getdentsbuffer)});
++{$endif}
+    dirp^.dd_rewind:=TSysParam(dirp^.dd_buf);
+    if retval=0 then
+     begin
diff --git a/net/fpc-ldap/Makefile b/net/fpc-ldap/Makefile
index 60fac8f72b58..f96508a6613c 100644
--- a/net/fpc-ldap/Makefile
+++ b/net/fpc-ldap/Makefile
@@ -1,6 +1,6 @@
 # Created by: Christopher Key <cjk32@cam.ac.uk>
 
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net lang
 PKGNAMESUFFIX=	-ldap
 
diff --git a/textproc/fpc-libxml2/Makefile b/textproc/fpc-libxml2/Makefile
index 2822aeefc0c9..969104bccff3 100644
--- a/textproc/fpc-libxml2/Makefile
+++ b/textproc/fpc-libxml2/Makefile
@@ -1,6 +1,6 @@
 # Created by: Christoper Key <cjk32@cam.ac.uk>
 
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	textproc lang
 PKGNAMESUFFIX=	-libxml2