misc/github-copilot-cli: Properly build binaries for NodeJS modules

This commit is contained in:
Yuri Victorovich
2025-10-01 15:20:10 -07:00
parent b0a912e386
commit 0e6852f82a
4 changed files with 96 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
PORTNAME= github-copilot-cli
DISTVERSION= 0.0.330
PORTREVISION= 1
CATEGORIES= misc # machine-learning
DISTFILES= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} ${NODE_HEADERS}${EXTRACT_SUFX}
MAINTAINER= yuri@FreeBSD.org
COMMENT= GitHub Copilot CLI brings the power of the coding agent to terminal
@@ -14,17 +16,25 @@ RUN_DEPENDS= libsecret>0:security/libsecret
USES= nodejs:run pkgconfig
PACKAGE_NAME= @github/copilot
NODE_HEADERS= node-v22.19.0-headers
do-fetch:
@if ! [ -f ${DISTDIR}/${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} ]; then \
@if ! [ -f ${DISTDIR}/${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} ] || ! [ -f ${DISTDIR}/${NODE_HEADERS}${EXTRACT_SUFX} ]; then \
${ECHO} "Fetching ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}" && \
${MKDIR} ${WRKDIR}/.npm/_npx/c463d28440264a05 && \
${CP} ${FILESDIR}/package.json ${WRKDIR}/.npm/_npx/c463d28440264a05 && \
${SETENV} HOME=${WRKDIR} npm install --ignore-scripts --prefix ${WRKSRC} -g ${PACKAGE_NAME}@${DISTVERSION} && \
${FIND} ${WRKDIR} -and -exec ${TOUCH} -h -d 1970-01-01T00:00:00Z {} \; && \
cd ${WRKDIR} && ${FIND} ${PORTNAME}-${DISTVERSION} -print0 | LC_ALL=C ${SORT} -z | \
${TAR} czf ${DISTDIR}/${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} --format=bsdtar --gid 0 --uid 0 --options gzip:!timestamp --no-recursion --null -T -; \
(cd ${WRKDIR} && ${FIND} ${PORTNAME}-${DISTVERSION} -print0 | LC_ALL=C ${SORT} -z | \
${TAR} czf ${DISTDIR}/${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} --format=bsdtar --gid 0 --uid 0 --options gzip:!timestamp --no-recursion --null -T -) && \
${ECHO} "Fetching ${NODE_HEADERS}${EXTRACT_SUFX}" && \
${FETCH_CMD} -q https://nodejs.org/download/release/v22.19.0/${NODE_HEADERS}${EXTRACT_SUFX} -o ${DISTDIR}/${NODE_HEADERS}${EXTRACT_SUFX}; \
fi
do-build:
@${SETENV} HOME=${WRKDIR} npm rebuild --prefix ${WRKSRC} -g ${PACKAGE_NAME}@${DISTVERSION}
@${SETENV} HOME=${WRKDIR} npm rebuild --prefix ${WRKSRC} -g ${PACKAGE_NAME}@${DISTVERSION} && \
(cd ${WRKSRC}/lib/node_modules/${PACKAGE_NAME}/node_modules/node-pty && ${SETENV} HOME=${WRKDIR} npm_config_tarball=${DISTDIR}/${NODE_HEADERS}${EXTRACT_SUFX} npm run install) && \
(cd ${WRKSRC}/lib/node_modules/${PACKAGE_NAME}/node_modules/keytar-forked-forked && ${SETENV} HOME=${WRKDIR} npm run install)
do-install:
# install files
@@ -33,8 +43,8 @@ do-install:
# update
@${REINPLACE_CMD} -i '' \
-e "s|#!/usr/bin/env node|#!${PREFIX}/bin/node|" \
${STAGEDIR}${PREFIX}/lib/node_modules/@github/copilot/index.js
${STAGEDIR}${PREFIX}/lib/node_modules/${PACKAGE_NAME}/index.js
# set exec bit
@${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/node_modules/@github/copilot/index.js
@${CHMOD} +x ${STAGEDIR}${PREFIX}/lib/node_modules/${PACKAGE_NAME}/index.js
.include <bsd.port.mk>

View File

@@ -1,3 +1,5 @@
TIMESTAMP = 1759303946
TIMESTAMP = 1759353536
SHA256 (github-copilot-cli-0.0.330.tar.gz) = 5d8a4770ff5ee2d226e6232ad228fd966b18d1ae7d40474947ca1511aa74a969
SIZE (github-copilot-cli-0.0.330.tar.gz) = 20381693
SHA256 (node-v22.19.0-headers.tar.gz) = 183bdc17092336ad21e01a425d238e85db4ee077ae3caa0547ff1fbda07d9bd8
SIZE (node-v22.19.0-headers.tar.gz) = 8750990

View File

@@ -0,0 +1,52 @@
{
"name": "node-gyp",
"description": "Node.js native addon build tool",
"license": "MIT",
"keywords": [
"native",
"addon",
"module",
"c",
"c++",
"bindings",
"gyp"
],
"version": "11.4.2",
"installVersion": 11,
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
"repository": {
"type": "git",
"url": "git://github.com/nodejs/node-gyp.git"
},
"preferGlobal": true,
"bin": "./bin/node-gyp.js",
"main": "./lib/node-gyp.js",
"dependencies": {
"env-paths": "^2.2.0",
"exponential-backoff": "^3.1.1",
"graceful-fs": "^4.2.6",
"make-fetch-happen": "^14.0.3",
"nopt": "^8.0.0",
"proc-log": "^5.0.0",
"semver": "^7.3.5",
"tar": "^7.4.3",
"tinyglobby": "^0.2.12",
"which": "^5.0.0"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"devDependencies": {
"bindings": "^1.5.0",
"cross-env": "^7.0.3",
"eslint": "^9.16.0",
"mocha": "^11.0.1",
"nan": "^2.14.2",
"neostandard": "^0.11.9",
"require-inject": "^1.4.4"
},
"scripts": {
"lint": "eslint \"*/*.js\" \"test/**/*.js\" \".github/**/*.js\"",
"test": "cross-env NODE_GYP_NULL_LOGGER=true mocha --timeout 15000 test/test-download.js test/test-*"
}
}

View File

@@ -4,6 +4,20 @@ lib/node_modules/@github/copilot/index.js
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/LICENSE.md
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/README.md
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/binding.gyp
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Makefile
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/.deps/Release/keytar.node.d
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/.deps/Release/obj.target/keytar.node.d
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/.deps/Release/obj.target/keytar/src/async.o.d
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/.deps/Release/obj.target/keytar/src/keytar_posix.o.d
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/.deps/Release/obj.target/keytar/src/main.o.d
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/keytar.node
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/obj.target/keytar.node
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/obj.target/keytar/src/async.o
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/obj.target/keytar/src/keytar_posix.o
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/Release/obj.target/keytar/src/main.o
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/binding.Makefile
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/config.gypi
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/build/keytar.target.mk
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/keytar.d.ts
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/lib/keytar.js
lib/node_modules/@github/copilot/node_modules/keytar-forked-forked/package.json
@@ -52,6 +66,17 @@ lib/node_modules/@github/copilot/node_modules/node-addon-api/tools/conversion.js
lib/node_modules/@github/copilot/node_modules/node-pty/LICENSE
lib/node_modules/@github/copilot/node_modules/node-pty/README.md
lib/node_modules/@github/copilot/node_modules/node-pty/binding.gyp
lib/node_modules/@github/copilot/node_modules/node-pty/build/Debug/compile_commands.json
lib/node_modules/@github/copilot/node_modules/node-pty/build/Makefile
lib/node_modules/@github/copilot/node_modules/node-pty/build/Release/compile_commands.json
lib/node_modules/@github/copilot/node_modules/node-pty/build/Release/pty.node
lib/node_modules/@github/copilot/node_modules/node-pty/build/binding.Makefile
lib/node_modules/@github/copilot/node_modules/node-pty/build/config.gypi
lib/node_modules/@github/copilot/node_modules/node-pty/build/node_modules/node-addon-api/node_addon_api.Makefile
lib/node_modules/@github/copilot/node_modules/node-pty/build/node_modules/node-addon-api/node_addon_api.target.mk
lib/node_modules/@github/copilot/node_modules/node-pty/build/node_modules/node-addon-api/node_addon_api_except.target.mk
lib/node_modules/@github/copilot/node_modules/node-pty/build/node_modules/node-addon-api/node_addon_api_maybe.target.mk
lib/node_modules/@github/copilot/node_modules/node-pty/build/pty.target.mk
lib/node_modules/@github/copilot/node_modules/node-pty/deps/.editorconfig
lib/node_modules/@github/copilot/node_modules/node-pty/deps/winpty/.drone.yml
lib/node_modules/@github/copilot/node_modules/node-pty/deps/winpty/.gitattributes