Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
a3b13cc7
Unverified
提交
a3b13cc7
authored
10月 20, 2023
作者:
Iñaki Baz Castillo
提交者:
GitHub
10月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix NPM 'postinstall' task in Windows (#1187)
上级
e782b794
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
39 行增加
和
8 行删除
+39
-8
npm-scripts.mjs
npm-scripts.mjs
+3
-1
build.rs
worker/build.rs
+23
-5
getmake.py
worker/scripts/getmake.py
+13
-2
没有找到文件。
npm-scripts.mjs
浏览文件 @
a3b13cc7
...
@@ -445,7 +445,9 @@ function installMsysMake()
...
@@ -445,7 +445,9 @@ function installMsysMake()
pythonPath
=
String
(
res
.
stdout
).
trim
();
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
)
function
ensureDir
(
dir
)
...
...
worker/build.rs
浏览文件 @
a3b13cc7
...
@@ -16,9 +16,15 @@ fn main() {
...
@@ -16,9 +16,15 @@ fn main() {
};
};
let
out_dir
=
env
::
var
(
"OUT_DIR"
)
.unwrap
();
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
(
'\\'
,
"/"
));
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
// Add C++ std lib
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"linux"
)]
{
{
...
@@ -78,25 +84,36 @@ fn main() {
...
@@ -78,25 +84,36 @@ fn main() {
#[cfg(target_os
=
"windows"
)]
#[cfg(target_os
=
"windows"
)]
{
{
if
!
std
::
path
::
Path
::
new
(
"worker/out/msys/bin/make.exe"
)
.exists
()
{
if
!
std
::
path
::
Path
::
new
(
"worker/out/msys/bin/make.exe"
)
.exists
()
{
let
python
=
if
Command
::
new
(
"where"
)
let
python
=
if
let
Ok
(
python
)
=
env
::
var
(
"PYTHON"
)
{
.arg
(
"python3.exe"
)
python
}
else
if
Command
::
new
(
"where"
)
.arg
(
"python3"
)
.status
()
.status
()
.expect
(
"Failed to start"
)
.expect
(
"Failed to start"
)
.success
()
.success
()
{
{
"python3"
"python3"
.to_string
()
}
else
{
}
else
{
"python"
"python"
.to_string
()
};
};
let
dir
=
format!
(
"{}/msys"
,
mediasoup_out_dir
.replace
(
'\\'
,
"/"
));
if
!
Command
::
new
(
python
)
if
!
Command
::
new
(
python
)
.arg
(
"scripts
\\
getmake.py"
)
.arg
(
"scripts
\\
getmake.py"
)
.arg
(
"--dir"
)
.arg
(
dir
.clone
())
.status
()
.status
()
.expect
(
"Failed to start"
)
.expect
(
"Failed to start"
)
.success
()
.success
()
{
{
panic!
(
"Failed to install MSYS/make"
)
panic!
(
"Failed to install MSYS/make"
)
}
}
env
::
set_var
(
"PATH"
,
format!
(
"{}
\\
bin;{}"
,
dir
,
env
::
var
(
"PATH"
)
.unwrap
()),
);
}
}
env
::
set_var
(
env
::
set_var
(
...
@@ -161,6 +178,7 @@ fn main() {
...
@@ -161,6 +178,7 @@ fn main() {
// Clean
// Clean
if
!
Command
::
new
(
"make"
)
if
!
Command
::
new
(
"make"
)
.arg
(
"clean-all"
)
.arg
(
"clean-all"
)
.env
(
"PATH"
,
original_path
)
.env
(
"MEDIASOUP_OUT_DIR"
,
&
mediasoup_out_dir
)
.env
(
"MEDIASOUP_OUT_DIR"
,
&
mediasoup_out_dir
)
.spawn
()
.spawn
()
.expect
(
"Failed to start"
)
.expect
(
"Failed to start"
)
...
...
worker/scripts/getmake.py
浏览文件 @
a3b13cc7
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
):
def
get
(
url
,
digest
):
data
=
urllib
.
request
.
urlopen
(
url
)
.
read
()
data
=
urllib
.
request
.
urlopen
(
url
)
.
read
()
assert
hashlib
.
sha256
(
data
)
.
hexdigest
()
==
digest
assert
hashlib
.
sha256
(
data
)
.
hexdigest
()
==
digest
tar
=
tarfile
.
open
(
fileobj
=
io
.
BytesIO
(
data
))
tar
=
tarfile
.
open
(
fileobj
=
io
.
BytesIO
(
data
))
tar
.
extractall
(
'worker/out/msys'
)
tar
.
extractall
(
args
.
dir
)
tar
.
close
()
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'
)
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'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论