Skip to content

Commit

Permalink
More debug options for non macOs builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed Apr 15, 2024
1 parent a039611 commit 64dc4bb
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 393 deletions.
25 changes: 12 additions & 13 deletions backend/custom_build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';

// Function to change the rpath of the binary
function changeRpath(binaryPath) {
try {
// execSync(`install_name_tool -change "@rpath/libafv_native.dylib" "@loader_path/afv/libafv_native.dylib" ${binaryPath}`);
// execSync(`install_name_tool -add_rpath "@loader_path/afv/" ${binaryPath}`);
console.log('Rpath changed successfully!');
} catch (error) {
console.error('Error changing rpath:', error.message);
}
}
// // Function to change the rpath of the binary
// function changeRpath(binaryPath) {
// try {
// execSync(`install_name_tool -change "@rpath/libafv_native.dylib" "@executable_path/libafv_native.dylib" ${binaryPath}`);
// console.log('Rpath changed successfully!');
// } catch (error) {
// console.error('Error changing rpath:', error.message);
// }
// }

// Function to copy DLL files
function copyDLLs() {
Expand Down Expand Up @@ -52,9 +51,9 @@ const libraryPath = process.platform === 'darwin' ? 'build/Release/libafv_native
const certificate = 'Developer ID Application';

// Change the rpath of the binary
if (process.platform === 'darwin' || process.platform === 'linux') {
changeRpath(binaryPath);
}
// if (process.platform === 'darwin' || process.platform === 'linux') {
// changeRpath(binaryPath);
// }

// Codesign the binary on macOS
if (process.platform === 'darwin') {
Expand Down
38 changes: 16 additions & 22 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,19 @@ const config: ForgeConfig = {
hooks: {
packageAfterExtract: async (forgeConfig, buildPath) => {
console.info("Packages built at:", buildPath);

console.log("Subdirectories of buildPath:");
const subdirectories = fs.readdirSync(buildPath, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

subdirectories.forEach((subdirectory) => {
console.log(subdirectory);
const subdirectoryPath = path.join(buildPath, subdirectory);
const subSubdirectories = fs.readdirSync(subdirectoryPath, { withFileTypes: true })
const recursiveSubdirectories = (dirPath: string) => {
const subdirectories = fs.readdirSync(dirPath, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

subSubdirectories.forEach((subSubdirectory) => {
console.log(` ${subSubdirectory}`);
const subSubdirectoryPath = path.join(subdirectoryPath, subSubdirectory);
const subSubSubdirectories = fs.readdirSync(subSubdirectoryPath, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

subSubSubdirectories.forEach((subSubSubdirectory) => {
console.log(` ${subSubSubdirectory}`);
});
subdirectories.forEach((subdirectory) => {
const subdirectoryPath = path.join(dirPath, subdirectory);
console.log(subdirectoryPath);
recursiveSubdirectories(subdirectoryPath);
});
});
};

recursiveSubdirectories(buildPath);

try {
if (process.platform === "darwin") {
Expand All @@ -116,7 +104,13 @@ const config: ForgeConfig = {
console.log("file found at", trackAudioAfvPath);
console.log(
"Copied libafv_native.dylib to",
path.join(buildPath, "afv", "libafv_native.dylib")
path.join(
buildPath,
"Electron.app",
"Contents",
"Frameworks",
"libafv_native.dylib"
)
);
}

Expand Down
Loading

0 comments on commit 64dc4bb

Please sign in to comment.