Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
890a2595
Unverified
提交
890a2595
authored
2月 17, 2023
作者:
snnz
提交者:
GitHub
2月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Download and use MSYS/make locally for Windows postinstall (#792)
上级
8c847d1c
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
96 行增加
和
3 行删除
+96
-3
npm-scripts.js
npm-scripts.js
+43
-1
build.rs
worker/build.rs
+34
-1
cpu_cores.sh
worker/scripts/cpu_cores.sh
+2
-1
getmake.py
worker/scripts/getmake.py
+17
-0
没有找到文件。
npm-scripts.js
浏览文件 @
890a2595
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
const
process
=
require
(
'process'
);
const
process
=
require
(
'process'
);
const
os
=
require
(
'os'
);
const
os
=
require
(
'os'
);
const
fs
=
require
(
'fs'
);
const
fs
=
require
(
'fs'
);
const
{
execSync
}
=
require
(
'child_process'
);
const
{
execSync
,
spawnSync
}
=
require
(
'child_process'
);
const
{
version
}
=
require
(
'./package.json'
);
const
{
version
}
=
require
(
'./package.json'
);
const
isFreeBSD
=
os
.
platform
()
===
'freebsd'
;
const
isFreeBSD
=
os
.
platform
()
===
'freebsd'
;
...
@@ -227,6 +227,21 @@ function buildWorker()
...
@@ -227,6 +227,21 @@ function buildWorker()
{
{
console
.
log
(
'npm-scripts.js [INFO] buildWorker()'
);
console
.
log
(
'npm-scripts.js [INFO] buildWorker()'
);
if
(
isWindows
)
{
if
(
!
fs
.
existsSync
(
'worker/out/msys/bin/make.exe'
))
{
installMsysMake
();
}
const
msysPath
=
`
${
process
.
cwd
()}
\\worker\\out\\msys\\bin`
;
if
(
!
process
.
env
[
'PATH'
].
includes
(
msysPath
))
{
process
.
env
[
'PATH'
]
=
`
${
msysPath
}
;
${
process
.
env
[
'PATH'
]}
`
;
}
}
executeCmd
(
`
${
MAKE
}
-C worker`
);
executeCmd
(
`
${
MAKE
}
-C worker`
);
}
}
...
@@ -240,6 +255,11 @@ function cleanWorker()
...
@@ -240,6 +255,11 @@ function cleanWorker()
executeCmd
(
`
${
MAKE
}
clean-subprojects -C worker`
);
executeCmd
(
`
${
MAKE
}
clean-subprojects -C worker`
);
// Clean PIP/Meson/Ninja.
// Clean PIP/Meson/Ninja.
executeCmd
(
`
${
MAKE
}
clean-pip -C worker`
);
executeCmd
(
`
${
MAKE
}
clean-pip -C worker`
);
if
(
isWindows
)
{
executeCmd
(
'rd /s /q worker
\\
out
\\
msys'
);
}
}
}
function
lintNode
()
function
lintNode
()
...
@@ -323,3 +343,25 @@ function executeCmd(command, exitOnError = true)
...
@@ -323,3 +343,25 @@ function executeCmd(command, exitOnError = true)
}
}
}
}
}
}
function
installMsysMake
()
{
console
.
log
(
'npm-scripts.js [INFO] installMsysMake()'
);
let
res
=
spawnSync
(
'where'
,
[
'python3.exe'
]);
if
(
res
.
status
!==
0
)
{
res
=
spawnSync
(
'where'
,
[
'python.exe'
]);
if
(
res
.
status
!==
0
)
{
// eslint-disable-next-line no-console
console
.
error
(
'`npm-scripts.js [ERROR] installMsysMake() cannot find Python executable'
);
process
.
exit
(
1
);
}
}
executeCmd
(
`
${
String
(
res
.
stdout
).
trim
()}
worker\\scripts\\getmake.py`
);
}
worker/build.rs
浏览文件 @
890a2595
...
@@ -77,7 +77,40 @@ fn main() {
...
@@ -77,7 +77,40 @@ fn main() {
}
}
#[cfg(target_os
=
"windows"
)]
#[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
// Build
...
...
worker/scripts/cpu_cores.sh
浏览文件 @
890a2595
...
@@ -6,8 +6,9 @@ OS="$(uname -s)"
...
@@ -6,8 +6,9 @@ OS="$(uname -s)"
NUM_CORES
=
NUM_CORES
=
case
"
${
OS
}
"
in
case
"
${
OS
}
"
in
Linux
*
|
MINGW
*
)
NUM_CORES
=
$(
nproc
)
;;
Linux
*
)
NUM_CORES
=
$(
nproc
)
;;
Darwin
*
|
FreeBSD
)
NUM_CORES
=
$(
sysctl
-n
hw.ncpu
)
;;
Darwin
*
|
FreeBSD
)
NUM_CORES
=
$(
sysctl
-n
hw.ncpu
)
;;
MINGW
*
)
NUM_CORES
=
$NUMBER_OF_PROCESSORS
;;
*
)
NUM_CORES
=
1
;;
*
)
NUM_CORES
=
1
;;
esac
esac
...
...
worker/scripts/getmake.py
0 → 100644
浏览文件 @
890a2595
import
io
,
hashlib
,
tarfile
,
urllib
.
request
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
.
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/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'
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论