Skip to content

Commit

Permalink
Merge branch 'v3' into flatbuffers
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
ibc committed Oct 20, 2023
2 parents c889e1a + f8bc8ea commit 03867a0
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
* `Worker`: Make DTLS fragment stay within MTU size range ([PR #1156](https://github.com/versatica/mediasoup/pull/1156), based on [PR #1143](https://github.com/versatica/mediasoup/pull/1143) by @vpnts-se).


### 3.12.15

* Fix NPM "postinstall" task in Windows ([PR #1187](https://github.com/versatica/mediasoup/pull/1187)).


### 3.12.14

* CI: Use Node.js version 20 ([PR #1177](https://github.com/versatica/mediasoup/pull/1177)).
Expand Down
4 changes: 3 additions & 1 deletion npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ function installMsysMake()
pythonPath = String(res.stdout).trim();
}

executeCmd(`${pythonPath} worker\\scripts\\getmake.py`);
const dir = path.resolve('worker/out/msys');

executeCmd(`${pythonPath} worker\\scripts\\getmake.py --dir="${dir}"`);
}

function ensureDir(dir)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mediasoup",
"version": "3.12.14",
"version": "3.12.15",
"description": "Cutting Edge WebRTC Video Conferencing",
"contributors": [
"Iñaki Baz Castillo <[email protected]> (https://inakibaz.me)",
Expand Down
28 changes: 23 additions & 5 deletions worker/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ fn main() {
};

let out_dir = env::var("OUT_DIR").unwrap();
// Force forward slashes on Windows too so that is plays well with our dumb `Makefile`
// Force forward slashes on Windows too so that is plays well with our dumb `Makefile`.
let mediasoup_out_dir = format!("{}/out", out_dir.replace('\\', "/"));

// Store original PATH so we make `make clean-all` use it. This is because, in Windows,
// we may need to fetch `make` and we store it in out/msys and then we add out/msys/bin
// to the PATH, and that folder may contain rm.exe, so `make clean-all` would use
// that rm.exe and delete itself and make the task fail.
let original_path = env::var("PATH").unwrap();

// Add C++ std lib
#[cfg(target_os = "linux")]
{
Expand Down Expand Up @@ -78,25 +84,36 @@ fn main() {
#[cfg(target_os = "windows")]
{
if !std::path::Path::new("worker/out/msys/bin/make.exe").exists() {
let python = if Command::new("where")
.arg("python3.exe")
let python = if let Ok(python) = env::var("PYTHON") {
python
} else if Command::new("where")
.arg("python3")
.status()
.expect("Failed to start")
.success()
{
"python3"
"python3".to_string()
} else {
"python"
"python".to_string()
};

let dir = format!("{}/msys", mediasoup_out_dir.replace('\\', "/"));

if !Command::new(python)
.arg("scripts\\getmake.py")
.arg("--dir")
.arg(dir.clone())
.status()
.expect("Failed to start")
.success()
{
panic!("Failed to install MSYS/make")
}

env::set_var(
"PATH",
format!("{}\\bin;{}", dir, env::var("PATH").unwrap()),
);
}

env::set_var(
Expand Down Expand Up @@ -161,6 +178,7 @@ fn main() {
// Clean
if !Command::new("make")
.arg("clean-all")
.env("PATH", original_path)
.env("MEDIASOUP_OUT_DIR", &mediasoup_out_dir)
.spawn()
.expect("Failed to start")
Expand Down
15 changes: 13 additions & 2 deletions worker/scripts/getmake.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import io, hashlib, tarfile, urllib.request
import argparse, io, hashlib, tarfile, urllib.request

argParser = argparse.ArgumentParser()

argParser.add_argument(
'--dir',
type=str,
required=True,
help='absolute path of the directoy in which fetched content will be placed'
)

args = argParser.parse_args()

def get(url, digest):
data = urllib.request.urlopen(url).read()
assert hashlib.sha256(data).hexdigest() == digest
tar = tarfile.open(fileobj=io.BytesIO(data))
tar.extractall('worker/out/msys')
tar.extractall(args.dir)
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', '8c4157d739a460f85563bc4451e9f1bbd42b13c4f63770d43b9f45a781f07858')
Expand Down

0 comments on commit 03867a0

Please sign in to comment.