1# Copyright (c) 2021-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") 15import("//foundation/multimodalinput/input/multimodalinput_mini.gni") 16 17gen_src_dir = "//third_party/libinput" 18gen_dst_dir = root_out_dir + "/diff_libinput_mmi" 19patches_root_dir = "//foundation/multimodalinput/input/patch" 20build_gn_dir = "$patches_root_dir/diff_libinput_mmi/libinput" 21 22action("apply_patch") { 23 visibility = [ ":*" ] 24 script = "$patches_root_dir/apply_patch.sh" 25 inputs = [ "$gen_src_dir" ] 26 outputs = [ 27 "$gen_dst_dir/src/filter.c", 28 "$gen_dst_dir/src/filter-flat.c", 29 "$gen_dst_dir/src/filter-low-dpi.c", 30 "$gen_dst_dir/src/filter-mouse.c", 31 "$gen_dst_dir/src/filter-touchpad.c", 32 "$gen_dst_dir/src/filter-touchpad-x230.c", 33 "$gen_dst_dir/src/filter-tablet.c", 34 "$gen_dst_dir/src/filter-trackpoint.c", 35 "$gen_dst_dir/src/filter-touchpad-flat.c", 36 "$gen_dst_dir/src/libinput.c", 37 "$gen_dst_dir/src/evdev.c", 38 "$gen_dst_dir/src/evdev-debounce.c", 39 "$gen_dst_dir/src/evdev-fallback.c", 40 "$gen_dst_dir/src/evdev-totem.c", 41 "$gen_dst_dir/src/evdev-joystick.c", 42 "$gen_dst_dir/src/evdev-middle-button.c", 43 "$gen_dst_dir/src/evdev-mt-touchpad.c", 44 "$gen_dst_dir/src/evdev-mt-touchpad-tap.c", 45 "$gen_dst_dir/src/evdev-mt-touchpad-thumb.c", 46 "$gen_dst_dir/src/evdev-mt-touchpad-buttons.c", 47 "$gen_dst_dir/src/evdev-mt-touchpad-edge-scroll.c", 48 "$gen_dst_dir/src/evdev-mt-touchpad-gestures.c", 49 "$gen_dst_dir/src/evdev-tablet.c", 50 "$gen_dst_dir/src/evdev-tablet-pad.c", 51 "$gen_dst_dir/src/evdev-tablet-pad-leds.c", 52 "$gen_dst_dir/src/path-seat.c", 53 "$gen_dst_dir/src/udev-seat.c", 54 "$gen_dst_dir/src/timer.c", 55 "$gen_dst_dir/src/libinput-util.c", 56 "$gen_dst_dir/src/quirks.c", 57 "$gen_dst_dir/src/util-list.c", 58 "$gen_dst_dir/src/util-prop-parsers.c", 59 "$gen_dst_dir/src/util-ratelimit.c", 60 "$gen_dst_dir/src/util-strings.c", 61 "$gen_dst_dir/tools/shared.h", 62 "$gen_dst_dir/tools/shared.c", 63 "$gen_dst_dir/tools/libinput-debug-events.c", 64 "$gen_dst_dir/tools/libinput-list-devices.c", 65 "$gen_dst_dir/tools/libinput-debug-tablet.c", 66 "$gen_dst_dir/hm_src/hm_missing.h", 67 "$gen_dst_dir/hm_src/hm_missing.c", 68 "$gen_dst_dir/tools/libinput-record.c", 69 "$gen_dst_dir/tools/libinput-analyze.c", 70 "$gen_dst_dir/tools/libinput-measure.c", 71 "$gen_dst_dir/tools/libinput-quirks.c", 72 ] 73 74 args = [ 75 rebase_path(gen_src_dir, root_build_dir), 76 rebase_path(gen_dst_dir, root_build_dir), 77 rebase_path(build_gn_dir, root_build_dir), 78 ] 79} 80 81config("libinput-third_config") { 82 visibility = [ ":*" ] 83 84 include_dirs = [ 85 "$gen_dst_dir/src", 86 "$gen_dst_dir/include", 87 "$gen_dst_dir/hm_src", 88 ] 89 90 cflags = [ 91 "-Wno-unused-parameter", 92 "-Wno-implicit-int", 93 "-Wno-return-type", 94 "-Wno-unused-function", 95 "-Wno-string-conversion", 96 "-DHAVE_LIBINPUT_LOG_CONSOLE_ENABLE", 97 "-DHAVE_LIBINPUT_LOG_ENABLE", 98 ] 99} 100 101config("libinput-third_public_config") { 102 include_dirs = [ 103 "$gen_dst_dir/export_include", 104 "$gen_dst_dir/include", 105 "//third_party/FreeBSD/sys/dev/evdev", 106 "$gen_dst_dir/src", 107 ] 108 109 cflags = [] 110} 111 112ohos_source_set("patch_gen_libinput-third-mmi") { 113 part_name = "input" 114 subsystem_name = "multimodalinput" 115 sources = [ 116 "$gen_dst_dir/src/evdev-debounce.c", 117 "$gen_dst_dir/src/evdev-fallback.c", 118 "$gen_dst_dir/src/evdev-joystick.c", 119 "$gen_dst_dir/src/evdev-middle-button.c", 120 "$gen_dst_dir/src/evdev-mt-touchpad-buttons.c", 121 "$gen_dst_dir/src/evdev-mt-touchpad-edge-scroll.c", 122 "$gen_dst_dir/src/evdev-mt-touchpad-gestures.c", 123 "$gen_dst_dir/src/evdev-mt-touchpad-tap.c", 124 "$gen_dst_dir/src/evdev-mt-touchpad-thumb.c", 125 "$gen_dst_dir/src/evdev-mt-touchpad.c", 126 "$gen_dst_dir/src/evdev-tablet-pad-leds.c", 127 "$gen_dst_dir/src/evdev-tablet-pad.c", 128 "$gen_dst_dir/src/evdev-tablet.c", 129 "$gen_dst_dir/src/evdev-totem.c", 130 "$gen_dst_dir/src/evdev.c", 131 "$gen_dst_dir/src/filter-flat.c", 132 "$gen_dst_dir/src/filter-low-dpi.c", 133 "$gen_dst_dir/src/filter-mouse.c", 134 "$gen_dst_dir/src/filter-tablet.c", 135 "$gen_dst_dir/src/filter-touchpad-flat.c", 136 "$gen_dst_dir/src/filter-touchpad-x230.c", 137 "$gen_dst_dir/src/filter-touchpad.c", 138 "$gen_dst_dir/src/filter-trackpoint.c", 139 "$gen_dst_dir/src/filter.c", 140 "$gen_dst_dir/src/libinput-util.c", 141 "$gen_dst_dir/src/libinput.c", 142 "$gen_dst_dir/src/path-seat.c", 143 "$gen_dst_dir/src/quirks.c", 144 "$gen_dst_dir/src/timer.c", 145 "$gen_dst_dir/src/udev-seat.c", 146 "$gen_dst_dir/src/util-list.c", 147 "$gen_dst_dir/src/util-prop-parsers.c", 148 "$gen_dst_dir/src/util-ratelimit.c", 149 "$gen_dst_dir/src/util-strings.c", 150 ] 151 152 configs = [ ":libinput-third_config" ] 153 154 public_configs = [ ":libinput-third_public_config" ] 155 156 deps = [ ":apply_patch" ] 157 158 public_deps = [ 159 "//third_party/eudev:libudev", 160 "//third_party/libevdev:libevdev", 161 "//third_party/mtdev:libmtdev", 162 ] 163} 164 165ohos_shared_library("libinput-third-mmi") { 166 sources = [] 167 168 configs = [ ":libinput-third_config" ] 169 170 public_configs = [ ":libinput-third_public_config" ] 171 172 deps = [ ":patch_gen_libinput-third-mmi" ] 173 174 public_deps = [ 175 "//third_party/eudev:libudev", 176 "//third_party/libevdev:libevdev", 177 "//third_party/mtdev:libmtdev", 178 ] 179 180 part_name = "input" 181 subsystem_name = "multimodalinput" 182} 183 184ohos_source_set("patch_gen_libinput-debug") { 185 part_name = "input" 186 subsystem_name = "multimodalinput" 187 sources = [ 188 "$gen_dst_dir/tools/libinput-debug-events.c", 189 "$gen_dst_dir/tools/shared.c", 190 "$gen_dst_dir/tools/shared.h", 191 ] 192 193 configs = [ ":libinput-third_config" ] 194 195 public_configs = [ ":libinput-third_public_config" ] 196 197 deps = [ ":apply_patch" ] 198 199 public_deps = [ 200 "//third_party/eudev:libudev", 201 "//third_party/libevdev:libevdev", 202 "//third_party/mtdev:libmtdev", 203 ] 204} 205 206ohos_executable("libinput-debug-mmi") { 207 install_enable = true 208 209 sources = [] 210 211 configs = [ ":libinput-third_config" ] 212 213 public_configs = [ ":libinput-third_public_config" ] 214 215 deps = [ 216 ":libinput-third-mmi", 217 ":patch_gen_libinput-debug", 218 ] 219 220 public_deps = [ 221 "//third_party/eudev:libudev", 222 "//third_party/libevdev:libevdev", 223 "//third_party/mtdev:libmtdev", 224 ] 225 226 part_name = "input" 227 subsystem_name = "multimodalinput" 228} 229 230ohos_source_set("patch_gen_libinput-list") { 231 part_name = "input" 232 subsystem_name = "multimodalinput" 233 sources = [ 234 "$gen_dst_dir/tools/libinput-list-devices.c", 235 "$gen_dst_dir/tools/shared.c", 236 "$gen_dst_dir/tools/shared.h", 237 ] 238 239 configs = [ ":libinput-third_config" ] 240 241 public_configs = [ ":libinput-third_public_config" ] 242 243 deps = [ ":apply_patch" ] 244 245 public_deps = [ 246 "//third_party/eudev:libudev", 247 "//third_party/libevdev:libevdev", 248 "//third_party/mtdev:libmtdev", 249 ] 250} 251 252ohos_executable("libinput-list-mmi") { 253 install_enable = true 254 255 sources = [] 256 257 configs = [ ":libinput-third_config" ] 258 259 public_configs = [ ":libinput-third_public_config" ] 260 261 deps = [ 262 ":libinput-third-mmi", 263 ":patch_gen_libinput-list", 264 ] 265 266 public_deps = [ 267 "//third_party/eudev:libudev", 268 "//third_party/libevdev:libevdev", 269 "//third_party/mtdev:libmtdev", 270 ] 271 272 part_name = "input" 273 subsystem_name = "multimodalinput" 274} 275 276ohos_source_set("patch_gen_libinput-tablet") { 277 part_name = "input" 278 subsystem_name = "multimodalinput" 279 sources = [ 280 "$gen_dst_dir/tools/libinput-debug-tablet.c", 281 "$gen_dst_dir/tools/shared.c", 282 "$gen_dst_dir/tools/shared.h", 283 ] 284 285 configs = [ ":libinput-third_config" ] 286 287 public_configs = [ ":libinput-third_public_config" ] 288 289 deps = [ ":apply_patch" ] 290 291 public_deps = [ 292 "//third_party/eudev:libudev", 293 "//third_party/libevdev:libevdev", 294 "//third_party/mtdev:libmtdev", 295 ] 296} 297 298ohos_executable("libinput-tablet-mmi") { 299 install_enable = true 300 301 sources = [] 302 303 configs = [ ":libinput-third_config" ] 304 305 public_configs = [ ":libinput-third_public_config" ] 306 307 deps = [ 308 ":libinput-third-mmi", 309 ":patch_gen_libinput-tablet", 310 ] 311 312 public_deps = [ 313 "//third_party/eudev:libudev", 314 "//third_party/libevdev:libevdev", 315 "//third_party/mtdev:libmtdev", 316 ] 317 318 part_name = "input" 319 subsystem_name = "multimodalinput" 320} 321 322ohos_source_set("patch_gen_libinput-record") { 323 part_name = "input" 324 subsystem_name = "multimodalinput" 325 sources = [ 326 "$gen_dst_dir/hm_src/hm_missing.c", 327 "$gen_dst_dir/tools/libinput-record.c", 328 "$gen_dst_dir/tools/shared.c", 329 "$gen_dst_dir/tools/shared.h", 330 ] 331 332 configs = [ ":libinput-third_config" ] 333 334 public_configs = [ ":libinput-third_public_config" ] 335 336 deps = [ ":apply_patch" ] 337 338 public_deps = [ 339 "//third_party/eudev:libudev", 340 "//third_party/libevdev:libevdev", 341 "//third_party/mtdev:libmtdev", 342 ] 343} 344 345ohos_executable("libinput-record-mmi") { 346 install_enable = true 347 348 sources = [] 349 350 configs = [ ":libinput-third_config" ] 351 352 public_configs = [ ":libinput-third_public_config" ] 353 354 deps = [ 355 ":libinput-third-mmi", 356 ":patch_gen_libinput-record", 357 ] 358 359 public_deps = [ 360 "//third_party/eudev:libudev", 361 "//third_party/libevdev:libevdev", 362 "//third_party/mtdev:libmtdev", 363 ] 364 365 part_name = "input" 366 subsystem_name = "multimodalinput" 367} 368 369ohos_source_set("patch_gen_libinput-analyze") { 370 part_name = "input" 371 subsystem_name = "multimodalinput" 372 sources = [ 373 "$gen_dst_dir/tools/libinput-analyze.c", 374 "$gen_dst_dir/tools/shared.c", 375 "$gen_dst_dir/tools/shared.h", 376 ] 377 378 configs = [ ":libinput-third_config" ] 379 380 public_configs = [ ":libinput-third_public_config" ] 381 382 deps = [ ":apply_patch" ] 383 384 public_deps = [ 385 "//third_party/eudev:libudev", 386 "//third_party/libevdev:libevdev", 387 "//third_party/mtdev:libmtdev", 388 ] 389} 390 391ohos_executable("libinput-analyze-mmi") { 392 install_enable = true 393 394 sources = [] 395 396 configs = [ ":libinput-third_config" ] 397 398 public_configs = [ ":libinput-third_public_config" ] 399 400 deps = [ 401 ":libinput-third-mmi", 402 ":patch_gen_libinput-analyze", 403 ] 404 405 public_deps = [ 406 "//third_party/eudev:libudev", 407 "//third_party/libevdev:libevdev", 408 "//third_party/mtdev:libmtdev", 409 ] 410 411 part_name = "input" 412 subsystem_name = "multimodalinput" 413} 414 415ohos_source_set("patch_gen_libinput-measure") { 416 part_name = "input" 417 subsystem_name = "multimodalinput" 418 sources = [ 419 "$gen_dst_dir/tools/libinput-measure.c", 420 "$gen_dst_dir/tools/shared.c", 421 "$gen_dst_dir/tools/shared.h", 422 ] 423 424 configs = [ ":libinput-third_config" ] 425 426 public_configs = [ ":libinput-third_public_config" ] 427 428 deps = [ ":apply_patch" ] 429 430 public_deps = [ 431 "//third_party/eudev:libudev", 432 "//third_party/libevdev:libevdev", 433 "//third_party/mtdev:libmtdev", 434 ] 435} 436 437ohos_executable("libinput-measure-mmi") { 438 install_enable = true 439 440 sources = [] 441 442 configs = [ ":libinput-third_config" ] 443 444 public_configs = [ ":libinput-third_public_config" ] 445 446 deps = [ 447 ":libinput-third-mmi", 448 ":patch_gen_libinput-measure", 449 ] 450 451 public_deps = [ 452 "//third_party/eudev:libudev", 453 "//third_party/libevdev:libevdev", 454 "//third_party/mtdev:libmtdev", 455 ] 456 457 part_name = "input" 458 subsystem_name = "multimodalinput" 459} 460 461ohos_source_set("patch_gen_libinput-quirks") { 462 part_name = "input" 463 subsystem_name = "multimodalinput" 464 sources = [ 465 "$gen_dst_dir/tools/libinput-quirks.c", 466 "$gen_dst_dir/tools/shared.c", 467 "$gen_dst_dir/tools/shared.h", 468 ] 469 470 configs = [ ":libinput-third_config" ] 471 472 public_configs = [ ":libinput-third_public_config" ] 473 474 deps = [ ":apply_patch" ] 475 476 public_deps = [ 477 "//third_party/eudev:libudev", 478 "//third_party/libevdev:libevdev", 479 "//third_party/mtdev:libmtdev", 480 ] 481} 482 483ohos_executable("libinput-quirks-mmi") { 484 install_enable = true 485 486 sources = [] 487 488 configs = [ ":libinput-third_config" ] 489 490 public_configs = [ ":libinput-third_public_config" ] 491 492 deps = [ 493 ":libinput-third-mmi", 494 ":patch_gen_libinput-quirks", 495 ] 496 497 public_deps = [ 498 "//third_party/eudev:libudev", 499 "//third_party/libevdev:libevdev", 500 "//third_party/mtdev:libmtdev", 501 ] 502 503 part_name = "input" 504 subsystem_name = "multimodalinput" 505} 506