1# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("../../../access_token.gni") 16 17config("accesstokenlib") { 18 visibility = [ ":*" ] 19 include_dirs = [ "include" ] 20} 21 22if (is_standard_system) { 23 nativetoken_soruces = [ 24 "src/nativetoken.c", 25 "src/nativetoken_hisysevent.c", 26 "src/nativetoken_json_oper.c", 27 ] 28 ohos_static_library("libnativetoken") { 29 subsystem_name = "security" 30 part_name = "access_token" 31 output_name = "libnativetoken" 32 sanitize = { 33 cfi = true 34 cfi_cross_dso = true 35 debug = false 36 } 37 branch_protector_ret = "pac_ret" 38 39 public_configs = [ ":accesstokenlib" ] 40 41 cflags = [ "-Wall" ] 42 43 include_dirs = [ "${access_token_path}/frameworks/common/include" ] 44 45 sources = nativetoken_soruces 46 47 deps = [ "${access_token_path}/frameworks/common:accesstoken_static_log_for_nativetoken" ] 48 49 external_deps = [ 50 "bounds_checking_function:libsec_shared", 51 "cJSON:cjson_static", 52 "hilog:libhilog", 53 ] 54 55 public_external_deps = [ "hisysevent:libhisysevent" ] 56 57 if (build_selinux) { 58 external_deps += [ "selinux_adapter:librestorecon" ] 59 cflags += [ "-DWITH_SELINUX" ] 60 } 61 } 62 63 ohos_shared_library("libnativetoken_shared") { 64 subsystem_name = "security" 65 part_name = "access_token" 66 output_name = "libnativetoken_shared" 67 sanitize = { 68 cfi = true 69 cfi_cross_dso = true 70 debug = false 71 } 72 branch_protector_ret = "pac_ret" 73 innerapi_tags = [ "platformsdk" ] 74 public_configs = [ ":accesstokenlib" ] 75 76 cflags = [ "-Wall" ] 77 78 include_dirs = [ "${access_token_path}/frameworks/common/include" ] 79 80 sources = nativetoken_soruces 81 82 deps = [ "${access_token_path}/frameworks/common:accesstoken_static_log_for_nativetoken" ] 83 84 external_deps = [ 85 "bounds_checking_function:libsec_shared", 86 "cJSON:cjson_static", 87 "hilog:libhilog", 88 "hisysevent:libhisysevent", 89 ] 90 91 if (build_selinux) { 92 external_deps += [ "selinux_adapter:librestorecon" ] 93 cflags += [ "-DWITH_SELINUX" ] 94 } 95 } 96} 97