-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,401 changed files
with
1,005,249 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import("//build/ten_runtime/options.gni") | ||
|
||
template("ten_prebuilt_library") { | ||
assert(defined(invoker.url), "Must provide dist url") | ||
|
||
_dir_path = "prebuilt/${invoker.name}/lib" | ||
_zip_path = "${_dir_path}/${invoker.name}.zip" | ||
|
||
_download_target = "${target_name}_lib_download" | ||
action(_download_target) { | ||
script = "//build/ten_common/scripts/download.py" | ||
|
||
_source_file = "${invoker.url}" | ||
_dest_file = "${root_out_dir}/${_zip_path}" | ||
|
||
args = [ | ||
_source_file, | ||
rebase_path(_dest_file), | ||
] | ||
|
||
inputs = [ "//build/ten_common/scripts/download.py" ] | ||
outputs = [ _dest_file ] | ||
} | ||
|
||
_is_shared_library = | ||
defined(invoker.is_shared_library) && invoker.is_shared_library | ||
|
||
_lib_prefix = "lib" | ||
_lib_postfix = "" | ||
if (_is_shared_library) { | ||
if (is_linux) { | ||
_lib_postfix = ".so" | ||
} else if (is_win) { | ||
_lib_postfix = ".dll" | ||
} else if (is_mac) { | ||
_lib_postfix = ".dylib" | ||
} else { | ||
assert(0, "Unsupported platform.") | ||
} | ||
} else { | ||
_lib_postfix = ".a" | ||
} | ||
|
||
# Construct the actual library file name. | ||
_lib_file_paths = [] | ||
foreach(lib, invoker.libs) { | ||
_lib_file_paths += | ||
[ "${root_out_dir}/${_dir_path}/${_lib_prefix}${lib}${_lib_postfix}" ] | ||
} | ||
|
||
_unzip_target = "${target_name}_lib_unzip" | ||
action(_unzip_target) { | ||
script = "//build/ten_common/scripts/unzip.py" | ||
|
||
_source_file = "${root_out_dir}/${_zip_path}" | ||
|
||
args = [ | ||
rebase_path(_source_file), | ||
rebase_path(_dir_path), | ||
] | ||
|
||
inputs = [ | ||
_source_file, | ||
"//build/ten_common/scripts/unzip.py", | ||
] | ||
|
||
outputs = [ "${root_out_dir}/${_dir_path}" ] | ||
outputs += _lib_file_paths | ||
|
||
# Need to complete the downloading first. | ||
deps = [ ":${_download_target}" ] | ||
} | ||
|
||
config("${target_name}_config") { | ||
libs = invoker.libs | ||
lib_dirs = [ rebase_path("${root_out_dir}/${_dir_path}") ] | ||
|
||
if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != []) { | ||
if (!defined(ldflags)) { | ||
ldflags = [] | ||
} | ||
|
||
ldflags += invoker.extra_ldflags | ||
} | ||
} | ||
|
||
group(target_name) { | ||
forward_variables_from(invoker, | ||
[ | ||
"deps", | ||
"public_deps", | ||
"data_deps", | ||
"testonly", | ||
"visibility", | ||
]) | ||
|
||
if (!defined(deps)) { | ||
deps = [] | ||
} | ||
|
||
# Need to complete the unzip. | ||
deps += [ | ||
# ":${_delete_zip_target}", | ||
":${_unzip_target}", | ||
] | ||
|
||
# To enable the caller to 'depends' on the prebuilt libraries. | ||
# public_deps = [ ":${_delete_zip_target}" ] | ||
public_deps = [ ":${_unzip_target}" ] | ||
|
||
# Inject the header file inclusion path into the caller. | ||
public_configs = [ ":${target_name}_config" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import sys | ||
import requests | ||
|
||
|
||
def download_file(url, output_path): | ||
response = requests.get(url, stream=True) | ||
response.raise_for_status() | ||
with open(output_path, "wb") as file: | ||
for chunk in response.iter_content(chunk_size=8192): | ||
file.write(chunk) | ||
|
||
|
||
if __name__ == "__main__": | ||
download_file(sys.argv[1], sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import zipfile | ||
import sys | ||
import os | ||
|
||
|
||
def unzip_file(src_path, dest_path) -> int | None: | ||
if not os.path.exists(src_path): | ||
return -1 | ||
|
||
src_dir = os.path.dirname(src_path) | ||
dst_dir = src_dir if dest_path == "" else dest_path | ||
if not os.path.exists(dst_dir): | ||
os.makedirs(dst_dir) | ||
|
||
zip_ref = zipfile.ZipFile(src_path, "r") | ||
zip_ref.extractall(dst_dir) | ||
zip_ref.close() | ||
|
||
|
||
def main(argv): | ||
if len(argv) < 2: | ||
return -1 | ||
dest_path = "" if len(argv) < 3 else argv[2] | ||
return unzip_file(argv[0], dest_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv[1:])) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0. | ||
# See the LICENSE file for more information. | ||
# | ||
import("//build/feature/ten_package.gni") | ||
import("//build/ten_runtime/feature/publish.gni") | ||
import("//build/ten_runtime/glob.gni") | ||
import("//build/ten_runtime/options.gni") | ||
|
||
config("nodejs_addon_loader_config") { | ||
cflags_cc = [ "-std=c++17" ] | ||
} | ||
|
||
ten_package("nodejs_addon_loader") { | ||
package_kind = "addon_loader" | ||
enable_build = true | ||
|
||
resources = [ | ||
"manifest.json", | ||
"property.json", | ||
] | ||
|
||
configs = [ ":nodejs_addon_loader_config" ] | ||
|
||
sources = [ "src/main.cc" ] | ||
include_dirs = [ "//core" ] | ||
|
||
deps = [ | ||
"//core/src/ten_runtime", | ||
"//third_party/node", | ||
] | ||
} | ||
|
||
if (ten_enable_ten_manager) { | ||
ten_package_publish("upload_nodejs_addon_loader_to_server") { | ||
base_dir = rebase_path( | ||
"${root_out_dir}/ten_packages/addon_loader/nodejs_addon_loader") | ||
deps = [ ":nodejs_addon_loader" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright © 2025 Agora | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
18 changes: 18 additions & 0 deletions
18
packages/core_addon_loaders/nodejs_addon_loader/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"type": "addon_loader", | ||
"name": "nodejs_addon_loader", | ||
"version": "0.6.0", | ||
"dependencies": [ | ||
{ | ||
"type": "system", | ||
"name": "ten_runtime", | ||
"version": "0.6.0" | ||
}, | ||
{ | ||
"type": "system", | ||
"name": "ten_runtime_nodejs", | ||
"version": "0.6.0" | ||
} | ||
], | ||
"api": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.