1# Copyright (c) 2022 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") 15 16ASOUND_STATE_DIR = "/var/lib/alsa" 17ASOUND_LOCK_DIR = "/var/lock" 18ASOUND_LOCK_DIR = "/var/run" 19 20config("alsa_utils_config") { 21 cflags = [ 22 "-Wno-sign-compare", 23 "-Wno-implicit-function-declaration", 24 "-Wno-parentheses", 25 "-Wno-string-conversion", 26 "-Wno-string-plus-int", 27 "-Wno-asm-operand-widths", 28 "-Wno-pointer-sign", 29 "-Wno-deprecated-declarations", 30 "-Wno-implicit-int", 31 "-Wno-switch", 32 "-Wno-incompatible-pointer-types-discards-qualifiers", 33 "-Wno-int-conversion", 34 "-Wno-absolute-value", 35 "-Wno-unused-function", 36 "-Wno-unused-label", 37 "-Wno-unused-const-variable", 38 "-Wno-visibility", 39 "-Wno-incompatible-pointer-types", 40 "-Wno-sometimes-uninitialized", 41 "-Wno-format", 42 "-Wno-tautological-constant-out-of-range-compare", 43 "-Wno-implicit-fallthrough", 44 "-Wno-error", 45 "-DHAVE_CONFIG_H", 46 "-D_GNU_SOURCE", 47 "-D__USE_GNU", 48 "-DCURSESINC=\"\"", 49 "-DSYS_ASOUNDRC=\"$ASOUND_STATE_DIR/asound.state\"", 50 "-DSYS_LOCKFILE=\"$ASOUND_LOCK_DIR/asound.state.lock\"", 51 "-DSYS_LOCKFILE=\"$ASOUND_LOCK_DIR/asound.state.lock\"", 52 ] 53 54 if (use_musl) { 55 cflags += [ "-Wno-bool-operation" ] 56 } 57} 58 59ohos_executable("aconnect") { 60 sources = [ "seq/aconnect/aconnect.c" ] 61 62 include_dirs = [ 63 "//third_party/alsa-utils/include", 64 "//third_party/alsa-lib/include", 65 ] 66 67 configs = [ ":alsa_utils_config" ] 68 69 deps = [ "../alsa-lib:libasound" ] 70 71 subsystem_name = "thirdparty" 72 part_name = "alsa-utils" 73} 74 75ohos_executable("amixer") { 76 sources = [ 77 "amixer/amixer.c", 78 "amixer/volume_mapping.c", 79 ] 80 81 include_dirs = [ 82 "//third_party/alsa-utils/amixer", 83 "//third_party/alsa-utils/include", 84 "//third_party/alsa-lib/include", 85 ] 86 87 configs = [ ":alsa_utils_config" ] 88 89 deps = [ "../alsa-lib:libasound" ] 90 91 install_enable = true 92 subsystem_name = "thirdparty" 93 part_name = "alsa-utils" 94 install_images = [ "system" ] 95} 96 97ohos_executable("aplay") { 98 sources = [ "aplay/aplay.c" ] 99 100 include_dirs = [ 101 "//third_party/alsa-utils/aplay", 102 "//third_party/alsa-utils/include", 103 "//third_party/alsa-lib/include", 104 ] 105 106 configs = [ ":alsa_utils_config" ] 107 108 deps = [ "../alsa-lib:libasound" ] 109 110 symlink_target_name = [ "arecord" ] 111 112 install_enable = true 113 subsystem_name = "thirdparty" 114 part_name = "alsa-utils" 115 install_images = [ "system" ] 116} 117 118ohos_executable("speaker-test") { 119 sources = [ 120 "speaker-test/pink.c", 121 "speaker-test/speaker-test.c", 122 "speaker-test/st2095.c", 123 ] 124 125 include_dirs = [ 126 "//third_party/alsa-utils/speaker-test", 127 "//third_party/alsa-utils/include", 128 "//third_party/alsa-lib/include", 129 ] 130 131 configs = [ ":alsa_utils_config" ] 132 133 deps = [ "../alsa-lib:libasound" ] 134 135 subsystem_name = "thirdparty" 136 part_name = "alsa-utils" 137} 138 139ohos_executable("alsactl") { 140 sources = [ 141 "alsactl/alsactl.c", 142 "alsactl/clean.c", 143 "alsactl/daemon.c", 144 "alsactl/info.c", 145 "alsactl/init_parse.c", 146 "alsactl/init_ucm.c", 147 "alsactl/lock.c", 148 "alsactl/monitor.c", 149 "alsactl/state.c", 150 "alsactl/utils.c", 151 ] 152 153 include_dirs = [ 154 "//third_party/alsa-utils/alsactl", 155 "//third_party/alsa-utils/include", 156 "//third_party/alsa-lib/include", 157 ] 158 159 configs = [ ":alsa_utils_config" ] 160 161 deps = [ "../alsa-lib:libasound" ] 162 163 install_enable = true 164 subsystem_name = "thirdparty" 165 part_name = "alsa-utils" 166 install_images = [ "system" ] 167} 168 169group("alsa-utils") { 170 deps = [ 171 ":aconnect", 172 ":alsactl", 173 ":amixer", 174 ":aplay", 175 ":speaker-test", 176 ] 177} 178