git: 9b1c65d0788a - main - shells/libpowershell-native: Support library for PowerShell

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Fri, 21 Feb 2025 18:02:07 UTC
The branch main has been updated by arrowd:

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

commit 9b1c65d0788a6f69fc337e476a5d285e941cdcaf
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2025-02-18 14:20:51 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-02-21 18:00:00 +0000

    shells/libpowershell-native: Support library for PowerShell
---
 shells/Makefile                                    |  1 +
 shells/libpowershell-native/Makefile               | 28 ++++++++++++++++++++++
 shells/libpowershell-native/distinfo               |  3 +++
 .../files/patch-src_libpsl-native_CMakeLists.txt   | 11 +++++++++
 .../patch-src_libpsl-native_src_getuserfrompid.cpp | 11 +++++++++
 shells/libpowershell-native/pkg-descr              |  5 ++++
 6 files changed, 59 insertions(+)

diff --git a/shells/Makefile b/shells/Makefile
index 6edba1d03e3c..e33fa0798946 100644
--- a/shells/Makefile
+++ b/shells/Makefile
@@ -30,6 +30,7 @@
     SUBDIR += ksh
     SUBDIR += ksh-devel
     SUBDIR += ksh93
+    SUBDIR += libpowershell-native
     SUBDIR += mksh
     SUBDIR += modernish
     SUBDIR += murex
diff --git a/shells/libpowershell-native/Makefile b/shells/libpowershell-native/Makefile
new file mode 100644
index 000000000000..07432e36282c
--- /dev/null
+++ b/shells/libpowershell-native/Makefile
@@ -0,0 +1,28 @@
+PORTNAME=	libpowershell-native
+DISTVERSIONPREFIX=v
+DISTVERSION=	7.4.0
+CATEGORIES=	shells devel
+
+MAINTAINER=	arrowd@FreeBSD.org
+COMMENT=	Support library for PowerShell
+WWW=		https://microsoft.com/PowerShell
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+USES=		cmake
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	PowerShell
+GH_PROJECT=	PowerShell-Native
+
+CMAKE_SOURCE_PATH=	${WRKSRC}/src/libpsl-native
+
+PLIST_FILES=	lib/powershell/libpsl-native.so
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/powershell
+	${INSTALL_LIB} ${WRKSRC}/src/powershell-unix/libpsl-native.so \
+		${STAGEDIR}${PREFIX}/lib/powershell
+
+.include <bsd.port.mk>
diff --git a/shells/libpowershell-native/distinfo b/shells/libpowershell-native/distinfo
new file mode 100644
index 000000000000..1e45252ee401
--- /dev/null
+++ b/shells/libpowershell-native/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1739806036
+SHA256 (PowerShell-PowerShell-Native-v7.4.0_GH0.tar.gz) = 5220f99755442720486e20682269fecdabbbabff9e082c1a51250b66465f40cf
+SIZE (PowerShell-PowerShell-Native-v7.4.0_GH0.tar.gz) = 288919
diff --git a/shells/libpowershell-native/files/patch-src_libpsl-native_CMakeLists.txt b/shells/libpowershell-native/files/patch-src_libpsl-native_CMakeLists.txt
new file mode 100644
index 000000000000..1874389f1e70
--- /dev/null
+++ b/shells/libpowershell-native/files/patch-src_libpsl-native_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- src/libpsl-native/CMakeLists.txt.orig	2023-10-31 22:12:48 UTC
++++ src/libpsl-native/CMakeLists.txt
+@@ -18,8 +18,5 @@ else ()
+     add_subdirectory(src)
+ else ()
+     # test in BUILD_DIR
+-    message(STATUS "Tests enabled")
+-    enable_testing()
+     add_subdirectory(src)
+-    add_subdirectory(test)
+ endif ()
diff --git a/shells/libpowershell-native/files/patch-src_libpsl-native_src_getuserfrompid.cpp b/shells/libpowershell-native/files/patch-src_libpsl-native_src_getuserfrompid.cpp
new file mode 100644
index 000000000000..407ef42ce812
--- /dev/null
+++ b/shells/libpowershell-native/files/patch-src_libpsl-native_src_getuserfrompid.cpp
@@ -0,0 +1,11 @@
+--- src/libpsl-native/src/getuserfrompid.cpp.orig	2025-02-17 15:44:35 UTC
++++ src/libpsl-native/src/getuserfrompid.cpp
+@@ -13,8 +13,6 @@
+ 
+ #if __APPLE__
+ #include <sys/sysctl.h>
+-#elif HAVE_SYSCONF
+-// do nothing
+ #elif HAVE_SYS_SYSCTL_H
+ #include <sys/sysctl.h>
+ #endif
diff --git a/shells/libpowershell-native/pkg-descr b/shells/libpowershell-native/pkg-descr
new file mode 100644
index 000000000000..07fe05ab253d
--- /dev/null
+++ b/shells/libpowershell-native/pkg-descr
@@ -0,0 +1,5 @@
+PowerShell is a modern command shell that includes the best features of other
+popular shells. Unlike most shells that only accept and return text,
+PowerShell accepts and returns .NET objects.
+
+This package provides platform-dependent bits of PowerShell implementation.