Skip to content

Commit 696f5d0

Browse files
committed
🔥 Publication of the AsmX G3 v29-rev1.0
1 parent 1ed735b commit 696f5d0

35 files changed

+2083
-154
lines changed

‎README.md‎

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ cd src && npm install
1212
cd ../
1313
```
1414

15+
## Install in the Arch Linux (if you don't have aur helper)
16+
```
17+
cd AsmX-G3/src
18+
npm install --ignore-scripts
19+
sudo npm install -g . --ignore-scripts
20+
asmx --help
21+
```
22+
23+
## Install in the Arch Linux
24+
25+
```
26+
yay -S asmx-g3-git
27+
```
28+
1529
### Usage
1630

1731
```
@@ -23,7 +37,8 @@ asmx [file] [options]
2337
```
2438
asmx main.asmx
2539
asmx main
26-
asmx main --release --march x86_64 -o index
40+
asmx main --release --target amd64 -o index
41+
asmx main --release --target amd64 -o myapp --package --package-type deb --package-name my-application --package-version 1.0.0
2742
```
2843

2944
### Options
@@ -32,26 +47,70 @@ asmx main --release --march x86_64 -o index
3247
|-------------------------|--------------------------------------------------------------------|
3348
| `-h`, `--help` | Display this information |
3449
| `-v`, `--version` | Display the version number |
50+
| `-a`, `--aliases` | Display the aliases of the compiler |
3551
| `--dumpversion` | Display the version of the compiler |
3652
| `--dumpmachine` | Display the compiler's target processor |
3753
| `--profiletime` | Enable the time profiler |
3854
| `--hinfo` | Hide confidential information |
3955
| `@file`, `--file file` | Specify the file for processing parameters |
40-
| `--llvm@version` | Display the LLVM version card |
41-
| `--llvm@dumpversion` | Display the LLVM version |
42-
| `--llvm@repository` | Display the LLVM repository |
56+
| `--llvm-version` | Display the LLVM version card |
57+
| `--llvm-dumpversion` | Display the LLVM version |
58+
| `--llvm-repository` | Display the LLVM repository |
59+
| `--export-json-isa` | Export the instruction set to JSON file |
4360

4461
### Compilation Options
4562

4663
| Option / Flag | Description |
4764
|-------------------------|--------------------------------------------------------------------|
4865
| `-r`, `--release` | Create an executable file |
4966
| `-o`, `--objname` | Set the output file name |
50-
| `-m`, `--march` | Specify the target CPU architecture (`x86_64`, `riscv`, `arm64`) |
67+
| `-t`, `--target` | Specify the target CPU architecture (amd64, etc) for compilation |
68+
69+
### Package Options
70+
71+
| Option / Flag | Description |
72+
|-------------------------|--------------------------------------------------------------------|
73+
| `--package-type` | Package type: deb or etc |
74+
| `--package-name` | Package name (default: executable name) |
75+
| `--package-version` | Package version (default: 1.0.0) |
76+
| `--package-description` | Package description |
77+
| `--package-author` | Package author |
78+
| `--package-icon` | Path to package icon |
79+
| `--package-desktop` | Create desktop entry (true/false) |
5180

5281
### Commands
5382

5483
| Command | Description |
5584
|-------------------------|--------------------------------------------------------------------|
5685
| `--update` | Update AsmX compilation platform |
86+
| `--package` | Create package from compiled executable |
87+
88+
## Package Creation
89+
90+
AsmX G3 supports creating Linux packages (DEB and etc) from compiled executables.
91+
92+
### Quick Start
93+
94+
```bash
95+
# Compile and create DEB package
96+
asmx main.asmx --release --target amd64 -o myapp --package --package-type deb
97+
98+
# With custom package information
99+
asmx main.asmx --release --target amd64 -o myapp --package \
100+
--package-type deb \
101+
--package-name my-application \
102+
--package-version 1.0.0 \
103+
--package-description "My awesome AsmX application" \
104+
--package-author "Developer <dev@example.com>" \
105+
--package-desktop true
106+
```
107+
108+
### Package Features
109+
110+
- **DEB Packages**: Compatible with Debian-based distributions (Ubuntu, Debian, Linux Mint)
111+
- **Automatic Dependencies**: Detects and includes required libraries
112+
- **Desktop Integration**: Optional `.desktop` file creation
113+
- **Icon Support**: Custom application icons
114+
- **Post-install Scripts**: Custom installation/uninstallation scripts
115+
57116

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### **Changelog: rev 2.0**
1+
### **Changelog: v28.0.0 rev 2.0**
22

33
This release introduces a critical stability fix for the compiler and expands the supported `amd64` instruction set. The revision is updated from `1.0` to `2.0` to reflect these significant improvements.
44

‎changelogs/v29.0.0-rev1.0/changelog‎

Whitespace-only changes.

‎src/aliases.js‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const Server = require("./server/server");
2+
3+
const aliases = {
4+
targetAliases: {
5+
x86_64: ["x86-64", "x64", "intel64", "amd64"],
6+
},
7+
8+
packageTypeAliases: {
9+
deb: ["debain", "ubuntu", "linux-deb", "linux-debain", "linux-ubuntu", "mint", "linux-mint", "lmde", "linux-lmde"],
10+
},
11+
12+
isTargetAlias(target) {
13+
if (Object.keys(this.targetAliases).includes(target)) return true;
14+
for (const arch in this.targetAliases) {
15+
if (this.targetAliases[arch].includes(target)) return this.targetAliases[arch].includes(target);
16+
}
17+
return false;
18+
},
19+
20+
getTargetAlias(target) {
21+
if (Object.keys(this.targetAliases).includes(target)) return target;
22+
for (const arch in this.targetAliases) {
23+
if (this.targetAliases[arch].includes(target)) {
24+
return arch;
25+
}
26+
}
27+
return null;
28+
},
29+
30+
isPackageTypeAlias(target) {
31+
if (Object.keys(this.packageTypeAliases).includes(target)) return true;
32+
for (const pt in this.packageTypeAliases) {
33+
if (this.packageTypeAliases[pt].includes(target)) return this.packageTypeAliases[pt].includes(target);
34+
}
35+
return false;
36+
},
37+
38+
getPackageTypeAlias(target) {
39+
if (Object.keys(this.packageTypeAliases).includes(target)) return target;
40+
for (const pt in this.packageTypeAliases) {
41+
if (this.packageTypeAliases[pt].includes(target)) {
42+
return pt;
43+
}
44+
}
45+
return null;
46+
},
47+
48+
getAliases() {
49+
let result = {};
50+
for (const property in aliases) {
51+
if (Object.prototype.hasOwnProperty.call(aliases, property) && typeof aliases[property] === 'object') {
52+
for (const key of Reflect.ownKeys(aliases[property])) result[key] = aliases[property][key].join(', ');
53+
}
54+
}
55+
return result;
56+
},
57+
58+
printAliases() {
59+
let [_aliases, result] = [aliases.getAliases(), ""];
60+
for (const property in _aliases) result += ` ${property}: ${_aliases[property]}\n`;
61+
Server.journal.log(`Available aliases:\n${result.trimEnd()}`);
62+
}
63+
}
64+
65+
module.exports = aliases;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || (function () {
19+
var ownKeys = function(o) {
20+
ownKeys = Object.getOwnPropertyNames || function (o) {
21+
var ar = [];
22+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23+
return ar;
24+
};
25+
return ownKeys(o);
26+
};
27+
return function (mod) {
28+
if (mod && mod.__esModule) return mod;
29+
var result = {};
30+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31+
__setModuleDefault(result, mod);
32+
return result;
33+
};
34+
})();
35+
Object.defineProperty(exports, "__esModule", { value: true });
36+
exports.gzip = gzip;
37+
const zlib = __importStar(require("zlib"));
38+
function gzip(data) {
39+
return new Promise((resolve, reject) => {
40+
zlib.gzip(data, (err, result) => {
41+
if (err)
42+
return reject(err);
43+
resolve(result);
44+
});
45+
});
46+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as zlib from 'zlib';
2+
3+
export function gzip(data: Buffer): Promise<Buffer> {
4+
return new Promise((resolve, reject) => {
5+
zlib.gzip(data, (err, result) => {
6+
if (err) return reject(err);
7+
resolve(result);
8+
});
9+
});
10+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || (function () {
19+
var ownKeys = function(o) {
20+
ownKeys = Object.getOwnPropertyNames || function (o) {
21+
var ar = [];
22+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23+
return ar;
24+
};
25+
return ownKeys(o);
26+
};
27+
return function (mod) {
28+
if (mod && mod.__esModule) return mod;
29+
var result = {};
30+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31+
__setModuleDefault(result, mod);
32+
return result;
33+
};
34+
})();
35+
Object.defineProperty(exports, "__esModule", { value: true });
36+
exports.FsUtils = void 0;
37+
const fs = __importStar(require("fs/promises"));
38+
const path = __importStar(require("path"));
39+
class FsUtils {
40+
static async getFileSize(filePath) {
41+
const stats = await fs.stat(filePath);
42+
return stats.size;
43+
}
44+
static async createTempDirectoryRecursive(prefix = 'asmx-package') {
45+
const os = require('os');
46+
const tempDir = path.join(os.tmpdir(), `${prefix}-${Date.now()}`);
47+
await fs.mkdir(tempDir, { recursive: true });
48+
return tempDir;
49+
}
50+
static async copyDirectoryRecursive(src, dest) {
51+
await fs.mkdir(dest, { recursive: true });
52+
const entries = await fs.readdir(src, { withFileTypes: true });
53+
for (const entry of entries) {
54+
const srcPath = path.join(src, entry.name);
55+
const destPath = path.join(dest, entry.name);
56+
if (entry.isDirectory()) {
57+
await this.copyDirectoryRecursive(srcPath, destPath);
58+
}
59+
else {
60+
await fs.copyFile(srcPath, destPath);
61+
}
62+
}
63+
}
64+
static async removeDirectoryRecursive(dir) {
65+
try {
66+
await fs.rm(dir, { recursive: true, force: true });
67+
}
68+
catch (error) {
69+
// Ignore errors if the directory does not exist
70+
}
71+
}
72+
static async checkFilePermissions(filePath) {
73+
try {
74+
await fs.access(filePath, fs.constants.R_OK);
75+
const readable = true;
76+
let writable = false;
77+
try {
78+
await fs.access(filePath, fs.constants.W_OK);
79+
writable = true;
80+
}
81+
catch { }
82+
let executable = false;
83+
try {
84+
await fs.access(filePath, fs.constants.X_OK);
85+
executable = true;
86+
}
87+
catch { }
88+
return { readable, writable, executable };
89+
}
90+
catch {
91+
return { readable: false, writable: false, executable: false };
92+
}
93+
}
94+
static async setFilePermissions(filePath, mode) {
95+
await fs.chmod(filePath, mode);
96+
}
97+
static async getAllFiles(dir, excludeDirs = []) {
98+
const files = [];
99+
async function scan(currentDir) {
100+
const entries = await fs.readdir(currentDir, { withFileTypes: true });
101+
for (const entry of entries) {
102+
const fullPath = path.join(currentDir, entry.name);
103+
if (entry.isDirectory()) {
104+
const relativePath = path.relative(dir, fullPath);
105+
if (!excludeDirs.some(exclude => relativePath.startsWith(exclude))) {
106+
await scan(fullPath);
107+
}
108+
}
109+
else if (entry.isFile()) {
110+
files.push(fullPath);
111+
}
112+
}
113+
}
114+
await scan(dir);
115+
return files;
116+
}
117+
}
118+
exports.FsUtils = FsUtils;

0 commit comments

Comments
 (0)