1# Copyright (c) 2021-2023 北京万里红科技有限公司 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("//build/ohos.gni") 16import("selinux.gni") 17 18startup_init_with_param_base = false 19if (!use_musl) { 20 startup_init_with_param_base = true 21} 22 23if (!ohos_indep_compiler_enable) { 24 tool_path = 25 rebase_path(root_build_dir + "/clang_${host_cpu}/thirdparty/selinux/") 26} else { 27 tool_path = rebase_path(get_label_info(":libselinux_so", "target_out_dir")) 28} 29 30special_build_selinux_gni_exist = 31 selinux_adapter_special_build_selinux_gni_path != "" && 32 exec_script("/bin/sh", 33 [ 34 "-c", 35 "if [ -f " + rebase_path( 36 selinux_adapter_special_build_selinux_gni_path) + 37 " ]; then echo true; else echo false; fi", 38 ], 39 "value") 40if (special_build_selinux_gni_exist) { 41 import(selinux_adapter_special_build_selinux_gni_path) 42} 43 44config("selinux_core_config") { 45 include_dirs = [ "interfaces/policycoreutils/include" ] 46} 47 48ohos_shared_library("libload_policy") { 49 output_name = "libload_policy" 50 sources = [ "framework/policycoreutils/src/load_policy.cpp" ] 51 include_dirs = [ "interfaces/policycoreutils/include" ] 52 deps = [ ":libselinux_klog_static" ] 53 external_deps = [ "selinux:libselinux" ] 54 cflags = [ 55 "-D_GNU_SOURCE", 56 "-Wall", 57 "-Werror", 58 ] 59 if (is_emulator) { 60 cflags += [ "-DEMULATOR_MODE" ] 61 } 62 if (selinux_adapter_support_developer_mode) { 63 cflags += [ "-DWITH_DEVELOPER" ] 64 } 65 install_enable = true 66 install_images = [ 67 "system", 68 "ramdisk", 69 "updater", 70 ] 71 license_file = "LICENSE" 72 part_name = "selinux_adapter" 73 subsystem_name = "security" 74} 75 76ohos_shared_library("librestorecon") { 77 branch_protector_ret = "pac_ret" 78 79 output_name = "librestorecon" 80 sources = [ "framework/policycoreutils/src/selinux_restorecon.c" ] 81 public_configs = [ ":selinux_core_config" ] 82 deps = [ ":libselinux_klog_static" ] 83 external_deps = [ "hilog:libhilog" ] 84 85 public_external_deps = [ "selinux:libselinux" ] 86 87 cflags = [ 88 "-D_GNU_SOURCE", 89 "-Wall", 90 "-Werror", 91 ] 92 install_enable = true 93 install_images = [ 94 "system", 95 "ramdisk", 96 "updater", 97 ] 98 innerapi_tags = [ "platformsdk_indirect" ] 99 license_file = "LICENSE" 100 part_name = "selinux_adapter" 101 subsystem_name = "security" 102} 103 104ohos_static_library("libselinux_klog_real_static") { 105 output_name = "libselinux_klog_real_static" 106 sources = [ "framework/policycoreutils/src/selinux_klog.c" ] 107 include_dirs = [ "interfaces/policycoreutils/include" ] 108 external_deps = [ "bounds_checking_function:libsec_static" ] 109 cflags = [ 110 "-D_GNU_SOURCE", 111 "-Wall", 112 "-Werror", 113 ] 114 part_name = "selinux_adapter" 115 subsystem_name = "security" 116} 117 118ohos_static_library("librestorecon_static") { 119 output_name = "librestorecon_static" 120 sources = [ "framework/policycoreutils/src/selinux_restorecon.c" ] 121 public_configs = [ ":selinux_core_config" ] 122 deps = [ ":libselinux_klog_real_static" ] 123 124 public_external_deps = [ "selinux:libselinux_static" ] 125 126 cflags = [ 127 "-D_GNU_SOURCE", 128 "-Wall", 129 "-Werror", 130 ] 131 license_file = "LICENSE" 132 part_name = "selinux_adapter" 133 subsystem_name = "security" 134} 135 136ohos_shared_library("libhap_restorecon") { 137 output_name = "libhap_restorecon" 138 sources = [ 139 "framework/policycoreutils/src/hap_restorecon.cpp", 140 "framework/policycoreutils/src/sehap_contexts_trie.cpp", 141 ] 142 public_configs = [ ":selinux_core_config" ] 143 deps = [ 144 ":libselinux_error_static", 145 ":libselinux_hilog_static", 146 ] 147 external_deps = [ "hilog:libhilog" ] 148 149 public_external_deps = [ "selinux:libselinux" ] 150 151 cflags = [ 152 "-D_GNU_SOURCE", 153 "-Wall", 154 "-Werror", 155 ] 156 if (selinux_adapter_mcs_enable) { 157 cflags += [ "-DMCS_ENABLE" ] 158 } 159 install_enable = true 160 license_file = "LICENSE" 161 part_name = "selinux_adapter" 162 subsystem_name = "security" 163} 164 165ohos_static_library("libselinux_error_static") { 166 output_name = "libselinux_error_static" 167 sources = [ "framework/policycoreutils/src/selinux_error.cpp" ] 168 include_dirs = [ "interfaces/policycoreutils/include" ] 169 cflags = [ 170 "-D_GNU_SOURCE", 171 "-w", 172 ] 173 part_name = "selinux_adapter" 174 subsystem_name = "security" 175} 176 177ohos_static_library("libselinux_klog_static") { 178 output_name = "libselinux_klog_static" 179 sources = [ "framework/policycoreutils/src/selinux_klog.c" ] 180 include_dirs = [ "interfaces/policycoreutils/include" ] 181 external_deps = [ "bounds_checking_function:libsec_shared" ] 182 cflags = [ 183 "-D_GNU_SOURCE", 184 "-Wall", 185 "-Werror", 186 ] 187 part_name = "selinux_adapter" 188 subsystem_name = "security" 189} 190 191ohos_static_library("libselinux_hilog_static") { 192 branch_protector_ret = "pac_ret" 193 194 output_name = "libselinux_hilog_static" 195 sources = [ "framework/policycoreutils/src/selinux_log.c" ] 196 include_dirs = [ "interfaces/policycoreutils/include" ] 197 external_deps = [ 198 "bounds_checking_function:libsec_shared", 199 "hilog:libhilog", 200 ] 201 cflags = [ 202 "-D_GNU_SOURCE", 203 "-Wall", 204 "-Werror", 205 ] 206 part_name = "selinux_adapter" 207 subsystem_name = "security" 208} 209 210if (!startup_init_with_param_base) { 211 inherited_configs = [ 212 "$BUILD_CONFIG_DIR/compiler:afdo", 213 "$BUILD_CONFIG_DIR/compiler:afdo_optimize_size", 214 "$BUILD_CONFIG_DIR/compiler:compiler", 215 "$BUILD_CONFIG_DIR/compiler:compiler_arm_fpu", 216 "$BUILD_CONFIG_DIR/compiler:compiler_arm_thumb", 217 "$BUILD_CONFIG_DIR/compiler:chromium_code", 218 "$BUILD_CONFIG_DIR/compiler:default_include_dirs", 219 "$BUILD_CONFIG_DIR/compiler:default_optimization", 220 "$BUILD_CONFIG_DIR/compiler:default_stack_frames", 221 "$BUILD_CONFIG_DIR/compiler:default_symbols", 222 "$BUILD_CONFIG_DIR/compiler:export_dynamic", 223 "$BUILD_CONFIG_DIR/compiler:no_exceptions", 224 "$BUILD_CONFIG_DIR/compiler:no_rtti", 225 "$BUILD_CONFIG_DIR/compiler:runtime_library", 226 "$BUILD_CONFIG_DIR/compiler:thin_archive", 227 "$BUILD_CONFIG_DIR/sanitizers:default_sanitizer_flags", 228 ] 229} 230 231template("selinux_parameter_template") { 232 __use_flto = invoker.selinux_parameter_use_flto 233 library_name = target_name 234 static_library("${library_name}") { 235 output_name = "${library_name}" 236 sources = [ 237 "framework/policycoreutils/src/contexts_trie.c", 238 "framework/policycoreutils/src/selinux_map.c", 239 "framework/policycoreutils/src/selinux_parameter.c", 240 "framework/policycoreutils/src/selinux_share_mem.c", 241 ] 242 public_configs = [ ":selinux_core_config" ] 243 include_dirs = [ "interfaces/policycoreutils/include" ] 244 cflags = [ 245 "-D_GNU_SOURCE", 246 "-Wall", 247 "-Werror", 248 ] 249 if (!__use_flto) { 250 cflags_c = [ "-fno-lto" ] 251 } 252 if (!startup_init_with_param_base) { 253 ldflags = [ "-nostdlib" ] 254 configs -= inherited_configs 255 configs += [ "$BUILD_CONFIG_DIR/compiler:compiler" ] 256 } 257 } 258} 259 260selinux_parameter_template("libselinux_parameter_static") { 261 selinux_parameter_use_flto = true 262} 263 264selinux_parameter_template("libselinux_parameter_static_noflto") { 265 selinux_parameter_use_flto = false 266} 267 268ohos_shared_library("libparaperm_checker") { 269 output_name = "libparaperm_checker" 270 sources = [ "framework/policycoreutils/src/param_checker.c" ] 271 public_configs = [ ":selinux_core_config" ] 272 deps = [ ":libselinux_klog_static" ] 273 deps += [ ":libselinux_parameter_static" ] 274 external_deps = [ "bounds_checking_function:libsec_shared" ] 275 public_external_deps = [ "selinux:libselinux" ] 276 277 cflags = [ 278 "-D_GNU_SOURCE", 279 "-Wall", 280 "-Werror", 281 ] 282 install_images = [ 283 "system", 284 "updater", 285 ] 286 part_name = "selinux_adapter" 287 subsystem_name = "security" 288} 289 290ohos_shared_library("libservice_checker") { 291 output_name = "libservice_checker" 292 sources = [ "framework/policycoreutils/src/service_checker.cpp" ] 293 public_configs = [ ":selinux_core_config" ] 294 deps = [ 295 ":libselinux_error_static", 296 ":libselinux_hilog_static", 297 ] 298 external_deps = [ 299 "bounds_checking_function:libsec_shared", 300 "hilog:libhilog", 301 ] 302 public_external_deps = [ "selinux:libselinux" ] 303 cflags = [ 304 "-D_GNU_SOURCE", 305 "-Wall", 306 "-Werror", 307 ] 308 innerapi_tags = [ "chipsetsdk" ] 309 part_name = "selinux_adapter" 310 subsystem_name = "security" 311} 312 313ohos_executable("load_policy") { 314 install_enable = false 315 sources = [ "framework/tools/load_policy/load_policy.c" ] 316 include_dirs = [ "interfaces/policycoreutils/include" ] 317 deps = [ ":libload_policy" ] 318 cflags = [ 319 "-D_GNU_SOURCE", 320 "-Wall", 321 "-Werror", 322 ] 323 license_file = "LICENSE" 324 part_name = "selinux_adapter" 325 subsystem_name = "security" 326 install_images = [ 327 "system", 328 "updater", 329 ] 330} 331 332ohos_executable("restorecon") { 333 install_enable = true 334 sources = [ "framework/tools/restorecon/restorecon.c" ] 335 include_dirs = [ "interfaces/policycoreutils/include" ] 336 deps = [ ":librestorecon" ] 337 external_deps = [ 338 "bounds_checking_function:libsec_shared", 339 "selinux:libselinux", 340 ] 341 cflags = [ 342 "-D_GNU_SOURCE", 343 "-Wall", 344 "-Werror", 345 ] 346 license_file = "LICENSE" 347 part_name = "selinux_adapter" 348 subsystem_name = "security" 349 install_images = [ 350 "system", 351 "updater", 352 ] 353} 354 355ohos_executable("hap_restorecon") { 356 install_enable = false 357 sources = [ "framework/tools/hap_restorecon/test.cpp" ] 358 include_dirs = [ "interfaces/policycoreutils/include" ] 359 deps = [ 360 ":libhap_restorecon", 361 ":libselinux_error_static", 362 ] 363 cflags = [ 364 "-D_GNU_SOURCE", 365 "-Wall", 366 "-Werror", 367 ] 368 external_deps = [ "selinux:libselinux" ] 369 license_file = "LICENSE" 370 part_name = "selinux_adapter" 371 subsystem_name = "security" 372} 373 374ohos_executable("param_check") { 375 install_enable = false 376 sources = [ "framework/tools/param_check/test.cpp" ] 377 include_dirs = [ "interfaces/policycoreutils/include" ] 378 deps = [ 379 ":libparaperm_checker", 380 ":libselinux_error_static", 381 ":libselinux_parameter_static", 382 ] 383 external_deps = [ 384 "pcre2:libpcre2", 385 "selinux:libselinux", 386 ] 387 if (startup_init_with_param_base) { 388 deps += [ ":libselinux_parameter_static" ] 389 } 390 cflags = [ 391 "-D_GNU_SOURCE", 392 "-DTIME_DISPLAY", 393 "-Wall", 394 "-Werror", 395 ] 396 license_file = "LICENSE" 397 part_name = "selinux_adapter" 398 subsystem_name = "security" 399} 400 401ohos_executable("service_check") { 402 install_enable = false 403 sources = [ "framework/tools/service_check/test.cpp" ] 404 include_dirs = [ "interfaces/policycoreutils/include" ] 405 deps = [ 406 ":libselinux_error_static", 407 ":libservice_checker", 408 ] 409 cflags = [ 410 "-D_GNU_SOURCE", 411 "-Wall", 412 "-Werror", 413 ] 414 license_file = "LICENSE" 415 part_name = "selinux_adapter" 416 subsystem_name = "security" 417} 418 419debug_version = "disable" 420updater_version = "disable" 421 422action("build_policy") { 423 if (build_variant == "user") { 424 debug_version = "disable" 425 } else if (build_variant == "root") { 426 debug_version = "enable" 427 } else { 428 debug_version = "enable" 429 } 430 431 updater_version = "disable" 432 sepolicy_dir_lists = rebase_path("sepolicy", root_build_dir) 433 if (selinux_adapter_build_path != "default") { 434 foreach(src, string_split(selinux_adapter_build_path, ":")) { 435 src = "//" + src 436 sepolicy_dir_lists += ":" + rebase_path(src, root_build_dir) 437 } 438 if (special_build_selinux_gni_exist && 439 selinux_build_path_ext != "default") { 440 selinux_adapter_build_path = 441 selinux_adapter_build_path + ":" + selinux_build_path_ext 442 } 443 } else { 444 selinux_adapter_build_path = 445 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 446 } 447 448 if (selinux_adapter_special_build_policy_script != "default") { 449 script = selinux_adapter_special_build_policy_script 450 } else { 451 script = "scripts/build_policy.py" 452 } 453 depfile = "$target_gen_dir/$target_name.d" 454 args = [ 455 "--depfile", 456 rebase_path(depfile, root_build_dir), 457 "--output-file", 458 rebase_path("$target_out_dir/$target_name.txt", root_build_dir), 459 "--sepolicy-dir-lists", 460 sepolicy_dir_lists, 461 "--dst-file", 462 rebase_path(target_out_dir + "/policy.31"), 463 "--tool-path", 464 tool_path, 465 "--source-root-dir", 466 rebase_path("//"), 467 "--policy_dir_list", 468 selinux_adapter_build_path, 469 "--debug-version", 470 debug_version, 471 "--updater-version", 472 updater_version, 473 "--components", 474 selinux_adapter_components, 475 ] 476 477 if (selinux_adapter_components != "default") { 478 args += [ 479 "--vendor-policy-version", 480 "$selinux_adapter_vendor_policy_version", 481 ] 482 } 483 484 if (selinux_adapter_extra_args != "default") { 485 foreach(arg, string_split(selinux_adapter_extra_args, " ")) { 486 args += [ arg ] 487 } 488 } 489 490 external_deps = [ 491 "selinux:checkpolicy($host_toolchain)", 492 "selinux:secilc($host_toolchain)", 493 ] 494 outputs = [ 495 target_out_dir + "/policy.31", 496 target_out_dir + "/user_policy", 497 target_out_dir + "/vendor.cil", 498 target_out_dir + "/prebuild_sepolicy.system.cil.sha256", 499 target_out_dir + "/system.cil", 500 target_out_dir + "/system.cil.sha256", 501 target_out_dir + "/compatible/$selinux_adapter_vendor_policy_version.cil", 502 target_out_dir + "/compatible", 503 target_out_dir + "/version", 504 target_out_dir + "/public.cil", 505 ] 506 507 outputs += [ 508 target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256", 509 target_out_dir + "/developer/system.cil.sha256", 510 target_out_dir + 511 "/developer/compatible/$selinux_adapter_vendor_policy_version.cil", 512 target_out_dir + "/developer/compatible", 513 target_out_dir + "/developer/developer_policy", 514 target_out_dir + "/developer/policy.31", 515 target_out_dir + "/developer/vendor.cil", 516 target_out_dir + "/developer/system.cil", 517 target_out_dir + "/developer/public.cil", 518 ] 519 520 if (selinux_adapter_components != "default") { 521 outputs += [ 522 target_out_dir + "/system_common.cil", 523 target_out_dir + "/vendor_common.cil", 524 target_out_dir + "/public_common.cil", 525 ] 526 } 527} 528 529action("build_update_policy") { 530 if (build_variant == "user") { 531 debug_version = "disable" 532 } else if (build_variant == "root") { 533 debug_version = "enable" 534 } else { 535 debug_version = "enable" 536 } 537 538 updater_version = "enable" 539 selinux_adapter_components = "default" 540 sepolicy_dir_lists = rebase_path("sepolicy", root_build_dir) 541 if (selinux_adapter_build_path != "default") { 542 foreach(src, string_split(selinux_adapter_build_path, ":")) { 543 src = "//" + src 544 sepolicy_dir_lists += ":" + rebase_path(src, root_build_dir) 545 } 546 if (special_build_selinux_gni_exist && 547 selinux_build_path_ext_updater != "default") { 548 selinux_adapter_build_path = 549 selinux_adapter_build_path + ":" + selinux_build_path_ext_updater 550 } 551 } else { 552 selinux_adapter_build_path = 553 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 554 } 555 556 if (selinux_adapter_special_build_policy_script != "default") { 557 script = selinux_adapter_special_build_policy_script 558 } else { 559 script = "scripts/build_policy.py" 560 } 561 depfile = "$target_gen_dir/$target_name.d" 562 args = [ 563 "--depfile", 564 rebase_path(depfile, root_build_dir), 565 "--output-file", 566 rebase_path("$target_out_dir/$target_name.txt", root_build_dir), 567 "--sepolicy-dir-lists", 568 sepolicy_dir_lists, 569 "--dst-file", 570 rebase_path(target_out_dir + "/updater/policy.31"), 571 "--tool-path", 572 tool_path, 573 "--source-root-dir", 574 rebase_path("//"), 575 "--policy_dir_list", 576 selinux_adapter_build_path, 577 "--debug-version", 578 debug_version, 579 "--updater-version", 580 updater_version, 581 "--components", 582 selinux_adapter_components, 583 ] 584 585 if (selinux_adapter_extra_args != "default") { 586 foreach(arg, string_split(selinux_adapter_extra_args, " ")) { 587 args += [ arg ] 588 } 589 } 590 591 external_deps = [ 592 "selinux:checkpolicy($host_toolchain)", 593 "selinux:secilc($host_toolchain)", 594 ] 595 outputs = [ target_out_dir + "/updater/policy.31" ] 596} 597 598action("build_contexts") { 599 sepolicy_dir_lists = rebase_path("sepolicy", root_build_dir) 600 if (selinux_adapter_build_path != "default") { 601 foreach(src, string_split(selinux_adapter_build_path, ":")) { 602 src = "//" + src 603 sepolicy_dir_lists += ":" + rebase_path(src, root_build_dir) 604 } 605 if (special_build_selinux_gni_exist && 606 selinux_build_path_ext != "default") { 607 selinux_adapter_build_path = 608 selinux_adapter_build_path + ":" + selinux_build_path_ext 609 } 610 } else { 611 selinux_adapter_build_path = 612 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 613 } 614 615 if (selinux_adapter_special_build_contexts_script != "default") { 616 script = selinux_adapter_special_build_contexts_script 617 } else { 618 script = "scripts/build_contexts.py" 619 } 620 depfile = "$target_gen_dir/$target_name.d" 621 args = [ 622 "--depfile", 623 rebase_path(depfile, root_build_dir), 624 "--output-file", 625 rebase_path("$target_out_dir/$target_name.txt", root_build_dir), 626 "--sepolicy-dir-lists", 627 sepolicy_dir_lists, 628 "--dst-dir", 629 rebase_path(target_out_dir + "/"), 630 "--tool-path", 631 tool_path, 632 "--policy-file", 633 rebase_path(target_out_dir + "/policy.31"), 634 "--source-root-dir", 635 rebase_path("//"), 636 "--policy_dir_list", 637 selinux_adapter_build_path, 638 "--components", 639 selinux_adapter_components, 640 ] 641 if (selinux_adapter_contexts_extra_args != "default") { 642 foreach(arg, string_split(selinux_adapter_contexts_extra_args, " ")) { 643 args += [ arg ] 644 } 645 } 646 deps = [ ":build_policy" ] 647 external_deps = [ "selinux:sefcontext_compile($host_toolchain)" ] 648 outputs = [ 649 target_out_dir + "/file_contexts.bin", 650 target_out_dir + "/file_contexts", 651 target_out_dir + "/sehap_contexts", 652 target_out_dir + "/service_contexts", 653 target_out_dir + "/hdf_service_contexts", 654 target_out_dir + "/parameter_contexts", 655 ] 656} 657 658action("build_ignore_cfg") { 659 sepolicy_dir_lists = rebase_path("sepolicy", root_build_dir) 660 if (selinux_adapter_build_path != "default") { 661 foreach(src, string_split(selinux_adapter_build_path, ":")) { 662 src = "//" + src 663 sepolicy_dir_lists += ":" + rebase_path(src, root_build_dir) 664 } 665 if (special_build_selinux_gni_exist && 666 selinux_build_path_ext != "default") { 667 selinux_adapter_build_path = 668 selinux_adapter_build_path + ":" + selinux_build_path_ext 669 } 670 } else { 671 selinux_adapter_build_path = 672 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 673 } 674 675 if (special_build_ignore_cfg != "default") { 676 script = special_build_ignore_cfg 677 } else { 678 script = "scripts/build_ignore_cfg.py" 679 } 680 depfile = "$target_gen_dir/$target_name.d" 681 args = [ 682 "--depfile", 683 rebase_path(depfile, root_build_dir), 684 "--output-file", 685 rebase_path("$target_out_dir/$target_name.txt", root_build_dir), 686 "--sepolicy-dir-lists", 687 sepolicy_dir_lists, 688 "--dst-dir", 689 rebase_path(target_out_dir + "/"), 690 "--source-root-dir", 691 rebase_path("//"), 692 "--policy-dir-list", 693 selinux_adapter_build_path, 694 "--components", 695 selinux_adapter_components, 696 ] 697 outputs = [ 698 target_out_dir + "/ignore_cfg", 699 target_out_dir + "/app_allow_cfg" 700 ] 701} 702 703action("build_updater_contexts") { 704 sepolicy_dir_lists = rebase_path("sepolicy", root_build_dir) 705 if (selinux_adapter_build_path != "default") { 706 foreach(src, string_split(selinux_adapter_build_path, ":")) { 707 src = "//" + src 708 sepolicy_dir_lists += ":" + rebase_path(src, root_build_dir) 709 } 710 if (special_build_selinux_gni_exist && 711 selinux_build_path_ext_updater != "default") { 712 selinux_adapter_build_path = 713 selinux_adapter_build_path + ":" + selinux_build_path_ext_updater 714 } 715 } else { 716 selinux_adapter_build_path = 717 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 718 } 719 720 if (selinux_adapter_special_build_contexts_script != "default") { 721 script = selinux_adapter_special_build_contexts_script 722 } else { 723 script = "scripts/build_contexts.py" 724 } 725 depfile = "$target_gen_dir/$target_name.d" 726 args = [ 727 "--depfile", 728 rebase_path(depfile, root_build_dir), 729 "--output-file", 730 rebase_path("$target_out_dir/$target_name.txt", root_build_dir), 731 "--sepolicy-dir-lists", 732 sepolicy_dir_lists, 733 "--dst-dir", 734 rebase_path(target_out_dir + "/updater"), 735 "--tool-path", 736 tool_path, 737 "--policy-file", 738 rebase_path(target_out_dir + "/updater/policy.31"), 739 "--source-root-dir", 740 rebase_path("//"), 741 "--policy_dir_list", 742 selinux_adapter_build_path, 743 "--components", 744 selinux_adapter_components, 745 ] 746 if (selinux_adapter_contexts_extra_args != "default") { 747 foreach(arg, string_split(selinux_adapter_contexts_extra_args, " ")) { 748 args += [ arg ] 749 } 750 } 751 deps = [ ":build_update_policy" ] 752 external_deps = [ "selinux:sefcontext_compile($host_toolchain)" ] 753 outputs = [ 754 target_out_dir + "/updater/file_contexts.bin", 755 target_out_dir + "/updater/file_contexts", 756 target_out_dir + "/updater/sehap_contexts", 757 target_out_dir + "/updater/service_contexts", 758 target_out_dir + "/updater/hdf_service_contexts", 759 target_out_dir + "/updater/parameter_contexts", 760 ] 761} 762 763action("selinux_check") { 764 script = "scripts/selinux_check/selinux_check_main.py" 765 766 if (selinux_adapter_build_path == "default") { 767 selinux_adapter_build_path = 768 selinux_adapter_build_path + ":" + OHOS_PRODUCT_DIR 769 } 770 771 if (selinux_adapter_check_extend_list != "default") { 772 selinux_adapter_build_path = 773 selinux_adapter_build_path + ":" + selinux_adapter_check_extend_list 774 } 775 776 args = [ 777 "--output-path", 778 rebase_path(target_out_dir), 779 "--source-root-dir", 780 rebase_path("//"), 781 "--user-policy", 782 rebase_path(target_out_dir + "/user_policy"), 783 "--developer-policy", 784 rebase_path(target_out_dir + "/developer/developer_policy"), 785 "--tool-path", 786 tool_path, 787 "--policy-dir-list", 788 selinux_adapter_build_path, 789 ] 790 791 if (special_selinux_check_config != "default") { 792 args += [ 793 "--selinux-check-config", 794 special_selinux_check_config, 795 ] 796 } else { 797 args += [ 798 "--selinux-check-config", 799 "base/security/selinux_adapter/scripts/selinux_check/config/selinux_check.json", 800 ] 801 } 802 803 outputs = [ "$target_out_dir" ] 804 805 deps = [ 806 ":build_contexts", 807 ":build_policy", 808 ] 809} 810 811copy("selinux_config") { 812 if (selinux_adapter_enforce) { 813 sources = [ "config/config.enforce" ] 814 } else { 815 sources = [ "config/config.permissive" ] 816 } 817 outputs = [ "$target_out_dir/config" ] 818} 819 820copy("updater_selinux_config") { 821 sources = [ "config/config.enforce" ] 822 outputs = [ "$target_out_dir/updater/config" ] 823} 824 825ohos_prebuilt_etc("build_sepolicy") { 826 deps = [ ":build_policy" ] 827 source = target_out_dir + "/policy.31" 828 license_file = "LICENSE" 829 part_name = "selinux_adapter" 830 subsystem_name = "security" 831 if (selinux_adapter_components == "vendor") { 832 relative_install_dir = "selinux/prebuild_sepolicy/" 833 install_images = [ "vendor" ] 834 } else if (selinux_adapter_components == "default") { 835 if (!selinux_adapter_support_developer_mode) { 836 source = target_out_dir + "/developer/policy.31" 837 } 838 relative_install_dir = "selinux/targeted/policy/" 839 install_images = [ "system" ] 840 } 841} 842 843ohos_prebuilt_etc("build_updater_sepolicy") { 844 deps = [ ":build_update_policy" ] 845 source = target_out_dir + "/updater/policy.31" 846 license_file = "LICENSE" 847 part_name = "selinux_adapter" 848 subsystem_name = "security" 849 relative_install_dir = "selinux/targeted/policy/" 850 install_images = [ "updater" ] 851} 852 853ohos_prebuilt_etc("selinux_version") { 854 deps = [ ":build_policy" ] 855 source = target_out_dir + "/version" 856 license_file = "LICENSE" 857 part_name = "selinux_adapter" 858 subsystem_name = "security" 859 relative_install_dir = "selinux/" 860 install_images = [ "vendor" ] 861} 862 863ohos_prebuilt_etc("config") { 864 deps = [ ":selinux_config" ] 865 source = target_out_dir + "/config" 866 license_file = "LICENSE" 867 part_name = "selinux_adapter" 868 subsystem_name = "security" 869 relative_install_dir = "selinux/" 870 install_images = [ "system" ] 871} 872 873ohos_prebuilt_etc("updater_config") { 874 deps = [ ":updater_selinux_config" ] 875 source = target_out_dir + "/updater/config" 876 license_file = "LICENSE" 877 part_name = "selinux_adapter" 878 subsystem_name = "security" 879 relative_install_dir = "selinux/" 880 install_images = [ "updater" ] 881} 882 883ohos_prebuilt_etc("sehap_contexts") { 884 deps = [ ":build_contexts" ] 885 source = target_out_dir + "/sehap_contexts" 886 license_file = "LICENSE" 887 part_name = "selinux_adapter" 888 subsystem_name = "security" 889 relative_install_dir = "selinux/targeted/contexts/" 890} 891 892ohos_prebuilt_etc("parameter_contexts") { 893 deps = [ ":build_contexts" ] 894 source = target_out_dir + "/parameter_contexts" 895 license_file = "LICENSE" 896 part_name = "selinux_adapter" 897 subsystem_name = "security" 898 relative_install_dir = "selinux/targeted/contexts/" 899 if (selinux_adapter_components == "vendor") { 900 install_images = [ "vendor" ] 901 } else { 902 install_images = [ 903 "system", 904 "updater", 905 ] 906 } 907} 908 909ohos_prebuilt_etc("service_contexts") { 910 deps = [ ":build_contexts" ] 911 source = target_out_dir + "/service_contexts" 912 license_file = "LICENSE" 913 part_name = "selinux_adapter" 914 subsystem_name = "security" 915 relative_install_dir = "selinux/targeted/contexts/" 916 if (selinux_adapter_components == "vendor") { 917 install_images = [ "vendor" ] 918 } else { 919 install_images = [ "system" ] 920 } 921} 922 923ohos_prebuilt_etc("hdf_service_contexts") { 924 deps = [ ":build_contexts" ] 925 source = target_out_dir + "/hdf_service_contexts" 926 license_file = "LICENSE" 927 part_name = "selinux_adapter" 928 subsystem_name = "security" 929 relative_install_dir = "selinux/targeted/contexts/" 930 if (selinux_adapter_components == "vendor") { 931 install_images = [ "vendor" ] 932 } else { 933 install_images = [ "system" ] 934 } 935} 936 937ohos_prebuilt_etc("file_contexts") { 938 deps = [ ":build_contexts" ] 939 source = target_out_dir + "/file_contexts" 940 license_file = "LICENSE" 941 part_name = "selinux_adapter" 942 subsystem_name = "security" 943 relative_install_dir = "selinux/targeted/contexts/" 944 if (selinux_adapter_components == "vendor") { 945 install_images = [ "vendor" ] 946 } else { 947 install_images = [ "system" ] 948 } 949} 950 951ohos_prebuilt_etc("ignore_cfg") { 952 deps = [ ":build_ignore_cfg" ] 953 source = target_out_dir + "/ignore_cfg" 954 license_file = "LICENSE" 955 part_name = "selinux_adapter" 956 subsystem_name = "security" 957 relative_install_dir = "selinux/" 958 if (selinux_adapter_components == "vendor") { 959 install_images = [ "vendor" ] 960 } else { 961 install_images = [ "system" ] 962 } 963} 964 965ohos_prebuilt_etc("app_allow_cfg") { 966 deps = [ ":build_ignore_cfg" ] 967 source = target_out_dir + "/app_allow_cfg" 968 license_file = "LICENSE" 969 part_name = "selinux_adapter" 970 subsystem_name = "security" 971 relative_install_dir = "selinux/" 972 install_images = [ "system" ] 973} 974 975ohos_prebuilt_etc("file_contexts_updater") { 976 deps = [ ":build_updater_contexts" ] 977 source = target_out_dir + "/updater/file_contexts" 978 license_file = "LICENSE" 979 part_name = "selinux_adapter" 980 subsystem_name = "security" 981 relative_install_dir = "selinux/targeted/contexts/" 982 if (selinux_adapter_components == "vendor") { 983 install_images = [ "updater_vendor" ] 984 } else { 985 install_images = [ "updater" ] 986 } 987} 988 989ohos_prebuilt_etc("vendor_cil") { 990 deps = [ ":build_policy" ] 991 source = target_out_dir + "/vendor.cil" 992 license_file = "LICENSE" 993 part_name = "selinux_adapter" 994 subsystem_name = "security" 995 relative_install_dir = "selinux/" 996 install_images = [ "vendor" ] 997} 998 999if (selinux_adapter_components == "vendor") { 1000 ohos_prebuilt_etc("vendor_common_cil") { 1001 deps = [ ":build_policy" ] 1002 source = target_out_dir + "/vendor_common.cil" 1003 license_file = "LICENSE" 1004 part_name = "selinux_adapter" 1005 subsystem_name = "security" 1006 relative_install_dir = "selinux/" 1007 install_images = [ "vendor" ] 1008 } 1009} 1010 1011ohos_prebuilt_etc("public_cil") { 1012 deps = [ ":build_policy" ] 1013 source = target_out_dir + "/public.cil" 1014 license_file = "LICENSE" 1015 part_name = "selinux_adapter" 1016 subsystem_name = "security" 1017 relative_install_dir = "selinux/" 1018 install_images = [ "vendor" ] 1019} 1020 1021if (selinux_adapter_components == "vendor") { 1022 ohos_prebuilt_etc("public_common_cil") { 1023 deps = [ ":build_policy" ] 1024 source = target_out_dir + "/public_common.cil" 1025 license_file = "LICENSE" 1026 part_name = "selinux_adapter" 1027 subsystem_name = "security" 1028 relative_install_dir = "selinux/" 1029 install_images = [ "vendor" ] 1030 } 1031} 1032 1033ohos_prebuilt_etc("version_cil") { 1034 deps = [ ":build_policy" ] 1035 source = 1036 target_out_dir + "/compatible/$selinux_adapter_vendor_policy_version.cil" 1037 license_file = "LICENSE" 1038 part_name = "selinux_adapter" 1039 subsystem_name = "security" 1040 relative_install_dir = "selinux/compatible/" 1041 install_images = [ "system" ] 1042} 1043 1044ohos_prebuilt_etc("prebuild_sepolicy_system_cil_sha256") { 1045 deps = [ ":build_policy" ] 1046 source = target_out_dir + "/prebuild_sepolicy.system.cil.sha256" 1047 license_file = "LICENSE" 1048 part_name = "selinux_adapter" 1049 subsystem_name = "security" 1050 relative_install_dir = "selinux/" 1051 install_images = [ "vendor" ] 1052} 1053 1054ohos_prebuilt_etc("system_cil") { 1055 deps = [ ":build_policy" ] 1056 source = target_out_dir + "/system.cil" 1057 license_file = "LICENSE" 1058 part_name = "selinux_adapter" 1059 subsystem_name = "security" 1060 relative_install_dir = "selinux/" 1061 install_images = [ "system" ] 1062} 1063 1064if (selinux_adapter_components == "system") { 1065 ohos_prebuilt_etc("system_common_cil") { 1066 deps = [ ":build_policy" ] 1067 source = target_out_dir + "/system_common.cil" 1068 license_file = "LICENSE" 1069 part_name = "selinux_adapter" 1070 subsystem_name = "security" 1071 relative_install_dir = "selinux/" 1072 install_images = [ "system" ] 1073 } 1074} 1075 1076ohos_prebuilt_etc("system_cil_sha256") { 1077 deps = [ ":build_policy" ] 1078 source = target_out_dir + "/system.cil.sha256" 1079 license_file = "LICENSE" 1080 part_name = "selinux_adapter" 1081 subsystem_name = "security" 1082 relative_install_dir = "selinux/" 1083 install_images = [ "system" ] 1084} 1085 1086if (selinux_adapter_support_developer_mode) { 1087 ohos_prebuilt_etc("system_developer_cil") { 1088 deps = [ ":build_policy" ] 1089 source = target_out_dir + "/developer/system.cil" 1090 output = "system_developer.cil" 1091 license_file = "LICENSE" 1092 part_name = "selinux_adapter" 1093 subsystem_name = "security" 1094 relative_install_dir = "selinux/" 1095 install_images = [ "system" ] 1096 } 1097 1098 ohos_prebuilt_etc("vendor_developer_cil") { 1099 deps = [ ":build_policy" ] 1100 source = target_out_dir + "/developer/vendor.cil" 1101 output = "vendor_developer.cil" 1102 license_file = "LICENSE" 1103 part_name = "selinux_adapter" 1104 subsystem_name = "security" 1105 relative_install_dir = "selinux/" 1106 install_images = [ "vendor" ] 1107 } 1108 1109 ohos_prebuilt_etc("public_developer_cil") { 1110 deps = [ ":build_policy" ] 1111 source = target_out_dir + "/developer/public.cil" 1112 output = "public_developer.cil" 1113 license_file = "LICENSE" 1114 part_name = "selinux_adapter" 1115 subsystem_name = "security" 1116 relative_install_dir = "selinux/" 1117 install_images = [ "vendor" ] 1118 } 1119 1120 ohos_prebuilt_etc("version_developer_cil") { 1121 deps = [ ":build_policy" ] 1122 source = target_out_dir + 1123 "/developer/compatible/$selinux_adapter_vendor_policy_version.cil" 1124 license_file = "LICENSE" 1125 part_name = "selinux_adapter" 1126 subsystem_name = "security" 1127 relative_install_dir = "selinux/compatible_developer/" 1128 install_images = [ "system" ] 1129 } 1130 1131 ohos_prebuilt_etc("developer_policy") { 1132 deps = [ ":build_policy" ] 1133 source = target_out_dir + "/developer/policy.31" 1134 output = "developer_policy" 1135 license_file = "LICENSE" 1136 part_name = "selinux_adapter" 1137 subsystem_name = "security" 1138 if (selinux_adapter_components == "vendor") { 1139 relative_install_dir = "selinux/prebuild_sepolicy/" 1140 install_images = [ "vendor" ] 1141 } else if (selinux_adapter_components == "default") { 1142 relative_install_dir = "selinux/targeted/policy/" 1143 install_images = [ "system" ] 1144 } 1145 } 1146 1147 ohos_prebuilt_etc("prebuild_sepolicy_system_developer_cil_sha256") { 1148 deps = [ ":build_policy" ] 1149 source = target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256" 1150 output = "prebuild_sepolicy.system_developer.cil.sha256" 1151 license_file = "LICENSE" 1152 part_name = "selinux_adapter" 1153 subsystem_name = "security" 1154 relative_install_dir = "selinux/" 1155 install_images = [ "vendor" ] 1156 } 1157 1158 ohos_prebuilt_etc("system_developer_cil_sha256") { 1159 deps = [ ":build_policy" ] 1160 source = target_out_dir + "/developer/system.cil.sha256" 1161 output = "system_developer.cil.sha256" 1162 license_file = "LICENSE" 1163 part_name = "selinux_adapter" 1164 subsystem_name = "security" 1165 relative_install_dir = "selinux/" 1166 install_images = [ "system" ] 1167 } 1168} 1169 1170if (build_selinux) { 1171 ohos_copy("libselinux_toolchain") { 1172 external_deps = [ "selinux:libselinux($host_toolchain)" ] 1173 if (!ohos_indep_compiler_enable) { 1174 sources = [ 1175 "$root_build_dir/clang_${host_cpu}/thirdparty/selinux/libselinux.so", 1176 ] 1177 } else { 1178 sources = 1179 [ rebase_path(get_label_info("selinux:libselinux($host_toolchain)", 1180 "target_out_dir") + 1181 "/clang_${host_cpu}/libs/libselinux.so") ] 1182 } 1183 outputs = 1184 [ "$root_build_dir/clang_${host_cpu}/security/selinux/libselinux.so" ] 1185 1186 part_name = "selinux_adapter" 1187 subsystem_name = "security" 1188 } 1189 1190 ohos_copy("libpcre2_toolchain") { 1191 external_deps = [ "pcre2:libpcre2($host_toolchain)" ] 1192 if (!ohos_indep_compiler_enable) { 1193 sources = 1194 [ "$root_build_dir/clang_${host_cpu}/thirdparty/pcre2/libpcre2.so" ] 1195 } else { 1196 sources = [ rebase_path(get_label_info("pcre2:libpcre2($host_toolchain)", 1197 "target_out_dir") + 1198 "/clang_${host_cpu}/libs/libpcre2.so") ] 1199 } 1200 outputs = 1201 [ "$root_build_dir/clang_${host_cpu}/security/selinux/libpcre2.so" ] 1202 part_name = "selinux_adapter" 1203 subsystem_name = "security" 1204 } 1205} 1206 1207if (ohos_indep_compiler_enable) { 1208 ohos_copy("libselinux_so") { 1209 external_deps = [ "selinux:libselinux($host_toolchain)" ] 1210 1211 sources = [ 1212 "//binarys/third_party/pcre2/innerapis/libpcre2/clang_x64/libs/libpcre2.so", 1213 "//binarys/third_party/selinux/innerapis/checkpolicy/clang_x64/libs/checkpolicy", 1214 "//binarys/third_party/selinux/innerapis/libselinux/clang_x64/libs/libselinux.so", 1215 "//binarys/third_party/selinux/innerapis/libsepol/clang_x64/libs/libsepol.so", 1216 "//binarys/third_party/selinux/innerapis/secilc/clang_x64/libs/secilc", 1217 "//binarys/third_party/selinux/innerapis/sefcontext_compile/clang_x64/libs/sefcontext_compile", 1218 ] 1219 1220 outputs = [ "$target_out_dir/{{source_file_part}}" ] 1221 1222 part_name = "selinux_adapter" 1223 subsystem_name = "security" 1224 } 1225} 1226 1227ohos_copy("filecontexts_toolchain") { 1228 deps = [ ":build_contexts" ] 1229 sources = [ "$target_out_dir/file_contexts.bin" ] 1230 outputs = [ "$target_out_dir/../security/selinux/file_contexts.bin" ] 1231 part_name = "selinux_adapter" 1232 subsystem_name = "security" 1233} 1234 1235if (selinux_adapter_components != "default") { 1236 copy("eng_system_compatible") { 1237 deps = [ ":build_policy" ] 1238 sources = [ "$target_out_dir/compatible" ] 1239 outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/compatible" ] 1240 } 1241 1242 copy("eng_system_compatible_developer") { 1243 deps = [ ":build_policy" ] 1244 sources = [ "$target_out_dir/developer/compatible" ] 1245 outputs = [ 1246 "$root_out_dir/$eng_system_base_dir/etc/selinux/compatible_developer", 1247 ] 1248 } 1249 1250 copy("eng_system_system_cil") { 1251 deps = [ ":build_policy" ] 1252 sources = [ "$target_out_dir/system.cil" ] 1253 outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil" ] 1254 } 1255 1256 copy("eng_system_system_cil_sha256") { 1257 deps = [ ":build_policy" ] 1258 sources = [ "$target_out_dir/system.cil.sha256" ] 1259 outputs = 1260 [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil.sha256" ] 1261 } 1262 1263 copy("eng_system_system_common_cil") { 1264 deps = [ ":build_policy" ] 1265 sources = [ "$target_out_dir/system_common.cil" ] 1266 outputs = 1267 [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_common.cil" ] 1268 } 1269 1270 copy("eng_system_system_developer_cil") { 1271 deps = [ ":build_policy" ] 1272 sources = [ "$target_out_dir/developer/system.cil" ] 1273 outputs = [ 1274 "$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil", 1275 ] 1276 } 1277 1278 copy("eng_system_system_developer_cil_sha256") { 1279 deps = [ ":build_policy" ] 1280 sources = [ "$target_out_dir/developer/system.cil.sha256" ] 1281 outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil.sha256" ] 1282 } 1283 1284 copy("eng_chipset_developer_policy") { 1285 deps = [ ":build_policy" ] 1286 sources = [ "$target_out_dir/developer/policy.31" ] 1287 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/developer_policy" ] 1288 } 1289 1290 copy("eng_chipset_policy") { 1291 deps = [ ":build_policy" ] 1292 sources = [ "$target_out_dir/policy.31" ] 1293 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/policy.31" ] 1294 } 1295 1296 copy("eng_chipset_system_cil_sha256") { 1297 deps = [ ":build_policy" ] 1298 sources = [ "$target_out_dir/prebuild_sepolicy.system.cil.sha256" ] 1299 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system.cil.sha256" ] 1300 } 1301 1302 copy("eng_chipset_system_developer_cil_sha256") { 1303 deps = [ ":build_policy" ] 1304 sources = 1305 [ "$target_out_dir/developer/prebuild_sepolicy.system.cil.sha256" ] 1306 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system_developer.cil.sha256" ] 1307 } 1308 1309 copy("eng_chipset_public_cil") { 1310 deps = [ ":build_policy" ] 1311 sources = [ "$target_out_dir/public.cil" ] 1312 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public.cil" ] 1313 } 1314 1315 copy("eng_chipset_public_common_cil") { 1316 deps = [ ":build_policy" ] 1317 sources = [ "$target_out_dir/public_common.cil" ] 1318 outputs = 1319 [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_common.cil" ] 1320 } 1321 1322 copy("eng_chipset_public_developer_cil") { 1323 deps = [ ":build_policy" ] 1324 sources = [ "$target_out_dir/developer/public.cil" ] 1325 outputs = [ 1326 "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_developer.cil", 1327 ] 1328 } 1329 1330 copy("eng_chipset_vendor_cil") { 1331 deps = [ ":build_policy" ] 1332 sources = [ "$target_out_dir/vendor.cil" ] 1333 outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor.cil" ] 1334 } 1335 1336 copy("eng_chipset_vendor_common_cil") { 1337 deps = [ ":build_policy" ] 1338 sources = [ "$target_out_dir/vendor_common.cil" ] 1339 outputs = 1340 [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_common.cil" ] 1341 } 1342 1343 copy("eng_chipset_vendor_developer_cil") { 1344 deps = [ ":build_policy" ] 1345 sources = [ "$target_out_dir/developer/vendor.cil" ] 1346 outputs = [ 1347 "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_developer.cil", 1348 ] 1349 } 1350 1351 group("eng_system_selinux_group") { 1352 deps = [ 1353 ":eng_system_compatible", 1354 ":eng_system_compatible_developer", 1355 ":eng_system_system_cil", 1356 ":eng_system_system_cil_sha256", 1357 ":eng_system_system_common_cil", 1358 ":eng_system_system_developer_cil", 1359 ":eng_system_system_developer_cil_sha256", 1360 ":filecontexts_toolchain", 1361 ] 1362 } 1363 1364 group("eng_chipset_selinux_group") { 1365 deps = [ 1366 ":eng_chipset_developer_policy", 1367 ":eng_chipset_policy", 1368 ":eng_chipset_public_cil", 1369 ":eng_chipset_public_common_cil", 1370 ":eng_chipset_public_developer_cil", 1371 ":eng_chipset_system_cil_sha256", 1372 ":eng_chipset_system_developer_cil_sha256", 1373 ":eng_chipset_vendor_cil", 1374 ":eng_chipset_vendor_common_cil", 1375 ":eng_chipset_vendor_developer_cil", 1376 ":filecontexts_toolchain", 1377 ] 1378 } 1379} 1380 1381group("selinux_group") { 1382 if (build_selinux) { 1383 deps = [] 1384 if (ohos_indep_compiler_enable) { 1385 deps += [ ":libselinux_so" ] 1386 } 1387 1388 deps += [ 1389 ":build_updater_sepolicy", 1390 ":config", 1391 ":file_contexts", 1392 ":file_contexts_updater", 1393 ":filecontexts_toolchain", 1394 ":hap_restorecon", 1395 ":hdf_service_contexts", 1396 ":ignore_cfg", 1397 ":app_allow_cfg", 1398 ":libpcre2_toolchain", 1399 ":libselinux_toolchain", 1400 ":load_policy", 1401 ":param_check", 1402 ":parameter_contexts", 1403 ":restorecon", 1404 ":sehap_contexts", 1405 ":selinux_check", 1406 ":service_check", 1407 ":service_contexts", 1408 ":updater_config", 1409 ] 1410 external_deps = [ 1411 "selinux:checkpolicy($host_toolchain)", 1412 "selinux:chkcon", 1413 "selinux:getenforce", 1414 "selinux:getfilecon", 1415 "selinux:getpidcon", 1416 "selinux:secilc", 1417 "selinux:secilc($host_toolchain)", 1418 "selinux:sefcontext_compile($host_toolchain)", 1419 "selinux:selinux_check_access", 1420 "selinux:selinuxexeccon", 1421 "selinux:setenforce", 1422 "selinux:setfilecon", 1423 ] 1424 if (selinux_adapter_components == "system") { 1425 deps += [ 1426 ":system_cil", 1427 ":system_cil_sha256", 1428 ":system_common_cil", 1429 ":version_cil", 1430 ] 1431 if (selinux_adapter_support_developer_mode) { 1432 deps += [ 1433 ":system_developer_cil", 1434 ":system_developer_cil_sha256", 1435 ":version_developer_cil", 1436 ] 1437 } 1438 } else if (selinux_adapter_components == "vendor") { 1439 deps += [ 1440 ":build_sepolicy", 1441 ":prebuild_sepolicy_system_cil_sha256", 1442 ":public_cil", 1443 ":public_common_cil", 1444 ":selinux_version", 1445 ":vendor_cil", 1446 ":vendor_common_cil", 1447 ] 1448 if (selinux_adapter_support_developer_mode) { 1449 deps += [ 1450 ":developer_policy", 1451 ":prebuild_sepolicy_system_developer_cil_sha256", 1452 ":public_developer_cil", 1453 ":vendor_developer_cil", 1454 ] 1455 } 1456 } else { 1457 deps += [ ":build_sepolicy" ] 1458 if (selinux_adapter_support_developer_mode) { 1459 deps += [ ":developer_policy" ] 1460 } 1461 } 1462 } 1463} 1464