Skip to content

Commit 2e48bdf

Browse files
feat: add full glibc/musl support for all Linux architectures (#38)
Build all 8 Linux target combinations (4 arches x 2 libcs) with explicit -gnu/-musl npm package naming and the libc field so npm installs the correct binary automatically. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6127887 commit 2e48bdf

File tree

14 files changed

+232
-45
lines changed

14 files changed

+232
-45
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
runner: macos-14
6969
archive: tar.gz
7070
build-tool: cargo
71+
- target: x86_64-unknown-linux-gnu
72+
runner: ubuntu-latest
73+
archive: tar.gz
74+
build-tool: cross
7175
- target: x86_64-unknown-linux-musl
7276
runner: ubuntu-latest
7377
archive: tar.gz
@@ -76,6 +80,10 @@ jobs:
7680
runner: ubuntu-latest
7781
archive: tar.gz
7882
build-tool: cross
83+
- target: aarch64-unknown-linux-musl
84+
runner: ubuntu-latest
85+
archive: tar.gz
86+
build-tool: cross
7987
- target: x86_64-pc-windows-msvc
8088
runner: windows-latest
8189
archive: zip
@@ -96,10 +104,18 @@ jobs:
96104
runner: ubuntu-latest
97105
archive: tar.gz
98106
build-tool: cross
107+
- target: arm-unknown-linux-musleabihf
108+
runner: ubuntu-latest
109+
archive: tar.gz
110+
build-tool: cross
99111
- target: i686-unknown-linux-gnu
100112
runner: ubuntu-latest
101113
archive: tar.gz
102114
build-tool: cross
115+
- target: i686-unknown-linux-musl
116+
runner: ubuntu-latest
117+
archive: tar.gz
118+
build-tool: cross
103119
runs-on: ${{ matrix.runner }}
104120
steps:
105121
- name: Checkout
@@ -254,10 +270,14 @@ jobs:
254270
255271
stage_unix socket-patch-aarch64-apple-darwin npm/socket-patch-darwin-arm64
256272
stage_unix socket-patch-x86_64-apple-darwin npm/socket-patch-darwin-x64
257-
stage_unix socket-patch-x86_64-unknown-linux-musl npm/socket-patch-linux-x64
258-
stage_unix socket-patch-aarch64-unknown-linux-gnu npm/socket-patch-linux-arm64
259-
stage_unix socket-patch-arm-unknown-linux-gnueabihf npm/socket-patch-linux-arm
260-
stage_unix socket-patch-i686-unknown-linux-gnu npm/socket-patch-linux-ia32
273+
stage_unix socket-patch-x86_64-unknown-linux-gnu npm/socket-patch-linux-x64-gnu
274+
stage_unix socket-patch-x86_64-unknown-linux-musl npm/socket-patch-linux-x64-musl
275+
stage_unix socket-patch-aarch64-unknown-linux-gnu npm/socket-patch-linux-arm64-gnu
276+
stage_unix socket-patch-aarch64-unknown-linux-musl npm/socket-patch-linux-arm64-musl
277+
stage_unix socket-patch-arm-unknown-linux-gnueabihf npm/socket-patch-linux-arm-gnu
278+
stage_unix socket-patch-arm-unknown-linux-musleabihf npm/socket-patch-linux-arm-musl
279+
stage_unix socket-patch-i686-unknown-linux-gnu npm/socket-patch-linux-ia32-gnu
280+
stage_unix socket-patch-i686-unknown-linux-musl npm/socket-patch-linux-ia32-musl
261281
stage_unix socket-patch-aarch64-linux-android npm/socket-patch-android-arm64
262282
263283
stage_win socket-patch-x86_64-pc-windows-msvc npm/socket-patch-win32-x64
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@socketsecurity/socket-patch-linux-arm-gnu",
3+
"version": "2.0.0",
4+
"description": "socket-patch binary for Linux ARM (glibc)",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"arm"
10+
],
11+
"libc": [
12+
"glibc"
13+
],
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/SocketDev/socket-patch"
21+
}
22+
}

npm/socket-patch-linux-arm/package.json renamed to npm/socket-patch-linux-arm-musl/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"name": "@socketsecurity/socket-patch-linux-arm",
2+
"name": "@socketsecurity/socket-patch-linux-arm-musl",
33
"version": "2.0.0",
4-
"description": "socket-patch binary for Linux ARM",
4+
"description": "socket-patch binary for Linux ARM (musl)",
55
"os": [
66
"linux"
77
],
88
"cpu": [
99
"arm"
1010
],
11+
"libc": [
12+
"musl"
13+
],
1114
"publishConfig": {
1215
"access": "public"
1316
},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@socketsecurity/socket-patch-linux-arm64-gnu",
3+
"version": "2.0.0",
4+
"description": "socket-patch binary for Linux ARM64 (glibc)",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"arm64"
10+
],
11+
"libc": [
12+
"glibc"
13+
],
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/SocketDev/socket-patch"
21+
}
22+
}

npm/socket-patch-linux-arm64/package.json renamed to npm/socket-patch-linux-arm64-musl/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"name": "@socketsecurity/socket-patch-linux-arm64",
2+
"name": "@socketsecurity/socket-patch-linux-arm64-musl",
33
"version": "2.0.0",
4-
"description": "socket-patch binary for Linux ARM64",
4+
"description": "socket-patch binary for Linux ARM64 (musl)",
55
"os": [
66
"linux"
77
],
88
"cpu": [
99
"arm64"
1010
],
11+
"libc": [
12+
"musl"
13+
],
1114
"publishConfig": {
1215
"access": "public"
1316
},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@socketsecurity/socket-patch-linux-ia32-gnu",
3+
"version": "2.0.0",
4+
"description": "socket-patch binary for Linux ia32 (glibc)",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"ia32"
10+
],
11+
"libc": [
12+
"glibc"
13+
],
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/SocketDev/socket-patch"
21+
}
22+
}

npm/socket-patch-linux-ia32/package.json renamed to npm/socket-patch-linux-ia32-musl/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"name": "@socketsecurity/socket-patch-linux-ia32",
2+
"name": "@socketsecurity/socket-patch-linux-ia32-musl",
33
"version": "2.0.0",
4-
"description": "socket-patch binary for Linux ia32",
4+
"description": "socket-patch binary for Linux ia32 (musl)",
55
"os": [
66
"linux"
77
],
88
"cpu": [
99
"ia32"
1010
],
11+
"libc": [
12+
"musl"
13+
],
1114
"publishConfig": {
1215
"access": "public"
1316
},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@socketsecurity/socket-patch-linux-x64-gnu",
3+
"version": "2.0.0",
4+
"description": "socket-patch binary for Linux x64 (glibc)",
5+
"os": [
6+
"linux"
7+
],
8+
"cpu": [
9+
"x64"
10+
],
11+
"libc": [
12+
"glibc"
13+
],
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/SocketDev/socket-patch"
21+
}
22+
}

npm/socket-patch-linux-x64/package.json renamed to npm/socket-patch-linux-x64-musl/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"name": "@socketsecurity/socket-patch-linux-x64",
2+
"name": "@socketsecurity/socket-patch-linux-x64-musl",
33
"version": "2.0.0",
4-
"description": "socket-patch binary for Linux x64",
4+
"description": "socket-patch binary for Linux x64 (musl)",
55
"os": [
66
"linux"
77
],
88
"cpu": [
99
"x64"
1010
],
11+
"libc": [
12+
"musl"
13+
],
1114
"publishConfig": {
1215
"access": "public"
1316
},

npm/socket-patch/bin/socket-patch

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,35 @@ const { spawnSync } = require("child_process");
33
const path = require("path");
44

55
const PLATFORMS = {
6-
"darwin arm64": "@socketsecurity/socket-patch-darwin-arm64",
7-
"darwin x64": "@socketsecurity/socket-patch-darwin-x64",
8-
"linux x64": "@socketsecurity/socket-patch-linux-x64",
9-
"linux arm64": "@socketsecurity/socket-patch-linux-arm64",
10-
"linux arm": "@socketsecurity/socket-patch-linux-arm",
11-
"linux ia32": "@socketsecurity/socket-patch-linux-ia32",
12-
"win32 x64": "@socketsecurity/socket-patch-win32-x64",
13-
"win32 ia32": "@socketsecurity/socket-patch-win32-ia32",
14-
"win32 arm64": "@socketsecurity/socket-patch-win32-arm64",
15-
"android arm64": "@socketsecurity/socket-patch-android-arm64",
6+
"darwin arm64": ["@socketsecurity/socket-patch-darwin-arm64"],
7+
"darwin x64": ["@socketsecurity/socket-patch-darwin-x64"],
8+
"linux x64": ["@socketsecurity/socket-patch-linux-x64-gnu", "@socketsecurity/socket-patch-linux-x64-musl"],
9+
"linux arm64": ["@socketsecurity/socket-patch-linux-arm64-gnu", "@socketsecurity/socket-patch-linux-arm64-musl"],
10+
"linux arm": ["@socketsecurity/socket-patch-linux-arm-gnu", "@socketsecurity/socket-patch-linux-arm-musl"],
11+
"linux ia32": ["@socketsecurity/socket-patch-linux-ia32-gnu", "@socketsecurity/socket-patch-linux-ia32-musl"],
12+
"win32 x64": ["@socketsecurity/socket-patch-win32-x64"],
13+
"win32 ia32": ["@socketsecurity/socket-patch-win32-ia32"],
14+
"win32 arm64": ["@socketsecurity/socket-patch-win32-arm64"],
15+
"android arm64": ["@socketsecurity/socket-patch-android-arm64"],
1616
};
1717

1818
const key = `${process.platform} ${process.arch}`;
19-
const pkg = PLATFORMS[key];
20-
if (!pkg) {
19+
const candidates = PLATFORMS[key];
20+
if (!candidates) {
2121
console.error(`Unsupported platform: ${key}`);
2222
process.exit(1);
2323
}
2424

2525
const exe = process.platform === "win32" ? "socket-patch.exe" : "socket-patch";
2626
let binPath;
27-
try {
28-
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
29-
binPath = path.join(pkgDir, exe);
30-
} catch {
27+
for (const pkg of candidates) {
28+
try {
29+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
30+
binPath = path.join(pkgDir, exe);
31+
break;
32+
} catch {}
33+
}
34+
if (!binPath) {
3135
// Fallback: try local bin directory (for development or bundled installs)
3236
const localBin = process.platform === "win32"
3337
? `socket-patch-${key.replace(" ", "-")}.exe`

0 commit comments

Comments
 (0)