From 342e8ae05d4e0b7e0c3c90aaecce2d413e652846 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sat, 12 Mar 2022 07:55:11 +0300 Subject: [PATCH 01/18] Download and use MSYS/make locally in Windows --- npm-scripts.js | 25 ++++++++++++++++++++++++- worker/scripts/getmake.py | 15 +++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 worker/scripts/getmake.py diff --git a/npm-scripts.js b/npm-scripts.js index d7745688be..455ba192e7 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -1,7 +1,7 @@ const process = require('process'); const os = require('os'); const fs = require('fs'); -const { execSync } = require('child_process'); +const { execSync, spawnSync } = require('child_process'); const { version } = require('./package.json'); const isFreeBSD = os.platform() === 'freebsd'; @@ -120,6 +120,23 @@ switch (task) { if (!process.env.MEDIASOUP_WORKER_BIN) { + if (isWindows) + { + const { spawnSync } = require('child_process'); + var res = spawnSync('where', [ 'python3.exe' ]); + if (res.status !== 0) + { + res = spawnSync('where', [ 'python.exe' ]); + if (res.status !== 0) + { + console.log('Cannot find Python executable.'); + process.exit(1); + } + } + execute(String(res.stdout).trim() + ' worker\\scripts\\getmake.py'); + process.env['PATH'] = process.cwd() + '\\worker\\out\\msys\\bin;' + process.env['PATH']; + } + execute('node npm-scripts.js worker:build'); // Clean build artifacts except `mediasoup-worker`. execute(`${MAKE} clean-build -C worker`); @@ -127,6 +144,11 @@ switch (task) execute(`${MAKE} clean-subprojects -C worker`); // Clean PIP/Meson/Ninja. execute(`${MAKE} clean-pip -C worker`); + + if (isWindows) + { + execute('rmdir /s /q worker\\out\\msys'); + } } break; @@ -156,6 +178,7 @@ switch (task) { throw new TypeError(`unknown task "${task}"`); } + } function taskReplaceVersion() diff --git a/worker/scripts/getmake.py b/worker/scripts/getmake.py new file mode 100644 index 0000000000..bd70b44d64 --- /dev/null +++ b/worker/scripts/getmake.py @@ -0,0 +1,15 @@ +import io, tarfile, urllib.request + +def get(url): + tar = tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url).read())) + tar.extractall('worker/out/msys') + tar.close() + +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.23-1/bash-3.1.23-1-msys-1.0.18-bin.tar.xz/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download') From 2a9420a80f1aa9d8a2fc3aca51eb32ccdd4dd9ae Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sat, 12 Mar 2022 07:58:08 +0300 Subject: [PATCH 02/18] Extra empty string removed --- npm-scripts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 455ba192e7..722d4df140 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -178,7 +178,6 @@ switch (task) { throw new TypeError(`unknown task "${task}"`); } - } function taskReplaceVersion() From f4761f75c9839837272a7c5522465743d920446f Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sat, 12 Mar 2022 08:18:33 +0300 Subject: [PATCH 03/18] Yet another extra string removed --- npm-scripts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 722d4df140..419e5b32a0 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -122,7 +122,6 @@ switch (task) { if (isWindows) { - const { spawnSync } = require('child_process'); var res = spawnSync('where', [ 'python3.exe' ]); if (res.status !== 0) { From cab175b19f15d25f54d616615f881584586682e6 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sat, 12 Mar 2022 08:48:01 +0300 Subject: [PATCH 04/18] rmdir command replaced with rd --- npm-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 419e5b32a0..2a58b9ac0c 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -146,7 +146,7 @@ switch (task) if (isWindows) { - execute('rmdir /s /q worker\\out\\msys'); + execute('rd /s /q worker\\out\\msys'); } } From 3648fb0b34e88bfd596692d7e06b40aee7aa380f Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 13 Mar 2022 02:13:29 +0300 Subject: [PATCH 05/18] Hash check added --- worker/scripts/getmake.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/worker/scripts/getmake.py b/worker/scripts/getmake.py index bd70b44d64..3fe73f72a1 100644 --- a/worker/scripts/getmake.py +++ b/worker/scripts/getmake.py @@ -1,15 +1,17 @@ -import io, tarfile, urllib.request +import io, hashlib, tarfile, urllib.request -def get(url): - tar = tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url).read())) +def get(url, sha1): + data = urllib.request.urlopen(url).read() + assert hashlib.sha1(data).hexdigest() == sha1 + tar = tarfile.open(fileobj=io.BytesIO(data)) tar.extractall('worker/out/msys') tar.close() -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.23-1/bash-3.1.23-1-msys-1.0.18-bin.tar.xz/download') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download', '9200450ad3df8c83be323c9b14ae344d5c1ca784') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download', '056d16bfb7a91c3e3b1acf8adb20edea6fceecdd') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download', '4000b935a5bc30b4c757fde69d27716fa3c2c269') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download', '54ac256a8f0c6a89f1b3c7758f3703b4e56382be') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma/download', 'd95faa144cf06625b3932a8e84ed1a6ab6bbe644') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma/download', 'e4273ccfde8ecf3a7631446fb2b01971a24ff9f7') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.23-1/bash-3.1.23-1-msys-1.0.18-bin.tar.xz/download', 'b6ef3399b8d76b5fbbd0a88774ebc2a90e8af13a') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download', 'c7264eb13b05cf2e1a982a3c2619837b96203a27') From c8499111b18bed11a88c01d5a55623e1d2be650e Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 13 Mar 2022 03:08:54 +0300 Subject: [PATCH 06/18] Msys/make install have been moved to a task, and sha1 hash check changed to sha256 --- npm-scripts.js | 46 +++++++++++++++++++++++++++++---------- worker/scripts/getmake.py | 20 ++++++++--------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/npm-scripts.js b/npm-scripts.js index 2a58b9ac0c..4b85757218 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -17,6 +17,11 @@ const MAKE = process.env.MAKE || (isFreeBSD ? 'gmake' : 'make'); // eslint-disable-next-line no-console console.log(`npm-scripts.js [INFO] running task "${task}"`); +if (isWindows && fs.existsSync('worker/out/msys/bin/make.exe')) +{ + addMsysToPath(); +} + switch (task) { case 'typescript:build': @@ -122,18 +127,8 @@ switch (task) { if (isWindows) { - var res = spawnSync('where', [ 'python3.exe' ]); - if (res.status !== 0) - { - res = spawnSync('where', [ 'python.exe' ]); - if (res.status !== 0) - { - console.log('Cannot find Python executable.'); - process.exit(1); - } - } - execute(String(res.stdout).trim() + ' worker\\scripts\\getmake.py'); - process.env['PATH'] = process.cwd() + '\\worker\\out\\msys\\bin;' + process.env['PATH']; + installMsysMake(); + addMsysMakePath(); } execute('node npm-scripts.js worker:build'); @@ -173,6 +168,13 @@ switch (task) break; } + case 'install-msys-make': + { + installMsysMake(); + + break; + } + default: { throw new TypeError(`unknown task "${task}"`); @@ -211,3 +213,23 @@ function execute(command) process.exit(1); } } + +function installMsysMake() +{ + var res = spawnSync('where', [ 'python3.exe' ]); + if (res.status !== 0) + { + res = spawnSync('where', [ 'python.exe' ]); + if (res.status !== 0) + { + console.log('Cannot find Python executable.'); + process.exit(1); + } + } + execute(String(res.stdout).trim() + ' worker\\scripts\\getmake.py'); +} + +function addMsysToPath() +{ + process.env['PATH'] = process.cwd() + '\\worker\\out\\msys\\bin;' + process.env['PATH']; +} diff --git a/worker/scripts/getmake.py b/worker/scripts/getmake.py index 3fe73f72a1..c6c0dbb9a3 100644 --- a/worker/scripts/getmake.py +++ b/worker/scripts/getmake.py @@ -1,17 +1,17 @@ import io, hashlib, tarfile, urllib.request -def get(url, sha1): +def get(url, digest): data = urllib.request.urlopen(url).read() - assert hashlib.sha1(data).hexdigest() == sha1 + assert hashlib.sha256(data).hexdigest() == digest tar = tarfile.open(fileobj=io.BytesIO(data)) tar.extractall('worker/out/msys') tar.close() -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download', '9200450ad3df8c83be323c9b14ae344d5c1ca784') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download', '056d16bfb7a91c3e3b1acf8adb20edea6fceecdd') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download', '4000b935a5bc30b4c757fde69d27716fa3c2c269') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download', '54ac256a8f0c6a89f1b3c7758f3703b4e56382be') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma/download', 'd95faa144cf06625b3932a8e84ed1a6ab6bbe644') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma/download', 'e4273ccfde8ecf3a7631446fb2b01971a24ff9f7') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.23-1/bash-3.1.23-1-msys-1.0.18-bin.tar.xz/download', 'b6ef3399b8d76b5fbbd0a88774ebc2a90e8af13a') -get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download', 'c7264eb13b05cf2e1a982a3c2619837b96203a27') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download', '8c4157d739a460f85563bc4451e9f1bbd42b13c4f63770d43b9f45a781f07858') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download', '196921e8c232259c8e6a6852b9ee8d9ab2d29a91419f0c8dc27ba6f034231683') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download', '29db8c969661c511fbe2a341ab25c993c5f9c555842a75d6ddbcfa70dec16910') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download', 'f8c7990416ea16a74ac336dcfe0f596bc46b8724b2d58cf8a3509414220b2366') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2/libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma/download', '85dd8c1e27a90675c5f867be57ba7ae2bb55dde8cd2d19f284c896be134bd3d1') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/termcap/termcap-0.20050421_1-2/libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma/download', '62b58fe0880f0972fcc84a819265989b02439c1c5185870227bd25f870f7adb6') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/bash/bash-3.1.23-1/bash-3.1.23-1-msys-1.0.18-bin.tar.xz/download', '38da5419969ab883058a96322bb0f51434dd4e9f71de09cd4f75b96750944533') +get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download', '847f0cbbf07135801c8e67bf692d29b1821e816ad828753c997fa869a9b89988') From 389d01509f52a3f3b80aec38bc8161c0afbb2f8d Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 13 Mar 2022 03:18:15 +0300 Subject: [PATCH 07/18] Function name fixed. --- npm-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 4b85757218..950bff8681 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -128,7 +128,7 @@ switch (task) if (isWindows) { installMsysMake(); - addMsysMakePath(); + addMsysToPath(); } execute('node npm-scripts.js worker:build'); From a002cd147a580ea67c089c05f630adc328e57665 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 13 Mar 2022 07:29:02 +0300 Subject: [PATCH 08/18] Run MSYS setup at start if not installed yet; fixes for eslint reported errors. --- npm-scripts.js | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/npm-scripts.js b/npm-scripts.js index 950bff8681..9d317e049a 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -17,9 +17,19 @@ const MAKE = process.env.MAKE || (isFreeBSD ? 'gmake' : 'make'); // eslint-disable-next-line no-console console.log(`npm-scripts.js [INFO] running task "${task}"`); -if (isWindows && fs.existsSync('worker/out/msys/bin/make.exe')) +if (isWindows) { - addMsysToPath(); + if (!fs.existsSync('worker/out/msys/bin/make.exe')) + { + installMsysMake(); + } + + const msysPath = `${process.cwd()}\\worker\\out\\msys\\bin`; + + if (process.env['PATH'].indexOf(msysPath) < 0) + { + process.env['PATH'] = `${msysPath};${process.env['PATH']}`; + } } switch (task) @@ -125,12 +135,6 @@ switch (task) { if (!process.env.MEDIASOUP_WORKER_BIN) { - if (isWindows) - { - installMsysMake(); - addMsysToPath(); - } - execute('node npm-scripts.js worker:build'); // Clean build artifacts except `mediasoup-worker`. execute(`${MAKE} clean-build -C worker`); @@ -168,13 +172,6 @@ switch (task) break; } - case 'install-msys-make': - { - installMsysMake(); - - break; - } - default: { throw new TypeError(`unknown task "${task}"`); @@ -216,20 +213,18 @@ function execute(command) function installMsysMake() { - var res = spawnSync('where', [ 'python3.exe' ]); + let res = spawnSync('where', [ 'python3.exe' ]); + if (res.status !== 0) { res = spawnSync('where', [ 'python.exe' ]); if (res.status !== 0) { - console.log('Cannot find Python executable.'); + // eslint-disable-next-line no-console + console.error('Cannot find Python executable.'); process.exit(1); } } - execute(String(res.stdout).trim() + ' worker\\scripts\\getmake.py'); -} -function addMsysToPath() -{ - process.env['PATH'] = process.cwd() + '\\worker\\out\\msys\\bin;' + process.env['PATH']; + execute(`${String(res.stdout).trim()} worker\\scripts\\getmake.py`); } From 37276c0f16287a451cfa604b497671eac24e3180 Mon Sep 17 00:00:00 2001 From: snnz Date: Sun, 13 Mar 2022 07:37:46 +0300 Subject: [PATCH 09/18] Update npm-scripts.js Co-authored-by: Nazar Mokrynskyi --- npm-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 9d317e049a..796c053701 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -26,7 +26,7 @@ if (isWindows) const msysPath = `${process.cwd()}\\worker\\out\\msys\\bin`; - if (process.env['PATH'].indexOf(msysPath) < 0) + if (!process.env['PATH'].includes(msysPath)) { process.env['PATH'] = `${msysPath};${process.env['PATH']}`; } From 70bd19fd891e3090897833e500d104be9a03d2ca Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 3 Apr 2022 06:31:42 +0300 Subject: [PATCH 10/18] Rust version added. --- worker/build.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/worker/build.rs b/worker/build.rs index c58799ba93..7b3e4d4d0e 100644 --- a/worker/build.rs +++ b/worker/build.rs @@ -77,7 +77,30 @@ fn main() { } #[cfg(target_os = "windows")] { - // Nothing special is needed so far + if !std::path::Path::new("worker/out/msys/bin/make.exe").exists() { + let python = if Command::new("where") + .arg("python3.exe") + .status() + .expect("Failed to start") + .success() { + "python3" + } + else { + "python" + }; + + if !Command::new(python) + .arg("scripts\\getmake.py") + .status() + .expect("Failed to start") + .success() { + panic!("Failed to install MSYS/make") + } + } + + env::set_var("PATH", format!("{}\\worker\\out\\msys\\bin;{}", + env::current_dir().unwrap().into_os_string().into_string().unwrap(), + env::var("PATH").unwrap())); } // Build From 7aae469257d1b5632931e767e9d5a7828ff2cea9 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 3 Apr 2022 11:58:17 +0300 Subject: [PATCH 11/18] cargo fmt has been run --- worker/build.rs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/worker/build.rs b/worker/build.rs index 7b3e4d4d0e..987779cae8 100644 --- a/worker/build.rs +++ b/worker/build.rs @@ -82,25 +82,35 @@ fn main() { .arg("python3.exe") .status() .expect("Failed to start") - .success() { - "python3" - } - else { - "python" + .success() + { + "python3" + } else { + "python" }; if !Command::new(python) .arg("scripts\\getmake.py") .status() .expect("Failed to start") - .success() { + .success() + { panic!("Failed to install MSYS/make") } } - env::set_var("PATH", format!("{}\\worker\\out\\msys\\bin;{}", - env::current_dir().unwrap().into_os_string().into_string().unwrap(), - env::var("PATH").unwrap())); + env::set_var( + "PATH", + format!( + "{}\\worker\\out\\msys\\bin;{}", + env::current_dir() + .unwrap() + .into_os_string() + .into_string() + .unwrap(), + env::var("PATH").unwrap() + ), + ); } // Build From e971fd1242b8a918bd5d3bd6e19211508fef9d17 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Sun, 3 Apr 2022 13:04:51 +0300 Subject: [PATCH 12/18] Get rid of nproc in cpu_cores.sh in case of MinGW --- worker/scripts/cpu_cores.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/scripts/cpu_cores.sh b/worker/scripts/cpu_cores.sh index e507b693d5..b5cdde81d0 100755 --- a/worker/scripts/cpu_cores.sh +++ b/worker/scripts/cpu_cores.sh @@ -6,8 +6,9 @@ OS="$(uname -s)" NUM_CORES= case "${OS}" in - Linux*|MINGW*) NUM_CORES=$(nproc);; + Linux*) NUM_CORES=$(nproc);; Darwin*|FreeBSD) NUM_CORES=$(sysctl -n hw.ncpu);; + MINGW*) NUM_CORES=$NUMBER_OF_PROCESSORS;; *) NUM_CORES=1;; esac From ffb1526cd8b5eda01c22a2399acaa334d1790e5b Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Wed, 5 Oct 2022 14:42:52 +0300 Subject: [PATCH 13/18] Cosmetic change. --- npm-scripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 796c053701..0055b7f381 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -221,7 +221,8 @@ function installMsysMake() if (res.status !== 0) { // eslint-disable-next-line no-console - console.error('Cannot find Python executable.'); + console.error('Cannot find Python executable'); + process.exit(1); } } From f1a8a51d0ca08880a93d96bcb345d4c1e666dce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Sat, 5 Nov 2022 22:08:15 +0100 Subject: [PATCH 14/18] Update npm-scripts.js --- npm-scripts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/npm-scripts.js b/npm-scripts.js index b5c09d57ff..9a42fe069d 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -218,6 +218,7 @@ function installMsysMake() if (res.status !== 0) { res = spawnSync('where', [ 'python.exe' ]); + if (res.status !== 0) { // eslint-disable-next-line no-console From 87e0cf7ac63a5dbb62666a430f54a758e5592b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Sat, 5 Nov 2022 22:08:21 +0100 Subject: [PATCH 15/18] Update npm-scripts.js --- npm-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 9a42fe069d..0c7ce7b7ac 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -222,7 +222,7 @@ function installMsysMake() if (res.status !== 0) { // eslint-disable-next-line no-console - console.error('Cannot find Python executable'); + console.error('`npm-scripts.js [ERROR] cannot find Python executable'); process.exit(1); } From ce6b64b283a82ad0c56d5a1b9326fe8cffd0f267 Mon Sep 17 00:00:00 2001 From: Sergey Nozhenko Date: Thu, 16 Feb 2023 04:12:30 +0300 Subject: [PATCH 16/18] Replacing execute with executeCmd. --- npm-scripts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-scripts.js b/npm-scripts.js index 5163113b57..c006642cb1 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -258,7 +258,7 @@ function cleanWorker() if (isWindows) { - execute('rd /s /q worker\\out\\msys'); + executeCmd('rd /s /q worker\\out\\msys'); } } @@ -361,5 +361,5 @@ function installMsysMake() } } - execute(`${String(res.stdout).trim()} worker\\scripts\\getmake.py`); + executeCmd(`${String(res.stdout).trim()} worker\\scripts\\getmake.py`); } From 8507e5f0df7d12e7a12ca8763dc2899b5d5f3819 Mon Sep 17 00:00:00 2001 From: snnz Date: Fri, 17 Feb 2023 19:12:45 +0300 Subject: [PATCH 17/18] Update npm-scripts.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: IƱaki Baz Castillo --- npm-scripts.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm-scripts.js b/npm-scripts.js index c006642cb1..5f7eb23a0c 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -346,6 +346,8 @@ function executeCmd(command, exitOnError = true) function installMsysMake() { + console.log('npm-scripts.js [INFO] installMsysMake()'); + let res = spawnSync('where', [ 'python3.exe' ]); if (res.status !== 0) From c5746f752575ce3d33e48d12f9660f0cbab329d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Fri, 17 Feb 2023 18:12:14 +0100 Subject: [PATCH 18/18] Update npm-scripts.js --- npm-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm-scripts.js b/npm-scripts.js index 5f7eb23a0c..2e8a8ab4b5 100644 --- a/npm-scripts.js +++ b/npm-scripts.js @@ -357,7 +357,7 @@ function installMsysMake() if (res.status !== 0) { // eslint-disable-next-line no-console - console.error('`npm-scripts.js [ERROR] cannot find Python executable'); + console.error('`npm-scripts.js [ERROR] installMsysMake() cannot find Python executable'); process.exit(1); }