git: 90d03b74c909 - main - lang/fpc-devel-source: New port: Free Pascal compiler with Turbo and Delphi compatibility (source)

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Sat, 28 Oct 2023 22:57:07 UTC
The branch main has been updated by acm:

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

commit 90d03b74c9096c9a4d4f239ae56e6ba8204b0506
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2023-10-28 22:56:20 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2023-10-28 22:56:20 +0000

    lang/fpc-devel-source: New port: Free Pascal compiler with Turbo and Delphi compatibility (source)
    
    Free Pascal is a mature, versatile, open source Pascal compiler. It can target
    many processor architectures: Intel x86 (16 and 32 bit), AMD64/x86-64, PowerPC,
    PowerPC64, SPARC, SPARC64, ARM, AArch64, MIPS, Motorola 68k, AVR, and the JVM.
    
    Supported operating systems include Windows (16/32/64 bit, CE, and native NT),
    Linux, Mac OS X/iOS/iPhoneSimulator/Darwin, FreeBSD and other BSD flavors, DOS
    (16 bit, or 32 bit DPMI), OS/2, AIX, Android, Haiku, Nintendo GBA/DS/Wii,
    AmigaOS, MorphOS, AROS, Atari TOS, and various embedded platforms. Additionally,
    support for RISC-V (32/64), Xtensa, and Z80 architectures, and for the LLVM
    compiler infrastructure is available in the development version. Additionally,
    the Free Pascal team maintains a transpiler for pascal to Javascript called
    pas2js.
---
 lang/Makefile                   |   1 +
 lang/fpc-devel-source/Makefile  | 111 ++++++++++++++++++++++++++++++++++++++++
 lang/fpc-devel-source/distinfo  |   3 ++
 lang/fpc-devel-source/pkg-descr |  12 +++++
 4 files changed, 127 insertions(+)

diff --git a/lang/Makefile b/lang/Makefile
index 9c731a06ab2a..6372613f4f94 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -74,6 +74,7 @@
     SUBDIR += fpc
     SUBDIR += fpc-base
     SUBDIR += fpc-devel
+    SUBDIR += fpc-devel-source
     SUBDIR += fpc-docs
     SUBDIR += fpc-lua
     SUBDIR += fpc-pastojs
diff --git a/lang/fpc-devel-source/Makefile b/lang/fpc-devel-source/Makefile
new file mode 100644
index 000000000000..b5f86a1c3124
--- /dev/null
+++ b/lang/fpc-devel-source/Makefile
@@ -0,0 +1,111 @@
+PORTNAME=	fpc-devel
+PORTVERSION=	3.3.1.20231027
+PORTREVISION=	0
+CATEGORIES=	lang
+PKGNAMESUFFIX=	-source
+DIST_SUBDIR=	freepascal
+
+MAINTAINER=	acm@FreeBSD.org
+COMMENT=	Free Pascal compiler with Turbo and Delphi compatibility (source)
+WWW=		https://www.freepascal.org/
+
+ONLY_FOR_ARCHS=	amd64 i386
+NO_BUILD=	yes
+
+USE_GITLAB=	yes
+GL_SITE=	https://gitlab.com/freepascal.org
+GL_ACCOUNT=	fpc
+GL_PROJECT=	source
+GL_COMMIT=	55e72fc0f1505c75f60af706736d32ceca9815a4
+
+PORTDATA=	*
+
+PATCHDIR=	${PORTSDIR}/lang/fpc-devel/files
+DATADIR=	${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX}-${FPCBASEVER}
+WRKSRC=		${WRKDIR}/${FPCSRCDIR}
+
+FPCBASEVER=	3.3.1
+FPCSRCDIR=	source-${GL_COMMIT}
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "i386"
+FPC_ARCH=	i386
+.elif ${ARCH} == "amd64"
+FPC_ARCH=	x86_64
+.endif
+
+post-extract:
+	${RM} -R ${WRKSRC}/.git*
+
+post-patch:
+.if ${OPSYS} == FreeBSD
+	@${REINPLACE_CMD} -i "" -e 's|900044|${OSVERSION}|g' \
+				-e 's|1201000|${OSVERSION}|g' \
+				-e 's|1200000|${OSVERSION}|g' \
+		${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
+.endif
+.if empty(ICONV_LIB)
+	@${REINPLACE_CMD} -i "" -e "s|s<>'c'|(s<>'c') and (s<>'iconv')|" \
+		-e "s|%%FPC_LDPATH%%|${FPC_LDPATH}|g" \
+			${WRKDIR}/${FPCSRCDIR}/compiler/systems/t_bsd.pas
+			@${REINPLACE_CMD} -e 's|defined(bsd) and not ||' \
+		${WRKDIR}/${FPCSRCDIR}/rtl/unix/cwstring.pp
+.endif
+	@${REINPLACE_CMD} -i "" -e '/samplecfg/ {s/INSTALLEXE/INSTALLSCR/;}' \
+		${WRKDIR}/${FPCSRCDIR}/compiler/Makefile
+	@${REINPLACE_CMD} -i "" -e 's|/usr/local|${PREFIX}|g' \
+		${WRKDIR}/${FPCSRCDIR}/packages/fpmkunit/src/fpmkunit.pp
+# enable or disable units
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/a52/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/dts/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|freebsd,||g' \
+		${WRKSRC}/packages/fpgtk/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
+		${WRKSRC}/packages/gnome1/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
+		${WRKSRC}/packages/gtk1/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
+		${WRKSRC}/packages/imlib/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/ldap/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/libnettle/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/libsee/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/lua/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/mad/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/modplug/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/newt/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/oggvorbis/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/openal/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/opencl/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/proj4/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|os2|freebsd,os2|g' \
+		${WRKSRC}/packages/rexx/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/wasmedge/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/wasmtime/fpmake.pp
+	@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
+		${WRKSRC}/packages/zorba/fpmake.pp
+
+do-install:
+	(cd ${WRKSRC} && ${COPYTREE_SHARE} . \
+		${STAGEDIR}${DATADIR})
+
+.include <bsd.port.post.mk>
diff --git a/lang/fpc-devel-source/distinfo b/lang/fpc-devel-source/distinfo
new file mode 100644
index 000000000000..5cfcc5b295e1
--- /dev/null
+++ b/lang/fpc-devel-source/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1698525521
+SHA256 (freepascal/fpc-source-55e72fc0f1505c75f60af706736d32ceca9815a4_GL0.tar.gz) = 6e8cf9b2c0b76462645239c2cd555f854536c857a01b5afb46bb2f3b6ac33061
+SIZE (freepascal/fpc-source-55e72fc0f1505c75f60af706736d32ceca9815a4_GL0.tar.gz) = 55866150
diff --git a/lang/fpc-devel-source/pkg-descr b/lang/fpc-devel-source/pkg-descr
new file mode 100644
index 000000000000..819965617bb1
--- /dev/null
+++ b/lang/fpc-devel-source/pkg-descr
@@ -0,0 +1,12 @@
+Free Pascal is a mature, versatile, open source Pascal compiler. It can target
+many processor architectures: Intel x86 (16 and 32 bit), AMD64/x86-64, PowerPC,
+PowerPC64, SPARC, SPARC64, ARM, AArch64, MIPS, Motorola 68k, AVR, and the JVM.
+
+Supported operating systems include Windows (16/32/64 bit, CE, and native NT),
+Linux, Mac OS X/iOS/iPhoneSimulator/Darwin, FreeBSD and other BSD flavors, DOS
+(16 bit, or 32 bit DPMI), OS/2, AIX, Android, Haiku, Nintendo GBA/DS/Wii,
+AmigaOS, MorphOS, AROS, Atari TOS, and various embedded platforms. Additionally,
+support for RISC-V (32/64), Xtensa, and Z80 architectures, and for the LLVM
+compiler infrastructure is available in the development version. Additionally,
+the Free Pascal team maintains a transpiler for pascal to Javascript called
+pas2js.