Skip to content

Commit 7e9a2c2

Browse files
authored
Merge pull request #136 from ChetanXpro/Add-Windows-support-for-make-commands
feat: add mingw32-make support for Windows
2 parents e8cc6f6 + 046dca6 commit 7e9a2c2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/autoDownloadModel.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,22 @@ export default async function autoDownloadModel(
4646
logger.debug('[Nodejs-whisper] Attempting to compile model...')
4747
shell.cd('../')
4848

49-
const compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
50-
const compileResult = shell.exec(compileCommand)
49+
let compileCommand
50+
if (process.platform === 'win32') {
51+
// Try mingw32-make first
52+
if (shell.which('mingw32-make')) {
53+
compileCommand = withCuda ? 'WHISPER_CUDA=1 mingw32-make -j' : 'mingw32-make -j'
54+
} else if (shell.which('make')) {
55+
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
56+
} else {
57+
throw new Error('[Nodejs-whisper] Neither mingw32-make nor make found. Please install MinGW-w64 or MSYS2.')
58+
}
59+
} else {
60+
compileCommand = withCuda ? 'WHISPER_CUDA=1 make -j' : 'make -j'
61+
}
62+
63+
const compileResult = shell.exec(compileCommand)
64+
5165

5266
if (compileResult.code !== 0) {
5367
throw new Error(`[Nodejs-whisper] Failed to compile model: ${compileResult.stderr}`)

0 commit comments

Comments
 (0)