forgecode 1.3.0 → 1.4.0
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/bin/darwin/arm64/forge-aarch64-apple-darwin +0 -0
- package/bin/darwin/arm64/forge-aarch64-linux-android +0 -0
- package/bin/darwin/x64/forge-x86_64-apple-darwin +0 -0
- package/bin/linux/arm64/forge-aarch64-unknown-linux-gnu +0 -0
- package/bin/linux/arm64/forge-aarch64-unknown-linux-musl +0 -0
- package/bin/linux/x64/forge-x86_64-unknown-linux-gnu +0 -0
- package/bin/linux/x64/forge-x86_64-unknown-linux-musl +0 -0
- package/bin/win32/arm64/forge-aarch64-pc-windows-msvc.exe +0 -0
- package/bin/win32/x64/forge-x86_64-pc-windows-msvc.exe +0 -0
- package/install.js +69 -31
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/install.js
CHANGED
|
@@ -105,6 +105,31 @@ function testBinary(binaryPath) {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
// Detect if running on Android (Termux or similar)
|
|
109
|
+
function isAndroid() {
|
|
110
|
+
try {
|
|
111
|
+
// Check for Android-specific environment variables
|
|
112
|
+
if (process.env.ANDROID_ROOT || process.env.ANDROID_DATA) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Check if running in Termux
|
|
117
|
+
if (process.env.PREFIX && process.env.PREFIX.includes('com.termux')) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Check for Android-specific system properties
|
|
122
|
+
const { existsSync } = require('fs');
|
|
123
|
+
if (existsSync('/system/build.prop')) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return false;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
// Map of supported platforms and architectures to binary names
|
|
109
134
|
const PLATFORMS = {
|
|
110
135
|
darwin: {
|
|
@@ -119,6 +144,7 @@ const PLATFORMS = {
|
|
|
119
144
|
arm64: {
|
|
120
145
|
gnu: 'forge-aarch64-unknown-linux-gnu',
|
|
121
146
|
musl: 'forge-aarch64-unknown-linux-musl',
|
|
147
|
+
android: 'forge-aarch64-linux-android',
|
|
122
148
|
},
|
|
123
149
|
},
|
|
124
150
|
win32: {
|
|
@@ -141,6 +167,10 @@ function printPlatformInfo() {
|
|
|
141
167
|
console.log(` - OS: ${os.type()} ${os.release()}`);
|
|
142
168
|
|
|
143
169
|
if (platform === 'linux') {
|
|
170
|
+
if (isAndroid()) {
|
|
171
|
+
console.log(` - Environment: Android`);
|
|
172
|
+
}
|
|
173
|
+
|
|
144
174
|
const libcInfo = getGlibcVersion();
|
|
145
175
|
console.log(
|
|
146
176
|
` - Libc: ${libcInfo.type}${libcInfo.version ? ` version ${libcInfo.version}` : ''}`
|
|
@@ -186,41 +216,49 @@ function install() {
|
|
|
186
216
|
|
|
187
217
|
// Handle Linux specially for libc type
|
|
188
218
|
if (platform === 'linux') {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.warn(`⚠️ Detected libc type is not supported, trying ${libcType} instead`);
|
|
219
|
+
// Check if running on Android first
|
|
220
|
+
if (isAndroid() && arch === 'arm64' && PLATFORMS[platform][arch]['android']) {
|
|
221
|
+
console.log('🤖 Android platform detected');
|
|
222
|
+
binaryName = PLATFORMS[platform][arch]['android'];
|
|
223
|
+
// Android binaries are stored in darwin/arm64 directory as per update-package.sh
|
|
224
|
+
binaryPath = join(__dirname, 'bin', 'darwin', 'arm64', binaryName);
|
|
225
|
+
} else {
|
|
226
|
+
let libcType = detectLibcType();
|
|
227
|
+
|
|
228
|
+
// Always try musl first if available (it's more portable)
|
|
229
|
+
const muslBinaryName = PLATFORMS[platform][arch]['musl'];
|
|
230
|
+
const muslBinaryPath = join(__dirname, 'bin', platform, arch, muslBinaryName);
|
|
231
|
+
|
|
232
|
+
// Check if musl binary exists
|
|
233
|
+
if (existsSync(muslBinaryPath)) {
|
|
234
|
+
console.log('📦 Found musl binary, which should work on most Linux systems');
|
|
235
|
+
binaryName = muslBinaryName;
|
|
236
|
+
binaryPath = muslBinaryPath;
|
|
208
237
|
}
|
|
238
|
+
// Fall back to detected libc type
|
|
239
|
+
else {
|
|
240
|
+
// Check if the detected libc type is supported in our binaries
|
|
241
|
+
if (!PLATFORMS[platform][arch][libcType]) {
|
|
242
|
+
// If not supported, try the alternative
|
|
243
|
+
libcType = libcType === 'gnu' ? 'musl' : 'gnu';
|
|
244
|
+
console.warn(`⚠️ Detected libc type is not supported, trying ${libcType} instead`);
|
|
245
|
+
}
|
|
209
246
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
247
|
+
binaryName = PLATFORMS[platform][arch][libcType];
|
|
248
|
+
binaryPath = join(__dirname, 'bin', platform, arch, binaryName);
|
|
249
|
+
}
|
|
213
250
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
251
|
+
// If binary doesn't exist, try the alternative
|
|
252
|
+
if (!existsSync(binaryPath)) {
|
|
253
|
+
const alternativeLibc = libcType === 'gnu' ? 'musl' : 'gnu';
|
|
254
|
+
const alternativeBinaryName = PLATFORMS[platform][arch][alternativeLibc];
|
|
255
|
+
const alternativeBinaryPath = join(__dirname, 'bin', platform, arch, alternativeBinaryName);
|
|
219
256
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
257
|
+
if (existsSync(alternativeBinaryPath)) {
|
|
258
|
+
console.warn(`⚠️ Binary for ${libcType} not found, trying ${alternativeLibc} instead`);
|
|
259
|
+
binaryName = alternativeBinaryName;
|
|
260
|
+
binaryPath = alternativeBinaryPath;
|
|
261
|
+
}
|
|
224
262
|
}
|
|
225
263
|
}
|
|
226
264
|
} else {
|