From b17370cc7bc846b5f841c53e8186770deaf32e85 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 27 Oct 2023 00:42:50 +0200 Subject: [PATCH] add arm64 venmic binary --- package.json | 2 +- pnpm-lock.yaml | 21 +++++++++++---------- scripts/build/build.mts | 19 +++++++++++++++---- src/main/virtmic.ts | 4 +++- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 2eff5fcc..8eac9fc5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "arrpc": "github:OpenAsar/arrpc#89f4da610ccfac93f461826a446a17cd3b23953d" }, "optionalDependencies": { - "@vencord/venmic": "^1.4.0" + "@vencord/venmic": "^1.6.0" }, "devDependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d45a6450..a40b858a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ dependencies: optionalDependencies: '@vencord/venmic': - specifier: ^1.4.0 - version: 1.4.0 + specifier: ^1.6.0 + version: 1.6.0 devDependencies: '@fal-works/esbuild-plugin-global-externals': @@ -53,7 +53,7 @@ devDependencies: version: 9.0.0(eslint@8.51.0) eslint-import-resolver-alias: specifier: ^1.1.2 - version: 1.1.2(eslint-plugin-import@2.28.1) + version: 1.1.2(eslint-plugin-import@2.29.0) eslint-plugin-license-header: specifier: ^0.6.0 version: 0.6.0 @@ -960,8 +960,8 @@ packages: type-fest: 3.13.1 dev: true - /@vencord/venmic@1.4.0: - resolution: {integrity: sha512-rGmO4oCLrIVSLwhRH4Qib8XWFW6hcELZhSR3+NeXVV4nwVf302g1FwhUaQXk9B//HQOieCsORf2o5e2vEmBA8w==} + /@vencord/venmic@1.6.0: + resolution: {integrity: sha512-Agh5+gDiHpqsSrrxyazeU+1JmZD286QoKj41t/omw6EmtSS8EPiENQSn7eXmXt/ooSEfa9qoXEG+Hn6hXb3rvw==} engines: {node: '>=14.15'} os: [linux] requiresBuild: true @@ -2040,13 +2040,13 @@ packages: eslint: 8.51.0 dev: true - /eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.28.1): + /eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.0): resolution: {integrity: sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w==} engines: {node: '>= 4'} peerDependencies: eslint-plugin-import: '>=1.4.0' dependencies: - eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.7.5)(eslint@8.51.0) + eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.7.5)(eslint@8.51.0) dev: true /eslint-import-resolver-node@0.3.9: @@ -2088,8 +2088,8 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.7.5)(eslint@8.51.0): - resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==} + /eslint-plugin-import@2.29.0(@typescript-eslint/parser@6.7.5)(eslint@8.51.0): + resolution: {integrity: sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' @@ -2108,7 +2108,7 @@ packages: eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.5)(eslint-import-resolver-node@0.3.9)(eslint@8.51.0) - has: 1.0.4 + hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 minimatch: 3.1.2 @@ -2780,6 +2780,7 @@ packages: /has@1.0.4: resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} engines: {node: '>= 0.4.0'} + requiresBuild: true dev: true /hasown@2.0.0: diff --git a/scripts/build/build.mts b/scripts/build/build.mts index 3ca12f47..cd46ad87 100644 --- a/scripts/build/build.mts +++ b/scripts/build/build.mts @@ -34,12 +34,23 @@ async function createContext(options: BuildOptions) { contexts.push(await context(options)); } -await Promise.all([ - process.platform === "linux" && +async function copyVenmic() { + if (process.platform !== "linux") return; + + return Promise.all([ copyFile( "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-x64/node-napi-v7.node", - "./static/dist/venmic.node" - ).catch(() => console.warn("Failed to copy venmic. Building without venmic support")), + "./static/dist/venmic-x64.node" + ), + copyFile( + "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-arm64/node-napi-v7.node", + "./static/dist/venmic-arm64.node" + ) + ]).catch(() => console.warn("Failed to copy venmic. Building without venmic support")); +} + +await Promise.all([ + copyVenmic(), createContext({ ...NodeCommonOpts, entryPoints: ["src/main/index.ts"], diff --git a/src/main/virtmic.ts b/src/main/virtmic.ts index 963047e8..763e25d2 100644 --- a/src/main/virtmic.ts +++ b/src/main/virtmic.ts @@ -26,7 +26,9 @@ function obtainVenmic() { if (!initialized) { initialized = true; try { - const { PatchBay } = require(join(STATIC_DIR, "dist/venmic.node")) as typeof import("@vencord/venmic"); + const { PatchBay } = require( + join(STATIC_DIR, `dist/venmic-${process.arch}.node`) + ) as typeof import("@vencord/venmic"); patchBay = new PatchBay(); } catch (e: any) { console.error("Failed to initialise venmic. Make sure you're using pipewire", e);