Modify the instructions

Signed-off-by: lordwithcc <zhoucong40@huawei.com>
This commit is contained in:
lordwithcc 2022-09-30 09:51:12 +08:00
parent f3852ddcb7
commit 7d2a4df482
16 changed files with 692 additions and 282 deletions

View File

@ -1,75 +0,0 @@
# 方舟编译器部件
## 简介
方舟编译器部件供了一个基于GN和Ninja的集成编译构建框架。构建流程由鸿蒙方舟编译分流并在构建基础上增加跨平台方式。
方舟编译器部件架构图:
![](../figures/zh-cn_image_arkcompiler.png)
## 目录结构
```
/arkcompiler/
├── profiler # 性能调优组件
├── ets_runtime # 方舟eTS(兼容JS/TS)运行时时
├── runtime_core # 方舟运行时公共库
├── ets_frontend # 方舟eTS(兼容JS/TS)前端编译器
├── toolchain # 方舟运行时调试调优工具链
│ └── build # 编译配置
├── third_party # 三方库
│ └── protobuf
│ └── icu
│ └── zlib
│ └── bounds_checking_function
```
## 环境配置
获取源码及安装依赖工具,详细参考[点击这里](https://gitee.com/lordwithcc/arkcompiler_toolchain/blob/add_standalone_part/build/preconfig_ubuntu.md)
## 使用说明
abc文件由方舟前端将js文件转换生成的字节码文件
ark_js_vm运行abc文件的工具
### step1 生成编译产物ark_js_vm
```
python ark.py x64.release
```
### step2 将js文件转换为abc文件
```
./out/x64.release/ark/ark/es2abc test.js
```
### step3 执行生成的abc文件
```
LD_LIBRARY_PATH=out/x64.release:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/x64.release/ark/ark_js_runtime/ark_js_vm test.abc
```
### 执行262测试套
```
python ark.py x64.release -test262
```
## 编译选项
交叉编译可根据目标选择不同平台在x64平台构建android_arm目标平台
```
python ark.py android_arm.release
```
编译模式选择在x64平台构建debug版本
```
python ark.py x64.debug
```
获取更多编译说明
```
python ark.py -help
```
## 相关仓
[arkcompiler\_runtime\_core](https://gitee.com/openharmony/arkcompiler_runtime_core)
[arkcompiler\_ets\_runtime](https://gitee.com/openharmony/arkcompiler_ets_runtime)
[arkcompiler\_ets\_frontend](https://gitee.com/openharmony/arkcompiler_ets_frontend)
**[arkcompiler\_toolchain](https://gitee.com/openharmony/arkcompiler_toolchain)**
[developtools\_profiler](https://gitee.com/openharmony/developtools_profiler)

View File

@ -14,4 +14,7 @@
declare_args() {
# build version
build_public_version = true
# system package dir
system_base_dir = "system"
}

View File

@ -12,10 +12,10 @@
# limitations under the License.
# The location of the build configuration file.
buildconfig = "//toolchain/build/config/BUILDCONFIG.gn"
buildconfig = "//arkcompiler/toolchain/build/config/BUILDCONFIG.gn"
# The source root location.
root = "//toolchain/build/core/gn"
root = "//arkcompiler/toolchain/build/core/gn"
# The executable used to execute scripts in action and exec_script.
script_executable = "/usr/bin/env"

View File

@ -25,7 +25,7 @@ import sys
USE_PTY = "linux" in sys.platform
if USE_PTY:
import pty
import pty
ARCHES = ["x64", "arm", "arm64"]
DEFAULT_ARCHES = "x64"
@ -33,7 +33,7 @@ MODES = ["release", "debug"]
DEFAULT_MODES = "release"
TARGETS = ["ark_js_vm"]
DEFAULT_TARGETS = "all"
TARGETS_TEST = ["-test262"]
TARGETS_TEST = ["test262"]
USER_ARGS_TEMPLATE = """\
@ -53,160 +53,172 @@ for example , python ark.py x64.release
target: only support ark_js_vm and all now
clean: clear your data in output dir
[test]
-test262: run test262
test262: run test262
"""
def PrintHelp():
print(Help_message)
sys.exit(0)
print(Help_message)
sys.exit(0)
def _Call(cmd, silent=False):
if not silent: print("# %s" % cmd)
return subprocess.call(cmd, shell=True)
if not silent:
print("# %s" % cmd)
return subprocess.call(cmd, shell=True)
def _Write(filename, content, mode):
with open(filename, mode) as f:
f.write(content)
with open(filename, mode) as f:
f.write(content)
def GetPath(arch,mode):
subdir = "%s.%s" % (arch, mode)
return os.path.join(OUTDIR, subdir)
def _CallWithOutput(cmd,file):
host, guest = pty.openpty()
h = subprocess.Popen(cmd, shell=True, stdin=guest, stdout=guest, stderr=guest)
os.close(guest)
output_data = []
while True:
try:
build_data = os.read(host, 512).decode('utf-8')
except OSError as error:
if error == errno.ENOENT:
print ("no such file")
elif error == errno.EPERM:
print ("permission denied")
break
else:
if not build_data:
break
print(build_data)
sys.stdout.flush()
_Write(file, build_data, "a")
os.close(host)
h.wait()
return h.returncode
def GetPath(arch, mode):
subdir = "%s.%s" % (arch, mode)
return os.path.join(OUTDIR, subdir)
def _CallWithOutput(cmd, file):
host, guest = pty.openpty()
h = subprocess.Popen(cmd, shell=True, stdin=guest, stdout=guest, stderr=guest)
os.close(guest)
output_data = []
while True:
try:
build_data = os.read(host, 512).decode('utf-8')
except OSError as error:
if error == errno.ENOENT:
print("no such file")
elif error == errno.EPERM:
print("permission denied")
break
else:
if not build_data:
break
print(build_data)
sys.stdout.flush()
_Write(file, build_data, "a")
os.close(host)
h.wait()
return h.returncode
def Get_args(argvs):
args_list = argvs
args_len = len(args_list)
if args_len < 1:
print("Wrong usage")
PrintHelp()
elif args_len == 1:
args_out = args_list
if "-help" in args_out:
PrintHelp()
else :
args_out = args_list
return Get_templete(args_out)
args_list = argvs
args_len = len(args_list)
if args_len < 1:
print("Wrong usage")
PrintHelp()
elif args_len == 1:
args_out = args_list
if "--help" in args_out:
PrintHelp()
else :
args_out = args_list
return Get_templete(args_out)
def Get_templete(args_list):
global_arche = DEFAULT_ARCHES
global_mode = DEFAULT_MODES
global_target = DEFAULT_TARGETS
global_test = ''
global_clean = False
for args in args_list:
parameter = args.split(".")
for part in parameter:
if part in ARCHES:
global_arche = part
elif part in MODES:
global_mode = part
elif part in TARGETS:
global_target = part
elif part == "clean":
global_clean = True
elif part in TARGETS_TEST:
global_test = part
else:
print("\033[34mUnkown word: %s\033[0m" % part)
sys.exit(1)
# Determine the target CPU
if global_arche in ("arm", "arm64"):
ARK_cpu = global_arche
else:
ARK_cpu = "x64"
target_cpu = "target_cpu = \"%s\"" % ARK_cpu
# Determine the target OS,Only ohos for now
ARK_os = "ohos"
target_os = "target_os = \"%s\"" % ARK_os
if global_mode == "debug":
is_debug = "is_debug = true"
else:
is_debug = "is_debug = false"
all_part = (is_debug+"\n"+target_os+"\n"+target_cpu)
return [global_arche,global_mode,global_target,global_clean,USER_ARGS_TEMPLATE%(all_part),global_test]
global_arche = DEFAULT_ARCHES
global_mode = DEFAULT_MODES
global_target = DEFAULT_TARGETS
global_test = ''
global_clean = False
for args in args_list:
parameter = args.split(".")
for part in parameter:
if part in ARCHES:
global_arche = part
elif part in MODES:
global_mode = part
elif part in TARGETS:
global_target = part
elif part == "clean":
global_clean = True
elif part in TARGETS_TEST:
global_test = part
else:
print("\033[34mUnkown word: %s\033[0m" % part)
sys.exit(1)
# Determine the target CPU
if global_arche in ("arm", "arm64"):
ARK_cpu = global_arche
else:
ARK_cpu = "x64"
target_cpu = "target_cpu = \"%s\"" % ARK_cpu
# Determine the target OS,Only ohos for now
ARK_os = "ohos"
target_os = "target_os = \"%s\"" % ARK_os
if global_mode == "debug":
is_debug = "is_debug = true"
else:
is_debug = "is_debug = false"
all_part = (is_debug + "\n" + target_os + "\n" + target_cpu)
return [global_arche, global_mode, global_target, global_clean, USER_ARGS_TEMPLATE%(all_part), global_test]
def Build(template):
arch = template[0]
mode = template[1]
target = template[2]
clean = template[3]
template_part = template[4]
path = GetPath(arch,mode)
if not os.path.exists(path):
print("# mkdir -p %s" % path)
os.makedirs(path)
if clean:
print("=== start clean ===")
code = _Call("./prebuilts/build-tools/linux-x86/bin/gn clean %s" % path)
code += _Call("./prebuilts/build-tools/linux-x86/bin/ninja -C %s -t clean" % path)
if code != 0: return code
print("=== clean success! ===")
build_log = os.path.join(path, "build.log")
if not os.path.exists("args.gn"):
args_gn = os.path.join(path, "args.gn")
_Write(args_gn, template_part, "w")
if not os.path.exists("build.ninja"):
build_ninja = os.path.join(path, "build.ninja")
code = _Call("./prebuilts/build-tools/linux-x86/bin/gn gen %s" % path)
print("=== gn success! ===")
if code != 0: return code
pass_code = _CallWithOutput("./prebuilts/build-tools/linux-x86/bin/ninja -C %s %s" %
(path, target),build_log)
if pass_code == 0:print("=== ninja success! ===")
return pass_code
arch = template[0]
mode = template[1]
target = template[2]
clean = template[3]
template_part = template[4]
path = GetPath(arch, mode)
if not os.path.exists(path):
print("# mkdir -p %s" % path)
os.makedirs(path)
if clean:
print("=== start clean ===")
code = _Call("./prebuilts/build-tools/linux-x86/bin/gn clean %s" % path)
code += _Call("./prebuilts/build-tools/linux-x86/bin/ninja -C %s -t clean" % path)
if code != 0:
return code
print("=== clean success! ===")
build_log = os.path.join(path, "build.log")
if not os.path.exists("args.gn"):
args_gn = os.path.join(path, "args.gn")
_Write(args_gn, template_part, "w")
if not os.path.exists("build.ninja"):
build_ninja = os.path.join(path, "build.ninja")
code = _Call("./prebuilts/build-tools/linux-x86/bin/gn gen %s" % path)
if code != 0:
return code
else:
print("=== gn success! ===")
pass_code = _CallWithOutput("./prebuilts/build-tools/linux-x86/bin/ninja -C %s %s" %
(path, target), build_log)
if pass_code == 0:
print("=== ninja success! ===")
return pass_code
def RunTest(template):
arch = template[0]
mode = template[1]
test = template[5]
test_dir = arch+"."+mode
test262_code = '''cd ets_frontend
python3 test262/run_test262.py --es2021 all --timeout 180000 --libs-dir ../out/%s:../prebuilts/clang/ohos/linux-x86_64/llvm/lib --ark-tool=../out/%s/ark/ark_js_runtime/ark_js_vm --ark-frontend-binary=../out/%s/clang_x64/ark/ark/es2abc --merge-abc-binary=../out/%s/clang_x64/ark/ark/merge_abc --ark-frontend=es2panda
'''%(test_dir,test_dir,test_dir,test_dir)
if ("-test262" == test):
print("=== come to test ===")
return _Call(test262_code)
else:
print("=== nothing to test ===")
return 0
arch = template[0]
mode = template[1]
test = template[5]
test_dir = arch + "." + mode
test262_code = '''cd arkcompiler/ets_frontend
python3 test262/run_test262.py --es2021 all --timeout 180000 --libs-dir ../../out/%s:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib --ark-tool=../../out/%s/ark/ark_js_runtime/ark_js_vm --ark-frontend-binary=../../out/%s/clang_x64/ark/ark/es2abc --merge-abc-binary=../../out/%s/ark/ark/merge_abc --ark-frontend=es2panda
'''%(test_dir, test_dir, test_dir, test_dir)
if ("test262" == test):
print("=== come to test ===")
return _Call(test262_code)
else:
print("=== nothing to test ===")
return 0
def Main(argvs):
pass_code = 0
templete = Get_args(argvs)
pass_code += Build(templete)
if pass_code == 0:
pass_code += RunTest(templete)
if pass_code == 0:
print('\033[32mDone!\033[0m', '\033[32mARK_{} compilation finished successfully.\033[0m'.format(argvs[0].split('.')[0]))
else:
print('\033[31mError!\033[0m', '\033[31mARK_{} compilation finished with errors.\033[0m'.format(argvs[0].split('.')[0]))
return pass_code
pass_code = 0
templete = Get_args(argvs)
pass_code += Build(templete)
if pass_code == 0:
pass_code += RunTest(templete)
if pass_code == 0:
print('\033[32mDone!\033[0m', '\033[32mARK_{} compilation finished successfully.\033[0m'.format(argvs[0].split('.')[0]))
else:
print('\033[31mError!\033[0m', '\033[31mARK_{} compilation finished with errors.\033[0m'.format(argvs[0].split('.')[0]))
return pass_code
if __name__ == "__main__":
sys.exit(Main(sys.argv[1:]))
sys.exit(Main(sys.argv[1:]))

View File

@ -13,6 +13,6 @@
* limitations under the License.
*/
"use strict";
print("Hello World !");
declare function print(arg:any):string;
print("Hello world!");

View File

@ -15,7 +15,7 @@ declare_args() {
another_path = true
ark_standalone_build = true
use_musl = false
build_root = "//toolchain/build"
build_root = "//arkcompiler/toolchain/build"
}
if (target_os == "") {
@ -52,7 +52,7 @@ declare_args() {
declare_args() {
host_toolchain = ""
custom_toolchain = ""
is_standard_system = false
is_standard_system = true
is_clang = current_os != "linux" ||
(current_cpu != "s390x" && current_cpu != "s390" &&

View File

@ -11,8 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//ets_frontend/ts2panda/ts2abc_config.gni")
import("//ets_runtime/js_runtime_config.gni")
import("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni")
import("//arkcompiler/ets_runtime/js_runtime_config.gni")
print("root_out_dir=$root_out_dir")
print("root_build_dir=$root_build_dir")
@ -26,9 +26,9 @@ print("target_os=$target_os, target_cpu=$target_cpu")
print()
group("ark_js_packages") {
deps = [ "//ets_runtime/ecmascript/js_vm:ark_js_vm" ]
deps = [ "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm" ]
}
group("ark_es2abc") {
deps = [ "//ets_frontend/es2panda:es2panda" ]
deps = [ "//arkcompiler/ets_frontend/es2panda:es2panda" ]
}

View File

@ -233,7 +233,7 @@ def main():
host_platform = args.host_platform
host_cpu = args.host_cpu
tool_repo = args.tool_repo
config_file = os.path.join(args.code_dir, 'toolchain/build/prebuilts_download/prebuilts_download_config.json')
config_file = os.path.join(args.code_dir, 'arkcompiler/toolchain/build/prebuilts_download/prebuilts_download_config.json')
config_info = read_json_file(config_file)
args.npm_install_config = config_info.get('npm_install_path')
node_modules_copy_config = config_info.get('node_modules_copy')

View File

@ -130,7 +130,7 @@ script_path=$(cd $(dirname $0);pwd)
code_dir=$(dirname ${script_path})
pip3 install --trusted-host $trusted_host -i $pypi_url rich
echo "prebuilts_download start"
python3 "${code_dir}/prebuilts_download/prebuilts_download.py" $wget_ssl_check $tool_repo $npm_registry $help $cpu $platform $npm_para
python3 "arkcompiler/toolchain/build/prebuilts_download/prebuilts_download.py" $wget_ssl_check $tool_repo $npm_registry $help $cpu $platform $npm_para
echo "prebuilts_download end"
echo -e "\n"

View File

@ -1,24 +1,128 @@
{
"prebuilts_download_dir": "../../OpenHarmony_canary_prebuilts",
"npm_install_path": ["ets_frontend/ts2panda"],
"prebuilts_download_dir": "../OpenHarmony_canary_prebuilts",
"npm_install_path": [
"developtools/ace_ets2bundle/compiler",
"developtools/ace_js2bundle/ace-loader",
"third_party/jsframework",
"arkcompiler/ets_frontend/ts2panda",
"interface/sdk-js/build-tools"
],
"node_modules_copy": [
{
"src": "ets_frontend/ts2panda/node_modules",
"src": "third_party/jsframework/node_modules",
"dest": "prebuilts/build-tools/common/js-framework/node_modules",
"use_symlink": "True"
},
{
"src": "arkcompiler/ets_frontend/ts2panda/node_modules",
"dest": "prebuilts/build-tools/common/ts2abc/node_modules",
"use_symlink": "True"
},
{
"src": "test/testfwk/arkxtest/jsunit",
"dest": "developtools/ace_ets2bundle/compiler/node_modules/@ohos/hypium",
"use_symlink": "False"
},
{
"src": "test/testfwk/arkxtest/jsunit",
"dest": "developtools/ace_js2bundle/ace-loader/node_modules/@ohos/hypium",
"use_symlink": "False"
},
{
"src": "test/testfwk/arkxtest/jsunit/",
"dest": "developtools/ace_ets2bundle/compiler/node_modules/hypium/",
"use_symlink": "False"
},
{
"src": "test/testfwk/arkxtest/jsunit/",
"dest": "developtools/ace_js2bundle/ace-loader/node_modules/hypium/",
"use_symlink": "False"
}
],
"file_handle_config": [
{
"src": "/prebuilts/clang/ohos/linux-x86_64/clang-971024-20220827",
"dest": "/prebuilts/clang/ohos/linux-x86_64/llvm",
"src": "/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi",
"tmp": "/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi2",
"dest": "/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi"
},
{
"src": "/prebuilts/clang/ohos/windows-x86_64/clang_windows-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/windows-x86_64/llvm",
"rename": "true",
"symlink_src": "/lib/clang/12.0.1",
"symlink_dest": "/lib/clang/current"
},
{
"src": "/prebuilts/clang/ohos/linux-x86_64/clang_linux-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/linux-x86_64/llvm",
"rename": "true",
"symlink_src": "/lib/clang/12.0.1",
"symlink_dest": "/lib/clang/current"
},
{
"src": "/prebuilts/clang/ohos/darwin-arm64/clang_darwin-arm64-942740-20220927",
"dest": "/prebuilts/clang/ohos/darwin-arm64/llvm",
"rename": "true",
"symlink_src": "/lib/clang/12.0.1",
"symlink_dest": "/lib/clang/current"
},
{
"src": "/prebuilts/clang/ohos/darwin-x86_64/clang_darwin-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/darwin-x86_64/llvm",
"rename": "true",
"symlink_src": "/lib/clang/12.0.1",
"symlink_dest": "/lib/clang/current"
},
{
"src": "/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0/xtensa-esp32-elf",
"dest": "/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0"
},
{
"src": "/prebuilts/clang/ohos/windows-x86_64/libcxx-ndk_windows-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/windows-x86_64/libcxx-ndk",
"rename": "true"
},
{
"src": "/prebuilts/clang/ohos/linux-x86_64/libcxx-ndk_linux-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/linux-x86_64/libcxx-ndk",
"rename": "true"
},
{
"src": "/prebuilts/clang/ohos/darwin-arm64/libcxx-ndk_darwin-arm64-942740-20220927",
"dest": "/prebuilts/clang/ohos/darwin-arm64/libcxx-ndk",
"rename": "true"
},
{
"src": "/prebuilts/clang/ohos/darwin-x86_64/libcxx-ndk_darwin-x86_64-942740-20220927",
"dest": "/prebuilts/clang/ohos/darwin-x86_64/libcxx-ndk",
"rename": "true"
}
],
"linux": {
"x86_64": {
"node_config": [
{
"unzip_dir": "prebuilts/build-tools/common/nodejs",
"file_path": "/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz",
"unzip_filename": "node-v12.18.4-linux-x64"
}
],
"arm64": {
"copy_config": [
{
"unzip_dir": "prebuilts/sdk/js-loader/build-tools",
"file_path": "/openharmony/compiler/ace-loader/1.0/ace-loader-1.0.tar.gz",
"unzip_filename": "ace-loader"
},
{
"unzip_dir": "prebuilts/build-tools/common",
"file_path": "/openharmony/compiler/restool/2.007/restool-2.007.tar.gz",
"unzip_filename": "restool"
},
{
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/linux/cmake-linux-x86-3.16.5.tar.gz",
"unzip_filename": "linux"
},
{
"unzip_dir": "prebuilts/build-tools/linux-x86/bin",
"file_path": "/openharmony/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz",
@ -31,23 +135,289 @@
},
{
"unzip_dir": "prebuilts/ark_tools",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220815.tar.gz",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220923.tar.gz",
"unzip_filename": "ark_js_prebuilts"
},
{
"unzip_dir": "prebuilts/build-tools/common/nodejs",
"file_path": "/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz",
"unzip_filename": "node-v12.18.4-linux-x64"
}
],
"linux_copy_config": [
{
"unzip_dir": "prebuilts/clang/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-971024/linux/clang-971024-linux-x86_64-20220827.tar.bz2",
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/windows/cmake-windows-x86-3.16.5.tar.gz",
"unzip_filename": "windows-x86"
},
{
"unzip_dir": "prebuilts/mingw-w64/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/mingw-w64/7.0.0/clang-mingw.tar.gz",
"unzip_filename": "clang-mingw"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi",
"file_path": "/openharmony/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi.tar.gz",
"unzip_filename": "prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/aarch64",
"file_path": "/openharmony/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz",
"unzip_filename": "gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu"
},
{
"unzip_dir": "prebuilts/previewer/windows",
"file_path": "/openharmony/develop_tools/previewer/3.2.8.1/previewer-3.2.8.1-master-20221008.win.tar.gz",
"unzip_filename": "previewer"
},
{
"unzip_dir": "prebuilts/clang/ohos/windows-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/windows/clang_windows-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/windows-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/windows/libcxx-ndk_windows-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/clang/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/linux/clang_linux-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/linux/libcxx-ndk_linux-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/esp",
"file_path": "/openharmony/compiler/gcc_esp/2019r2-8.2.0/linux/esp-2019r2-8.2.0.zip",
"unzip_filename": "esp-2019r2-8.2.0"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/csky",
"file_path": "/openharmony/compiler/gcc_csky/v3.10.29/linux/csky-v3.10.29.tar.gz",
"unzip_filename": "csky"
},
{
"unzip_dir": "prebuilts/python",
"file_path": "/openharmony/compiler/python/3.9.2/linux/python-linux-x86-3.9.2_20200510.tar.gz",
"unzip_filename": "linux-x86"
}
]
},
"x86_64": {
"copy_config": [
{
"unzip_dir": "prebuilts/sdk/js-loader/build-tools",
"file_path": "/openharmony/compiler/ace-loader/1.0/ace-loader-1.0.tar.gz",
"unzip_filename": "ace-loader"
},
{
"unzip_dir": "prebuilts/build-tools/common",
"file_path": "/openharmony/compiler/restool/2.007/restool-2.007.tar.gz",
"unzip_filename": "restool"
},
{
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/linux/cmake-linux-x86-3.16.5.tar.gz",
"unzip_filename": "linux"
},
{
"unzip_dir": "prebuilts/build-tools/linux-x86/bin",
"file_path": "/openharmony/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz",
"unzip_filename": "gn"
},
{
"unzip_dir": "prebuilts/build-tools/linux-x86/bin",
"file_path": "/openharmony/compiler/ninja/1.10.1/linux/ninja-linux-x86-1.10.1.tar.gz",
"unzip_filename": "ninja"
},
{
"unzip_dir": "prebuilts/ark_tools",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220923.tar.gz",
"unzip_filename": "ark_js_prebuilts"
}
],
"linux_copy_config": [
{
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/windows/cmake-windows-x86-3.16.5.tar.gz",
"unzip_filename": "windows-x86"
},
{
"unzip_dir": "prebuilts/mingw-w64/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/mingw-w64/7.0.0/clang-mingw.tar.gz",
"unzip_filename": "clang-mingw"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi",
"file_path": "/openharmony/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi.tar.gz",
"unzip_filename": "prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/aarch64",
"file_path": "/openharmony/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz",
"unzip_filename": "gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu"
},
{
"unzip_dir": "prebuilts/previewer/windows",
"file_path": "/openharmony/develop_tools/previewer/3.2.8.1/previewer-3.2.8.1-master-20221008.win.tar.gz",
"unzip_filename": "previewer"
},
{
"unzip_dir": "prebuilts/clang/ohos/windows-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/windows/clang_windows-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/windows-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/windows/libcxx-ndk_windows-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/clang/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/linux/clang_linux-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/linux-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/linux/libcxx-ndk_linux-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/esp",
"file_path": "/openharmony/compiler/gcc_esp/2019r2-8.2.0/linux/esp-2019r2-8.2.0.zip",
"unzip_filename": "esp-2019r2-8.2.0"
},
{
"unzip_dir": "prebuilts/gcc/linux-x86/csky",
"file_path": "/openharmony/compiler/gcc_csky/v3.10.29/linux/csky-v3.10.29.tar.gz",
"unzip_filename": "csky"
},
{
"unzip_dir": "prebuilts/python",
"file_path": "/openharmony/compiler/python/3.9.2/linux/python-linux-x86-3.9.2_20200510.tar.gz",
"unzip_filename": "linux-x86"
}
]
}
},
"darwin": {
"node_config": [
{
"unzip_dir": "prebuilts/build-tools/common/nodejs",
"file_path": "/nodejs/v12.18.4/node-v12.18.4-darwin-x64.tar.gz",
"unzip_filename": "node-v12.18.4-darwin-x64"
}
],
"arm64": {
"copy_config": [
{
"unzip_dir": "prebuilts/sdk/js-loader/build-tools",
"file_path": "/openharmony/compiler/ace-loader/1.0/ace-loader-1.0.tar.gz",
"unzip_filename": "ace-loader"
},
{
"unzip_dir": "prebuilts/build-tools/common",
"file_path": "/openharmony/compiler/restool/2.007/restool-2.007.tar.gz",
"unzip_filename": "restool"
},
{
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/darwin/cmake-darwin-x86-3.16.5.tar.gz",
"unzip_filename": "darwin"
},
{
"unzip_dir": "prebuilts/build-tools/darwin-x86/bin",
"file_path": "/openharmony/compiler/gn/1717/darwin/gn-darwin-x86-1717.tar.gz",
"unzip_filename": "gn"
},
{
"unzip_dir": "prebuilts/build-tools/darwin-x86/bin",
"file_path": "/openharmony/compiler/ninja/1.10.1/darwin/ninja-darwin-x86-1.10.1.tar.gz",
"unzip_filename": "ninja"
},
{
"unzip_dir": "prebuilts/ark_tools",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220923.tar.gz",
"unzip_filename": "ark_js_prebuilts"
}
],
"darwin_copy_config": [
{
"unzip_dir": "prebuilts/previewer/darwin",
"file_path": "/openharmony/develop_tools/previewer/3.2.8.1/previewer-3.2.8.1-master-20221008.mac-arm64.tar.gz",
"unzip_filename": "previewer"
},
{
"unzip_dir": "prebuilts/clang/ohos/darwin-arm64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/darwin/clang_darwin-arm64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/darwin-arm64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/darwin/libcxx-ndk_darwin-arm64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/python",
"file_path": "/openharmony/compiler/python/3.9.2/darwin/python-darwin-x86-3.9.2_202205071615.tar.gz",
"unzip_filename": "darwin-x86"
}
]
},
"x86_64": {
"copy_config": [
{
"unzip_dir": "prebuilts/sdk/js-loader/build-tools",
"file_path": "/openharmony/compiler/ace-loader/1.0/ace-loader-1.0.tar.gz",
"unzip_filename": "ace-loader"
},
{
"unzip_dir": "prebuilts/build-tools/common",
"file_path": "/openharmony/compiler/restool/2.007/restool-2.007.tar.gz",
"unzip_filename": "restool"
},
{
"unzip_dir": "prebuilts/cmake",
"file_path": "/openharmony/compiler/cmake/3.16.5/darwin/cmake-darwin-x86-3.16.5.tar.gz",
"unzip_filename": "darwin"
},
{
"unzip_dir": "prebuilts/build-tools/darwin-x86/bin",
"file_path": "/openharmony/compiler/gn/1717/darwin/gn-darwin-x86-1717.tar.gz",
"unzip_filename": "gn"
},
{
"unzip_dir": "prebuilts/build-tools/darwin-x86/bin",
"file_path": "/openharmony/compiler/ninja/1.10.1/darwin/ninja-darwin-x86-1.10.1.tar.gz",
"unzip_filename": "ninja"
},
{
"unzip_dir": "prebuilts/ark_tools",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220923.tar.gz",
"unzip_filename": "ark_js_prebuilts"
}
],
"darwin_copy_config": [
{
"unzip_dir": "prebuilts/previewer/darwin",
"file_path": "/openharmony/develop_tools/previewer/3.2.8.1/previewer-3.2.8.1-master-20221008.mac.tar.gz",
"unzip_filename": "previewer"
},
{
"unzip_dir": "prebuilts/clang/ohos/darwin-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/darwin/clang_darwin-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "llvm"
},
{
"unzip_dir": "prebuilts/clang/ohos/darwin-x86_64",
"file_path": "/openharmony/compiler/clang/12.0.1-942740/darwin/libcxx-ndk_darwin-x86_64-942740-20220927.tar.bz2",
"unzip_filename": "libcxx-ndk"
},
{
"unzip_dir": "prebuilts/python",
"file_path": "/openharmony/compiler/python/3.9.2/darwin/python-darwin-x86-3.9.2_202205071615.tar.gz",
"unzip_filename": "darwin-x86"
}
]
}
}
}

View File

@ -1,32 +0,0 @@
# 获取源码及安装依赖工具
## 推荐操作系统Ubuntu18及以上
## 安装repo工具
安装码云repo工具由于权限可切换到root用户下安装安装后再切换个人用户目录操作
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
```
## 下载源码
```
repo init -u https://gitee.com/lordwithcc/manifest.git -b Ark_Standalone_Build
repo sync -c
repo forall -c 'git lfs pull'
```
## 编译环境准备
安装依赖工具
```
sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev genext2fs liblz4-tool libssl-dev libtinfo5 lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby default-jdk u-boot-tools mtools mtd-utils scons gcc-arm-none-eabi gcc-arm-linux-gnueabi
```
安装编译器及二进制工具
```
cd arkcompiler
./toolchain/build/compile_script/gen.sh ark
./toolchain/build/prebuilts_download/prebuilts_download.sh
```

View File

@ -62,7 +62,8 @@ template("ohos_executable") {
}
if (defined(invoker.use_exceptions) && invoker.use_exceptions) {
configs += [ "//toolchain/build/config/compiler:exceptions" ]
configs += [ "//arkcompiler/toolchain/build/config/compiler:exceptions" ]
ldflags = []
}
}
}
@ -87,7 +88,8 @@ template("ohos_static_library") {
}
if (defined(invoker.use_exceptions) && invoker.use_exceptions) {
configs += [ "//toolchain/build/config/compiler:exceptions" ]
configs += [ "//arkcompiler/toolchain/build/config/compiler:exceptions" ]
ldflags = []
}
}
}

View File

@ -1,9 +1,9 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2021 Huawei Device Co., Ltd.
# 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
# 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,
@ -19,7 +19,10 @@ config("icu_config") {
"//third_party/icu/icu4c/source/i18n",
"//third_party/icu/icu4c/source",
]
cflags_cc = [ "-fPIC" ]
}
config("static_icustubdata_all_deps_config") {
include_dirs = [ "//third_party/icu/icu4c/source/common" ]
}
ohos_static_library("static_icustubdata") {
@ -43,6 +46,13 @@ ohos_static_library("static_icustubdata") {
output_name = "stubdata"
}
# ohos_prebuilt_etc("ohos_icudat") {
# source = "//third_party/icu/ohos_icu4j/data/icudt69l.dat"
# module_install_dir = "usr/ohos_icu/"
# part_name = "icu"
# subsystem_name = "thirdparty"
# }
icu_common_source = [
"//third_party/icu/icu4c/source/common/ubiditransform.cpp",
"//third_party/icu/icu4c/source/common/locutil.cpp",
@ -370,8 +380,15 @@ icu_i18n_source = [
"//third_party/icu/icu4c/source/i18n/reldtfmt.cpp",
"//third_party/icu/icu4c/source/i18n/nultrans.cpp",
"//third_party/icu/icu4c/source/i18n/number_grouping.cpp",
"//third_party/icu/icu4c/source/i18n/number_symbolswrapper.cpp",
"//third_party/icu/icu4c/source/i18n/number_usageprefs.cpp",
"//third_party/icu/icu4c/source/i18n/numrange_capi.cpp",
"//third_party/icu/icu4c/source/i18n/pluralranges.cpp",
"//third_party/icu/icu4c/source/i18n/units_complexconverter.cpp",
"//third_party/icu/icu4c/source/i18n/units_converter.cpp",
"//third_party/icu/icu4c/source/i18n/units_data.cpp",
"//third_party/icu/icu4c/source/i18n/units_router.cpp",
"//third_party/icu/icu4c/source/i18n/rbt_pars.cpp",
"//third_party/icu/icu4c/source/i18n/nounit.cpp",
"//third_party/icu/icu4c/source/i18n/winnmfmt.cpp",
"//third_party/icu/icu4c/source/i18n/uregexc.cpp",
"//third_party/icu/icu4c/source/i18n/fpositer.cpp",
@ -484,6 +501,7 @@ ohos_shared_library("shared_icuuc") {
":icu_config",
"$build_root/config/compiler:rtti",
]
all_dependent_configs = [ ":static_icustubdata_all_deps_config" ]
deps = [ ":static_icustubdata" ]
defines = [
"U_ATTRIBUTE_DEPRECATED=",
@ -511,7 +529,18 @@ ohos_shared_library("shared_icuuc") {
"-shared",
"-lm",
]
if (is_standard_system) {
part_name = "icu"
subsystem_name = "thirdparty"
} else {
part_name = "i18n"
subsystem_name = "global"
}
install_images = [ system_base_dir ]
relative_install_dir = "platformsdk"
output_name = "hmicuuc"
install_enable = true
cflags_cc += ["-fPIC"]
}
ohos_shared_library("shared_icui18n") {
@ -551,7 +580,17 @@ ohos_shared_library("shared_icui18n") {
cflags_cc += [ "-fPIC" ]
ldflags += [ "-ldl" ]
}
if (is_standard_system) {
part_name = "icu"
subsystem_name = "thirdparty"
} else {
part_name = "i18n"
subsystem_name = "global"
}
install_images = [ system_base_dir ]
relative_install_dir = "platformsdk"
output_name = "hmicui18n"
install_enable = true
}
ohos_static_library("static_icuuc") {

View File

@ -11,13 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (defined(ark_standalone_build)) {
import("//profiler//build/config.gni")
import("$build_root/ark.gni")
} else {
import("//build/ohos.gni")
import("//developtools/profiler/build/config.gni")
}
import("//profiler//build/config.gni")
import("$build_root/ark.gni")
protobuf_src_root = "//third_party/protobuf/src/"

View File

@ -0,0 +1,96 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper functions for gcc_toolchain.gni wrappers."""
import gzip
import os
import subprocess
import shutil
import threading
_BAT_PREFIX = 'cmd /c call '
def _gzip_then_delete(src_path, dest_path):
""" Results for ohos map file with GCC on a z620:
Uncompressed: 207MB
gzip -9: 16.4MB, takes 8.7 seconds.
gzip -1: 21.8MB, takes 2.0 seconds.
Piping directly from the linker via -print-map (or via -Map with a fifo)
adds a whopping 30-45 seconds!
"""
with open(src_path, 'rb') as f_in, gzip.GzipFile(dest_path,
'wb',
1) as f_out:
shutil.copyfileobj(f_in, f_out)
os.unlink(src_path)
def command_to_run(command):
"""Generates commands compatible with Windows.
When running on a Windows host and using a toolchain whose tools are
actually wrapper scripts (i.e. .bat files on Windows) rather than binary
executables, the |command| to run has to be prefixed with this magic.
The GN toolchain definitions take care of that for when GN/Ninja is
running the tool directly. When that command is passed in to this
script, it appears as a unitary string but needs to be split up so that
just 'cmd' is the actual command given to Python's subprocess module.
Args:
command: List containing the UNIX style |command|.
Returns:
A list containing the Windows version of the |command|.
"""
if command[0].startswith(_BAT_PREFIX):
command = command[0].split(None, 3) + command[1:]
return command
def run_link_with_optional_map_file(command, env=None, map_file=None):
"""Runs the given command, adding in -Wl,-Map when |map_file| is given.
Also takes care of gzipping when |map_file| ends with .gz.
Args:
command: List of arguments comprising the command.
env: Environment variables.
map_file: Path to output map_file.
Returns:
The exit code of running |command|.
"""
tmp_map_path = None
if map_file and map_file.endswith('.gz'):
tmp_map_path = map_file + '.tmp'
command.append('-Wl,-Map,' + tmp_map_path)
elif map_file:
command.append('-Wl,-Map,' + map_file)
result = subprocess.call(command, env=env)
if tmp_map_path and result == 0:
threading.Thread(
target=lambda: _gzip_then_delete(tmp_map_path, map_file)).start()
elif tmp_map_path and os.path.exists(tmp_map_path):
os.unlink(tmp_map_path)
return result
def capture_command_stderr(command, env=None):
"""Returns the stderr of a command.
Args:
command: A list containing the command and arguments.
env: Environment variables for the new process.
"""
child = subprocess.Popen(command, stderr=subprocess.PIPE, env=env)
_, stderr = child.communicate()
return child.returncode, stderr

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB