From 9862ceaf5205267aa47493aa4798dfa3d2ebffce Mon Sep 17 00:00:00 2001 From: Caoruihong Date: Fri, 30 Jul 2021 18:18:54 +0800 Subject: [PATCH] feat: strip libc and libc++ libc and libc++ should be stripped before packing into rootfs Signed-off-by: Caoruihong Change-Id: I303c03debdaa29bbefeb39e62a0ffd44764304a8 --- build/BUILD.gn | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/build/BUILD.gn b/build/BUILD.gn index f9c4e03..b107395 100644 --- a/build/BUILD.gn +++ b/build/BUILD.gn @@ -68,8 +68,29 @@ build_ext_component("build_sysroot") { # copy standard libraries libc.so and libc++.so to lib out dir libcpp = "\$($ohos_current_cxx_command --target=$target_triple --sysroot=$sysroot_path $arch_cflags -print-file-name=libc++.so)" libc = "\$($ohos_current_cc_command --target=$target_triple --sysroot=$sysroot_path $arch_cflags -print-file-name=libc.so)" - lib_out_dir = rebase_path("$root_out_dir/libs/") + lib_out_dir = rebase_path("$root_out_dir/unstripped/usr/lib", exec_path) command += " && mkdir -p $lib_out_dir && sh -c \"cp -f $libcpp $libc $lib_out_dir\"" + + outputs = [ + "$root_out_dir/unstripped/usr/lib/libc.so", + "$root_out_dir/unstripped/usr/lib/libc++.so", + ] +} + +action_foreach("strip") { + deps = [ ":build_sysroot" ] + script = "//build/lite/run_shell_cmd.py" + sources = [ + "$root_out_dir/unstripped/usr/lib/libc.so", + "$root_out_dir/unstripped/usr/lib/libc++.so", + ] + outputs = [ "$root_out_dir/{{source_file_part}}" ] + args = [ + "$ohos_current_strip_command", + "{{source}}", + "-o", + rebase_path("$root_out_dir/{{source_file_part}}", root_build_dir), + ] } config("sysroot_flags") { -- GitLab