git: 698eadbe278c - main - devel/shedskin: New port: Restricted Python-to-C++ compiler

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 27 May 2024 18:54:45 UTC
The branch main has been updated by yuri:

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

commit 698eadbe278c0e8c50da6082994e16bb4910a398
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-05-27 18:54:01 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-05-27 18:54:42 +0000

    devel/shedskin: New port: Restricted Python-to-C++ compiler
---
 devel/Makefile                                     |  1 +
 devel/shedskin/Makefile                            | 35 ++++++++++++++++++++++
 devel/shedskin/distinfo                            |  3 ++
 .../files/patch-shedskin_lib_os_____init____.cpp   | 19 ++++++++++++
 devel/shedskin/pkg-descr                           |  4 +++
 5 files changed, 62 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index e88694af9821..5750ddd2ea2f 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -7839,6 +7839,7 @@
     SUBDIR += shadered
     SUBDIR += shapelib
     SUBDIR += shards
+    SUBDIR += shedskin
     SUBDIR += shell-toolbox
     SUBDIR += shflags
     SUBDIR += shfmt
diff --git a/devel/shedskin/Makefile b/devel/shedskin/Makefile
new file mode 100644
index 000000000000..fe59996f5694
--- /dev/null
+++ b/devel/shedskin/Makefile
@@ -0,0 +1,35 @@
+PORTNAME=	shed-skin
+DISTVERSION=	0.9.8
+CATEGORIES=	devel python
+MASTER_SITES=	PYPI
+DISTNAME=	${PORTNAME:S/-/_/g}-${PORTVERSION}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Restricted Python-to-C++ compiler
+WWW=		https://shedskin.github.io/
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}poetry-core>0:devel/py-poetry-core@${PY_FLAVOR}
+RUN_DEPENDS=	boehm-gc>0:devel/boehm-gc \
+		pcre>0:devel/pcre
+
+USES=		python
+USE_PYTHON=	pep517 autoplist
+
+NO_ARCH=	yes
+
+post-extract:
+	@${RM} ${WRKSRC}/tests/test_ops_assignment/test_ops_assignment.py.orig
+
+post-patch:
+	# the fouth regex below is a workaround for https://github.com/shedskin/shedskin/issues/470
+	@${REINPLACE_CMD} -e ' \
+		s|^CC=.*|CC=${CXX}|; \
+		s|^CCFLAGS=|CCFLAGS?=-I${PREFIX}/include |; \
+		s|^LFLAGS=|LFLAGS=-L${PREFIX}/lib |; \
+		s|^CCFLAGS.*|& -I$$(SHEDSKIN_LIBDIR)|; \
+		' ${WRKSRC}/shedskin/resources/flags/FLAGS
+
+.include	<bsd.port.mk>
diff --git a/devel/shedskin/distinfo b/devel/shedskin/distinfo
new file mode 100644
index 000000000000..b375f34fc64d
--- /dev/null
+++ b/devel/shedskin/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1716797518
+SHA256 (shed_skin-0.9.8.tar.gz) = 2367ab06a29122d79cd2091b306711743a0b08836ee6291775ad049914670779
+SIZE (shed_skin-0.9.8.tar.gz) = 18176411
diff --git a/devel/shedskin/files/patch-shedskin_lib_os_____init____.cpp b/devel/shedskin/files/patch-shedskin_lib_os_____init____.cpp
new file mode 100644
index 000000000000..79bade3dc93c
--- /dev/null
+++ b/devel/shedskin/files/patch-shedskin_lib_os_____init____.cpp
@@ -0,0 +1,19 @@
+--- shedskin/lib/os/__init__.cpp.orig	2023-12-24 21:56:45 UTC
++++ shedskin/lib/os/__init__.cpp
+@@ -27,7 +27,7 @@
+ #include <sys/utsname.h>
+ #include <sys/statvfs.h>
+ 
+-#ifndef __APPLE__
++#if !defined(__APPLE__) && !defined(__FreeBSD__)
+ #include <sys/sysmacros.h>
+ #endif
+ 
+@@ -42,6 +42,7 @@
+ #ifdef __FreeBSD__
+ #include <roken.h>
+ #include <libutil.h>
++extern char **environ;
+ #endif
+ 
+ #ifdef __APPLE__
diff --git a/devel/shedskin/pkg-descr b/devel/shedskin/pkg-descr
new file mode 100644
index 000000000000..40b82a6bf358
--- /dev/null
+++ b/devel/shedskin/pkg-descr
@@ -0,0 +1,4 @@
+Shed Skin is a transpiler, that can translate pure, but implicitly statically
+typed Python 3 programs into optimized C++. It can generate stand-alone
+programs or extension modules that can be imported and used in larger Python
+programs.