提交 87b0ee24 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi

Switch from GYP to Meson for compiling all targets, remove `bear` dependency as…

Switch from GYP to Meson for compiling all targets, remove `bear` dependency as required files are generated automatically, link libmediasoup-worker dependencies together (except OpenSSL, Rust version is currently broken because of that)
上级 084a0a0d
...@@ -2,16 +2,8 @@ ...@@ -2,16 +2,8 @@
/coverage/ /coverage/
/NO_GIT/ /NO_GIT/
# clang-tidy stuff. # Generated stuff.
/worker/compile_commands.json
# gyp generated stuff.
/worker/out/ /worker/out/
/worker/**/*.xcodeproj/
/worker/**/*.sln
/worker/**/*.vcxproj
/worker/**/*.vcxproj.filters
/worker/**/*.vcxproj.user
# clang-fuzzer stuff is too big. # clang-fuzzer stuff is too big.
/worker/deps/clang-fuzzer /worker/deps/clang-fuzzer
......
...@@ -96,7 +96,7 @@ Cleans built objects and binaries. ...@@ -96,7 +96,7 @@ Cleans built objects and binaries.
### `make clean-all` ### `make clean-all`
Cleans all objects and binaries, including those generated for library dependencies (such as libuv, openssl, libsrtp, etc). Cleans all objects and binaries as well as `meson` and `ninja` installed in local prefix with pip.
### `make xcode` ### `make xcode`
...@@ -119,25 +119,13 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/ ...@@ -119,25 +119,13 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/
Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder. Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder.
### `make bear`
Generates the `worker/compile_commands_template.json` file which is a ["Clang compilation database"](https://clang.llvm.org/docs/JSONCompilationDatabase.html).
**Requirements:**
* [Bear](https://github.com/rizsotto/Bear) is required.
- Install it in Debian/Ubuntu via `apt install bear` and in OSX via `brew install bear`.
- For now, Bear version must be 2.1.X.
* Before running `make bear` you must have mediasoup C/C++ dependencies already compiled. To be sure, run `make clean-all && make` before running `make bear`.
### `make tidy` ### `make tidy`
Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules. Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules.
**Requirements:** **Requirements:**
* `make clean-all`, then `make` and then `make bear` must have been called first. * `make clean` and `make` must have been called first.
* [PyYAML](https://pyyaml.org/) is required. * [PyYAML](https://pyyaml.org/) is required.
- In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`. - In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`.
......
...@@ -7,7 +7,7 @@ RUN \ ...@@ -7,7 +7,7 @@ RUN \
&& apt-get install --yes \ && apt-get install --yes \
bash-completion wget curl subversion screen gcc g++ cmake ninja-build golang \ bash-completion wget curl subversion screen gcc g++ cmake ninja-build golang \
autoconf libtool apache2 python-dev pkg-config zlib1g-dev libgcrypt11-dev \ autoconf libtool apache2 python-dev pkg-config zlib1g-dev libgcrypt11-dev \
libgss-dev libssl-dev libxml2-dev nasm libarchive-dev make bear automake \ libgss-dev libssl-dev libxml2-dev nasm libarchive-dev make automake \
libdbus-1-dev libboost-dev autoconf-archive bash-completion python-yaml libdbus-1-dev libboost-dev autoconf-archive bash-completion python-yaml
# Install node 10. # Install node 10.
......
...@@ -2,58 +2,69 @@ ...@@ -2,58 +2,69 @@
# make tasks for mediasoup-worker. # make tasks for mediasoup-worker.
# #
# Best effort to prefer Python 2 executable since there are yet pending issues # We need Python 3 here.
# with gyp and Python3. PYTHON ?= $(shell command -v python3 2> /dev/null || echo python)
PYTHON ?= $(shell command -v python2 2> /dev/null || command -v python 2> /dev/null || echo python3)
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4) CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4)
MEDIASOUP_OUT_DIR ?= out MEDIASOUP_OUT_DIR ?= out
MEDIASOUP_BUILDTYPE ?= Release MEDIASOUP_BUILDTYPE ?= Release
GULP = ./scripts/node_modules/.bin/gulp GULP = ./scripts/node_modules/.bin/gulp
LCOV = ./deps/lcov/bin/lcov LCOV = ./deps/lcov/bin/lcov
BEAR ?= bear
SED ?= sed
DOCKER ?= docker DOCKER ?= docker
PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
MESON ?= $(PIP_DIR)/bin/meson
MESON_ARGS ?= ""
# Disable `*.pyc` files creation
export PYTHONDONTWRITEBYTECODE = 1
# Instruct `meson` where to look for ninja binary
export NINJA = $(PIP_DIR)/bin/ninja
# Instruct Python where to look for modules it needs, such that `meson` actually runs from installed location
export PYTHONPATH = $(PIP_DIR)
.PHONY: \ .PHONY: \
default clean clean-all xcode lint format test bear tidy \ default meson-ninja setup clean clean-all mediasoup-worker xcode lint format test tidy \
fuzzer fuzzer-run-all docker-build docker-run libmediasoup-worker fuzzer fuzzer-run-all docker-build docker-run libmediasoup-worker
default: default: mediasoup-worker
ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker meson-ninja:
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR) ifeq ($(wildcard $(PIP_DIR)),)
# Updated pip and setuptools are needed for meson
# `--system` is not present everywhere and is only needed as workaround for Debian-specific issue (copied from
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
$(PYTHON) -m pip install --system --target=$(PIP_DIR) pip setuptools || \
$(PYTHON) -m pip install --target=$(PIP_DIR) pip setuptools
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation
$(PYTHON) -m pip install --upgrade --target=$(PIP_DIR) meson ninja
endif
setup: meson-ninja
ifeq ($(wildcard $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)),)
ifeq ($(MEDIASOUP_BUILDTYPE),Release)
$(MESON) setup --buildtype release $(MESON_ARGS) $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
else
ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
$(MESON) setup --buildtype debug $(MESON_ARGS) $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
else
$(MESON) setup --buildtype $(MEDIASOUP_BUILDTYPE) $(MESON_ARGS) $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
endif
endif
endif endif
clean: clean:
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker $(RM) -rf $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/libmediasoup-worker.a
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/libmediasoup-worker.a
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/libmediasoup-worker.a
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/libmediasoup-worker.a
clean-all: clean-all:
$(RM) -rf $(MEDIASOUP_OUT_DIR) $(RM) -rf $(MEDIASOUP_OUT_DIR)
$(RM) -rf $(ROOT_DIR)/mediasoup-worker.xcodeproj
$(RM) -rf $(ROOT_DIR)/mediasoup-worker-test.xcodeproj
$(RM) -rf $(ROOT_DIR)/deps/gyp/pylib/gyp/__pycache__
$(RM) -rf $(ROOT_DIR)/deps/gyp/pylib/gyp/generator/__pycache__
$(RM) -rf $(ROOT_DIR)/deps/*/*.xcodeproj
$(RM) -rf $(ROOT_DIR)/libwebrtc/*/*.xcodeproj
xcode: mediasoup-worker: setup
$(PYTHON) ./scripts/configure.py --format=xcode ifeq ($(MEDIASOUP_WORKER_BIN),)
$(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker
endif
xcode: setup
$(MESON) setup --buildtype debug --backend xcode $(MEDIASOUP_OUT_DIR)/xcode
lint: lint:
$(GULP) --gulpfile ./scripts/gulpfile.js lint:worker $(GULP) --gulpfile ./scripts/gulpfile.js lint:worker
...@@ -61,38 +72,30 @@ lint: ...@@ -61,38 +72,30 @@ lint:
format: format:
$(GULP) --gulpfile ./scripts/gulpfile.js format:worker $(GULP) --gulpfile ./scripts/gulpfile.js format:worker
test: test: setup
ifeq ($(MEDIASOUP_WORKER_BIN),) ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-test $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker-test
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR)
$(LCOV) --directory ./ --zerocounters $(LCOV) --directory ./ --zerocounters
./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS) ./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
endif endif
bear:
$(MAKE) clean
$(BEAR) -o compile_commands_template.json $(MAKE)
$(SED) -i" " "s|$(PWD)|PATH|g" compile_commands_template.json
tidy: tidy:
$(SED) "s|PATH|$(PWD)|g" compile_commands_template.json > compile_commands.json
$(PYTHON) ./scripts/clang-tidy.py \ $(PYTHON) ./scripts/clang-tidy.py \
-clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \ -clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \
-clang-apply-replacements-binary=./scripts/node_modules/.bin/clang-apply-replacements \ -clang-apply-replacements-binary=./scripts/node_modules/.bin/clang-apply-replacements \
-header-filter='(Channel/**/*.hpp|DepLibSRTP.hpp|DepLibUV.hpp|DepLibWebRTC.hpp|DepOpenSSL.hpp|DepUsrSCTP.hpp|LogLevel.hpp|Logger.hpp|MediaSoupError.hpp|RTC/**/*.hpp|Settings.hpp|Utils.hpp|Worker.hpp|common.hpp|handles/**/*.hpp)' \ -header-filter='(Channel/**/*.hpp|DepLibSRTP.hpp|DepLibUV.hpp|DepLibWebRTC.hpp|DepOpenSSL.hpp|DepUsrSCTP.hpp|LogLevel.hpp|Logger.hpp|MediaSoupError.hpp|RTC/**/*.hpp|Settings.hpp|Utils.hpp|Worker.hpp|common.hpp|handles/**/*.hpp)' \
-p=. \ -p=$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) \
-j=$(CORES) \ -j=$(CORES) \
-checks=$(MEDIASOUP_TIDY_CHECKS) \ -checks=$(MEDIASOUP_TIDY_CHECKS) \
-quiet -quiet
fuzzer: fuzzer: setup
ifeq ($(MEDIASOUP_WORKER_BIN),) ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-fuzzer $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker-fuzzer
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR)
endif endif
fuzzer-run-all: fuzzer-run-all:
LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus
docker-build: docker-build:
ifeq ($(DOCKER_NO_CACHE),true) ifeq ($(DOCKER_NO_CACHE),true)
...@@ -109,6 +112,5 @@ docker-run: ...@@ -109,6 +112,5 @@ docker-run:
-v $(shell pwd)/../:/mediasoup \ -v $(shell pwd)/../:/mediasoup \
mediasoup/docker:latest mediasoup/docker:latest
libmediasoup-worker: libmediasoup-worker: setup
$(PYTHON) ./scripts/configure.py -R libmediasoup-worker $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) libmediasoup-worker
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR)
...@@ -116,7 +116,6 @@ fn main() { ...@@ -116,7 +116,6 @@ fn main() {
// number of files. So instead we build in place, copy files to out directory and then clean // number of files. So instead we build in place, copy files to out directory and then clean
// after ourselves // after ourselves
{ {
// Build
if !Command::new("make") if !Command::new("make")
.arg("libmediasoup-worker") .arg("libmediasoup-worker")
.env("PYTHONDONTWRITEBYTECODE", "1") .env("PYTHONDONTWRITEBYTECODE", "1")
...@@ -129,18 +128,7 @@ fn main() { ...@@ -129,18 +128,7 @@ fn main() {
panic!("Failed to build libmediasoup-worker") panic!("Failed to build libmediasoup-worker")
} }
for file in &[ for file in &["libmediasoup-worker.a"] {
"libnetstring.a",
"libuv.a",
"libopenssl.a",
"libsrtp.a",
"libusrsctp.a",
"libwebrtc.a",
"libmediasoup-worker.a",
"libabseil.a",
#[cfg(windows)]
"libgetopt.a",
] {
std::fs::copy( std::fs::copy(
format!("{}/out/Release/{}", current_dir, file), format!("{}/out/Release/{}", current_dir, file),
format!("{}/{}", out_dir, file), format!("{}/{}", out_dir, file),
...@@ -168,15 +156,6 @@ fn main() { ...@@ -168,15 +156,6 @@ fn main() {
} }
} }
println!("cargo:rustc-link-lib=static=netstring");
println!("cargo:rustc-link-lib=static=uv");
println!("cargo:rustc-link-lib=static=openssl");
println!("cargo:rustc-link-lib=static=srtp");
println!("cargo:rustc-link-lib=static=usrsctp");
println!("cargo:rustc-link-lib=static=webrtc");
println!("cargo:rustc-link-lib=static=mediasoup-worker"); println!("cargo:rustc-link-lib=static=mediasoup-worker");
println!("cargo:rustc-link-lib=static=abseil");
#[cfg(windows)]
println!("cargo:rustc-link-lib=static=getopt");
println!("cargo:rustc-link-search=native={}", out_dir); println!("cargo:rustc-link-search=native={}", out_dir);
} }
{
'variables':
{
# libuv variables.
'uv_library%': 'static_library',
# openssl variables.
'library%': 'static_library',
'openssl_fips%': '',
'openssl_no_asm%': 0,
'libopenssl': '<(PRODUCT_DIR)/libopenssl.a',
# usrsctp variables.
'sctp_debug%': 'false',
# Others.
'clang%': 0,
'mediasoup_asan%': 'false'
},
'target_defaults':
{
'default_configuration': 'Release',
'configurations':
{
'Release':
{
'cflags': [ '-O3', '-Wno-unknown-warning-option', '-fPIC' ]
},
'Debug':
{
'defines': [ 'DEBUG', 'MS_LOG_TRACE', 'MS_LOG_FILE_LINE' ],
'cflags': [ '-g', '-O0', '-Wno-parentheses-equality', '-Wno-unknown-warning-option', '-fPIC' ],
'xcode_settings':
{
'GCC_OPTIMIZATION_LEVEL': '0'
}
}
},
'xcode_settings':
{
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'PREBINDING': 'NO', # No -Wl,-prebind
'OTHER_CFLAGS':
[
'-fstrict-aliasing',
'-g',
'-fPIC'
],
'WARNING_CFLAGS':
[
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
'-Wundeclared-selector',
'-Wno-parentheses-equality'
]
},
'conditions':
[
[ 'target_arch == "ia32"', {
'xcode_settings': { 'ARCHS': [ 'i386' ] }
}],
[ 'target_arch == "x64"', {
'xcode_settings': { 'ARCHS': [ 'x86_64' ] }
}],
[ 'target_arch == "arm64"', {
'xcode_settings': { 'ARCHS': [ 'arm64' ] }
}],
[ 'OS in "linux freebsd openbsd solaris"', {
'target_conditions':
[
[ '_type == "static_library"', {
# Disable thin archive which needs binutils >= 2.19.
'standalone_static_library': 1
}]
],
'conditions':
[
[ 'target_arch == "ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ]
}],
[ 'target_arch == "x64"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ]
}]
]
}]
]
}
}
差异被折叠。
{
'make_global_settings':
[
['CC.target', '<(openssl_fips)/bin/fipsld'],
['LINK', '<(openssl_fips)/bin/fipsld']
]
}
差异被折叠。
#!/usr/bin/env python
#
# Script inspired in bud:
# https://github.com/indutny/bud
#
import platform
import os
import subprocess
import sys
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
root = os.path.normpath(os.path.join(script_dir, '..'))
output_dir = os.environ.get('MEDIASOUP_OUT_DIR', os.path.join(os.path.abspath(root), 'out'))
sys.path.insert(0, os.path.join(root, 'deps', 'gyp', 'pylib'))
try:
import gyp
except ImportError:
print('Error: you need to install gyp in deps/gyp first, run:')
print(' ./scripts/get-dep.sh gyp')
sys.exit(42)
def host_arch():
machine = platform.machine()
if machine == 'i386': return 'ia32'
if machine == 'x86_64': return 'x64'
if machine == 'AMD64': return 'x64'
if machine == 'aarch64': return 'arm64'
if machine == 'arm64': return 'arm64'
if machine == 'mips64': return 'mips64el'
if machine.startswith('arm'): return 'arm'
if machine.startswith('mips'): return 'mips'
return machine # Return as-is and hope for the best.
def compiler_version():
proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
is_clang = b'clang' in proc.communicate()[0].split(b'\n')[0]
proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
version = proc.communicate()[0].split(b'.')
mayor_version = int(version[:1][0])
if is_clang is False and mayor_version >= 7:
proc = subprocess.Popen(CC.split() + ['-dumpfullversion'], stdout=subprocess.PIPE)
version = proc.communicate()[0].split(b'.')
version = map(int, version[:2])
version = tuple(version)
return (version, is_clang)
def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
print('Error running GYP')
sys.exit(rc)
if __name__ == '__main__':
args = sys.argv[1:]
# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
# NOTE ibc: Not sure that it requires absolute path in Mac/make...
if sys.platform == 'win32':
args.append(os.path.join(root, 'mediasoup-worker.gyp'))
common_fn = os.path.join(root, 'common.gypi')
# we force vs 2010 over 2008 which would otherwise be the default for gyp.
if not os.environ.get('GYP_MSVS_VERSION'):
os.environ['GYP_MSVS_VERSION'] = '2010'
else:
args.append(os.path.join(os.path.abspath(root), 'mediasoup-worker.gyp'))
common_fn = os.path.join(os.path.abspath(root), 'common.gypi')
if os.path.exists(common_fn):
args.extend(['-I', common_fn])
args.append('--depth=' + root)
# There's a bug with windows which doesn't allow this feature.
if sys.platform != 'win32':
if '-f' not in args:
args.extend('-f make'.split())
if 'ninja' not in args:
args.extend(['-Goutput_dir=' + output_dir])
args.extend(['--generator-output', output_dir])
(major, minor), is_clang = compiler_version()
args.append('-Dgcc_version=%d' % (10 * major + minor))
args.append('-Dclang=%d' % int(is_clang))
if is_clang is False and major == 4 and minor <= 8:
raise RuntimeError('gcc <= 4.8 not supported, please upgrade your gcc')
if not any(a.startswith('-Dhost_arch=') for a in args):
args.append('-Dhost_arch=%s' % host_arch())
if not any(a.startswith('-Dtarget_arch=') for a in args):
args.append('-Dtarget_arch=%s' % host_arch())
if any(a.startswith('-Dopenssl_fips=') for a in args):
fips_fn = os.path.join(os.path.abspath(root), 'fips.gypi')
args.extend(['-I', fips_fn])
else:
args.append('-Dopenssl_fips=')
if 'asan' in args:
args.append('-Dmediasoup_asan=true')
args = filter(lambda arg: arg != 'asan', args)
else:
args.append('-Dmediasoup_asan=false')
args.append('-Dnode_byteorder=' + sys.byteorder)
gyp_args = list(args)
print(gyp_args)
run_gyp(gyp_args)
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论