Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jun 2026 16:51:06 +0000
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 26cb067517e7 - main - misc/github-copilot-cli: add patch to solve the 'Unsupported platform' error
Message-ID:  <6a25a17a.25823.7562ee19@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by yuri:

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

commit 26cb067517e79ae245b3f8e44c244d27702d3224
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-06-07 16:49:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-06-07 16:50:58 +0000

    misc/github-copilot-cli: add patch to solve the 'Unsupported platform' error
---
 misc/github-copilot-cli/Makefile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/misc/github-copilot-cli/Makefile b/misc/github-copilot-cli/Makefile
index 629e96dacd82..0decb065d574 100644
--- a/misc/github-copilot-cli/Makefile
+++ b/misc/github-copilot-cli/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	github-copilot-cli
 DISTVERSION=	1.0.48 # can't be updated before https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295629 is resolved
+PORTREVISION=	1
 CATEGORIES=	misc # machine-learning
 DISTFILES=	${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
 DIST_SUBDIR=	${PORTNAME}-x # -x is to see if it would fix checksum errors
@@ -152,6 +153,21 @@ post-patch:
 	${REINPLACE_CMD} -i '' \
 		-e 's|qg.default.createElement(U,{color:e.MUTED},"v",t)|qg.default.createElement(U,{color:e.MUTED},"v","${PORTVERSION}")|g' \
 		${WRKSRC}/node_modules/@github/copilot/index.js
+	# Add FreeBSD platform support to JavaScript sources
+	# The platform detection functions only handle win32, darwin, linux
+	# Add freebsd case so the CLI can run on FreeBSD
+	${REINPLACE_CMD} -i '' \
+		-e 's|default:throw new Error(`Unsupported platform: \$${e}/\$${t}`)|case"freebsd":return`freebsd-$${t}`;default:throw new Error(`Unsupported platform: $${e}/$${t}`)|' \
+		${WRKSRC}/node_modules/@github/copilot/index.js
+	${REINPLACE_CMD} -i '' \
+		-e 's|default:throw new Error(`Unsupported platform: \$${t}/\$${e}`)|case"freebsd":return`freebsd-$${e}`;default:throw new Error(`Unsupported platform: $${t}/$${e}`)|' \
+		${WRKSRC}/node_modules/@github/copilot/app.js
+	${REINPLACE_CMD} -i '' \
+		-e 's|default:throw new Error(`Unsupported platform: \$${t}/\$${e}`)|case"freebsd":return`freebsd-$${e}`;default:throw new Error(`Unsupported platform: $${t}/$${e}`)|' \
+		${WRKSRC}/node_modules/@github/copilot/sdk/index.js
+	${REINPLACE_CMD} -i '' \
+		-e 's|throw new Error(`Unsupported platform: \$${platform}`)|if(platform==='\''freebsd'\'')return'\''.so'\'';throw new Error(`Unsupported platform: $${platform}`)|' \
+		${WRKSRC}/node_modules/@github/copilot/foundry-local-sdk/node_modules/foundry-local-sdk/dist/detail/coreInterop.js
 	# keytar bundles node-addon-api 4.3.0, whose napi.h initializes
 	# TypedArray::unknown_array_type with static_cast<napi_typedarray_type>(-1).
 	# Clang 16+ (FreeBSD 16-CURRENT) rejects this as "not a constant expression"


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a25a17a.25823.7562ee19>