@bash0816/copilot-termux 1.0.63 → 1.0.65-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/bin/copilot +30 -26
- package/bin/copilot-termux +4 -1
- package/config/copilot-termux-release-manifest.json +15 -0
- package/config/manifest.json +7 -2
- package/lib/bionic-compat.so +0 -0
- package/lib/check-updates.js +183 -0
- package/lib/platform-patch.js +964 -33
- package/lib/setup.js +79 -5
- package/package.json +29 -5
- package/scripts/bionic-compat.c +3 -0
package/lib/setup.js
CHANGED
|
@@ -48,20 +48,20 @@ async function fetchWithIntegrity(url, expectedIntegrity) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async function setup() {
|
|
51
|
-
const { version, integrity } = manifest.copilot;
|
|
51
|
+
const { package: pkg = '@github/copilot-linuxmusl-arm64', version, integrity } = manifest.copilot;
|
|
52
52
|
const versionDir = path.join(CACHE_DIR, version);
|
|
53
53
|
const stagingDir = `${versionDir}.staging`;
|
|
54
54
|
|
|
55
55
|
if (fs.existsSync(path.join(versionDir, 'index.js'))) {
|
|
56
56
|
fs.rmSync(stagingDir, { recursive: true, force: true });
|
|
57
|
-
console.log(
|
|
57
|
+
console.log(`${pkg}@${version} already installed, refreshing symlink...`);
|
|
58
58
|
} else {
|
|
59
|
-
console.log(`Fetching
|
|
60
|
-
const metaBuf = await httpsGet(`${REGISTRY}
|
|
59
|
+
console.log(`Fetching ${pkg}@${version} metadata...`);
|
|
60
|
+
const metaBuf = await httpsGet(`${REGISTRY}/${pkg}/${version}`, { Accept: 'application/json' });
|
|
61
61
|
const meta = JSON.parse(metaBuf.toString());
|
|
62
62
|
const tarballUrl = meta.dist.tarball;
|
|
63
63
|
|
|
64
|
-
console.log(`Downloading
|
|
64
|
+
console.log(`Downloading ${pkg}@${version}...`);
|
|
65
65
|
const tarball = await fetchWithIntegrity(tarballUrl, integrity);
|
|
66
66
|
|
|
67
67
|
const tarballPath = path.join(CACHE_DIR, `copilot-${version}.tgz`);
|
|
@@ -98,6 +98,8 @@ async function setup() {
|
|
|
98
98
|
fs.renameSync(tmp, currentLink);
|
|
99
99
|
|
|
100
100
|
await setupGlibcWrap();
|
|
101
|
+
await setupGlibcRuntime(versionDir, version);
|
|
102
|
+
await setupGlibcNode();
|
|
101
103
|
console.log(`✓ copilot ${version} ready`);
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -140,4 +142,76 @@ async function setupGlibcWrap() {
|
|
|
140
142
|
console.log('✓ glibc wrap for lxc-exec ready');
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
async function setupGlibcRuntime(versionDir, version) {
|
|
146
|
+
const linux64Dir = path.join(versionDir, 'prebuilds', 'linux-arm64');
|
|
147
|
+
if (fs.existsSync(path.join(linux64Dir, 'runtime.node'))) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const glibcPkg = '@github/copilot-linux-arm64';
|
|
152
|
+
console.log(`Fetching ${glibcPkg}@${version} metadata...`);
|
|
153
|
+
const metaBuf = await httpsGet(`${REGISTRY}/${glibcPkg}/${version}`, { Accept: 'application/json' });
|
|
154
|
+
const meta = JSON.parse(metaBuf.toString());
|
|
155
|
+
const tarballUrl = meta.dist.tarball;
|
|
156
|
+
const integrity = meta.dist.integrity;
|
|
157
|
+
|
|
158
|
+
console.log(`Downloading ${glibcPkg}@${version} (glibc runtime)...`);
|
|
159
|
+
const tarball = await fetchWithIntegrity(tarballUrl, integrity);
|
|
160
|
+
|
|
161
|
+
const tarballPath = path.join(CACHE_DIR, `copilot-glibc-${version}.tgz`);
|
|
162
|
+
try {
|
|
163
|
+
fs.writeFileSync(tarballPath, tarball);
|
|
164
|
+
fs.mkdirSync(linux64Dir, { recursive: true });
|
|
165
|
+
|
|
166
|
+
console.log('Extracting glibc runtime.node...');
|
|
167
|
+
execFileSync('tar', [
|
|
168
|
+
'-xzf', tarballPath,
|
|
169
|
+
'-C', path.join(versionDir, 'prebuilds'),
|
|
170
|
+
'--strip-components=2',
|
|
171
|
+
'package/prebuilds/linux-arm64/runtime.node',
|
|
172
|
+
'package/prebuilds/linux-arm64/cli-native.node',
|
|
173
|
+
]);
|
|
174
|
+
} finally {
|
|
175
|
+
fs.rmSync(tarballPath, { force: true });
|
|
176
|
+
}
|
|
177
|
+
console.log('✓ glibc runtime.node ready');
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function setupGlibcNode() {
|
|
181
|
+
const nodeDir = path.join(CACHE_DIR, 'glibc-node');
|
|
182
|
+
const nodeBin = path.join(nodeDir, 'node');
|
|
183
|
+
if (fs.existsSync(nodeBin)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const { version, sha256: expectedSha256 } = manifest.glibcNode;
|
|
188
|
+
const tarballUrl = `https://nodejs.org/dist/v${version}/node-v${version}-linux-arm64.tar.gz`;
|
|
189
|
+
|
|
190
|
+
console.log(`Downloading Node.js v${version} (glibc)...`);
|
|
191
|
+
const tarball = await httpsGet(tarballUrl);
|
|
192
|
+
|
|
193
|
+
const actualSha256 = crypto.createHash('sha256').update(tarball).digest('hex');
|
|
194
|
+
if (actualSha256 !== expectedSha256) {
|
|
195
|
+
throw new Error(`Node.js integrity check failed: expected ${expectedSha256}, got ${actualSha256}`);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const tarballPath = path.join(CACHE_DIR, `node-glibc-${version}.tgz`);
|
|
199
|
+
try {
|
|
200
|
+
fs.writeFileSync(tarballPath, tarball);
|
|
201
|
+
fs.mkdirSync(nodeDir, { recursive: true });
|
|
202
|
+
|
|
203
|
+
console.log('Extracting node binary...');
|
|
204
|
+
execFileSync('tar', [
|
|
205
|
+
'-xzf', tarballPath,
|
|
206
|
+
'-C', nodeDir,
|
|
207
|
+
'--strip-components=2',
|
|
208
|
+
`node-v${version}-linux-arm64/bin/node`,
|
|
209
|
+
]);
|
|
210
|
+
fs.chmodSync(nodeBin, 0o755);
|
|
211
|
+
} finally {
|
|
212
|
+
fs.rmSync(tarballPath, { force: true });
|
|
213
|
+
}
|
|
214
|
+
console.log('✓ glibc node ready');
|
|
215
|
+
}
|
|
216
|
+
|
|
143
217
|
module.exports = { setup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bash0816/copilot-termux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65-1",
|
|
4
4
|
"description": "GitHub Copilot CLI for Termux (Android aarch64)",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -9,16 +9,40 @@
|
|
|
9
9
|
"url": "https://github.com/bash0816/Github-Copilot-Termux.git"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://github.com/bash0816/Github-Copilot-Termux#readme",
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"termux",
|
|
14
|
+
"android",
|
|
15
|
+
"github-copilot",
|
|
16
|
+
"copilot-cli",
|
|
17
|
+
"aarch64"
|
|
18
|
+
],
|
|
13
19
|
"bin": {
|
|
14
20
|
"copilot": "bin/copilot",
|
|
15
21
|
"copilot-termux": "bin/copilot-termux"
|
|
16
22
|
},
|
|
17
23
|
"scripts": {},
|
|
18
|
-
"files": [
|
|
24
|
+
"files": [
|
|
25
|
+
"bin",
|
|
26
|
+
"lib/platform-patch.js",
|
|
27
|
+
"lib/setup.js",
|
|
28
|
+
"lib/check-updates.js",
|
|
29
|
+
"lib/bionic-compat.so",
|
|
30
|
+
"lib/native/pty.node",
|
|
31
|
+
"scripts/bionic-compat.c",
|
|
32
|
+
"config",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"THIRD-PARTY-NOTICES.md",
|
|
35
|
+
"THIRD-PARTY-LICENSES/",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
19
38
|
"engines": {
|
|
20
39
|
"node": ">=18"
|
|
21
40
|
},
|
|
22
|
-
"os": [
|
|
23
|
-
|
|
41
|
+
"os": [
|
|
42
|
+
"android",
|
|
43
|
+
"linux"
|
|
44
|
+
],
|
|
45
|
+
"cpu": [
|
|
46
|
+
"arm64"
|
|
47
|
+
]
|
|
24
48
|
}
|
package/scripts/bionic-compat.c
CHANGED
|
@@ -58,6 +58,7 @@ typedef float (*fn_ff)(float);
|
|
|
58
58
|
static fn_ddd _pow;
|
|
59
59
|
static fn_dd _log;
|
|
60
60
|
static fn_dd _log2;
|
|
61
|
+
static fn_dd _exp2;
|
|
61
62
|
static fn_ff _expf;
|
|
62
63
|
static fn_ff _log10f;
|
|
63
64
|
static fn_ff _sinf;
|
|
@@ -67,6 +68,7 @@ static void compat_init(void) {
|
|
|
67
68
|
_pow = (fn_ddd)dlsym(RTLD_NEXT, "pow");
|
|
68
69
|
_log = (fn_dd) dlsym(RTLD_NEXT, "log");
|
|
69
70
|
_log2 = (fn_dd) dlsym(RTLD_NEXT, "log2");
|
|
71
|
+
_exp2 = (fn_dd) dlsym(RTLD_NEXT, "exp2");
|
|
70
72
|
_expf = (fn_ff) dlsym(RTLD_NEXT, "expf");
|
|
71
73
|
_log10f = (fn_ff) dlsym(RTLD_NEXT, "log10f");
|
|
72
74
|
_sinf = (fn_ff) dlsym(RTLD_NEXT, "sinf");
|
|
@@ -77,6 +79,7 @@ static void compat_init(void) {
|
|
|
77
79
|
double pow(double x, double y) { if (!_pow) abort(); return _pow(x, y); }
|
|
78
80
|
double log(double x) { if (!_log) abort(); return _log(x); }
|
|
79
81
|
double log2(double x) { if (!_log2) abort(); return _log2(x); }
|
|
82
|
+
double exp2(double x) { if (!_exp2) abort(); return _exp2(x); }
|
|
80
83
|
float expf(float x) { if (!_expf) abort(); return _expf(x); }
|
|
81
84
|
float log10f(float x) { if (!_log10f) abort(); return _log10f(x); }
|
|
82
85
|
float sinf(float x) { if (!_sinf) abort(); return _sinf(x); }
|