diff options
author | thestig <thestig@chromium.org> | 2014-11-21 18:47:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-22 02:49:05 +0000 |
commit | ee816c278f12488490cb2e01fda46e4abab45af7 (patch) | |
tree | d1f6cb64c1d1bbfd9cab51236d17f149a7fc4f80 /build/linux | |
parent | 727ab043f6a9c135430fcb5231de215cbeb43eef (diff) | |
download | chromium_src-ee816c278f12488490cb2e01fda46e4abab45af7.zip chromium_src-ee816c278f12488490cb2e01fda46e4abab45af7.tar.gz chromium_src-ee816c278f12488490cb2e01fda46e4abab45af7.tar.bz2 |
Linux: Dynamically load libudev.
Funnel all libudev access through a wrapper for the udev library loader.
BUG=415212
Review URL: https://codereview.chromium.org/674703002
Cr-Commit-Position: refs/heads/master@{#305348}
Diffstat (limited to 'build/linux')
-rw-r--r-- | build/linux/system.gyp | 163 |
1 files changed, 125 insertions, 38 deletions
diff --git a/build/linux/system.gyp b/build/linux/system.gyp index 3e88093..cd0288b 100644 --- a/build/linux/system.gyp +++ b/build/linux/system.gyp @@ -20,6 +20,69 @@ 'linux_link_libpci%': 0, 'linux_link_libspeechd%': 0, 'linux_link_libbrlapi%': 0, + + # Used below for the various libraries. In this scope for sharing with GN. + 'libbrlapi_functions': [ + 'brlapi_getHandleSize', + 'brlapi_error_location', + 'brlapi_strerror', + 'brlapi__acceptKeys', + 'brlapi__openConnection', + 'brlapi__closeConnection', + 'brlapi__getDisplaySize', + 'brlapi__enterTtyModeWithPath', + 'brlapi__leaveTtyMode', + 'brlapi__writeDots', + 'brlapi__readKey', + ], + 'libgio_functions': [ + 'g_settings_new', + 'g_settings_get_child', + 'g_settings_get_string', + 'g_settings_get_boolean', + 'g_settings_get_int', + 'g_settings_get_strv', + 'g_settings_list_schemas', + ], + 'libpci_functions': [ + 'pci_alloc', + 'pci_init', + 'pci_cleanup', + 'pci_scan_bus', + 'pci_fill_info', + 'pci_lookup_name', + ], + 'libudev_functions': [ + 'udev_device_get_action', + 'udev_device_get_devnode', + 'udev_device_get_parent', + 'udev_device_get_parent_with_subsystem_devtype', + 'udev_device_get_property_value', + 'udev_device_get_subsystem', + 'udev_device_get_sysattr_value', + 'udev_device_get_sysname', + 'udev_device_get_syspath', + 'udev_device_new_from_devnum', + 'udev_device_new_from_syspath', + 'udev_device_unref', + 'udev_enumerate_add_match_subsystem', + 'udev_enumerate_get_list_entry', + 'udev_enumerate_new', + 'udev_enumerate_scan_devices', + 'udev_enumerate_unref', + 'udev_list_entry_get_next', + 'udev_list_entry_get_name', + 'udev_monitor_enable_receiving', + 'udev_monitor_filter_add_match_subsystem_devtype', + 'udev_monitor_get_fd', + 'udev_monitor_new_from_netlink', + 'udev_monitor_receive_device', + 'udev_monitor_unref', + 'udev_new', + 'udev_set_log_fn', + 'udev_set_log_priority', + 'udev_unref', + ], }, 'conditions': [ [ 'chromeos==0 and use_ozone==0', { @@ -445,22 +508,67 @@ 'targets': [ { 'target_name': 'udev', - 'type': 'none', + 'type': 'static_library', 'conditions': [ ['_toolset=="target"', { - 'direct_dependent_settings': { - 'cflags': [ - '<!@(<(pkg-config) --cflags libudev)' - ], - }, - 'link_settings': { - 'ldflags': [ - '<!@(<(pkg-config) --libs-only-L --libs-only-other libudev)', - ], - 'libraries': [ - '<!@(<(pkg-config) --libs-only-l libudev)', - ], - }, + 'include_dirs': [ + '../..', + ], + 'hard_dependency': 1, + 'actions': [ + { + 'variables': { + 'output_h': '<(SHARED_INTERMEDIATE_DIR)/library_loaders/libudev0.h', + 'output_cc': '<(INTERMEDIATE_DIR)/libudev0_loader.cc', + 'generator': '../../tools/generate_library_loader/generate_library_loader.py', + }, + 'action_name': 'generate_libudev0_loader', + 'inputs': [ + '<(generator)', + ], + 'outputs': [ + '<(output_h)', + '<(output_cc)', + ], + 'action': ['python', + '<(generator)', + '--name', 'LibUdev0Loader', + '--output-h', '<(output_h)', + '--output-cc', '<(output_cc)', + '--header', '"third_party/libudev/libudev0.h"', + '--link-directly=0', + '<@(libudev_functions)', + ], + 'message': 'Generating libudev0 library loader', + 'process_outputs_as_sources': 1, + }, + { + 'variables': { + 'output_h': '<(SHARED_INTERMEDIATE_DIR)/library_loaders/libudev1.h', + 'output_cc': '<(INTERMEDIATE_DIR)/libudev1_loader.cc', + 'generator': '../../tools/generate_library_loader/generate_library_loader.py', + }, + 'action_name': 'generate_libudev1_loader', + 'inputs': [ + '<(generator)', + ], + 'outputs': [ + '<(output_h)', + '<(output_cc)', + ], + 'action': ['python', + '<(generator)', + '--name', 'LibUdev1Loader', + '--output-h', '<(output_h)', + '--output-cc', '<(output_cc)', + '--header', '"third_party/libudev/libudev1.h"', + '--link-directly=0', + '<@(libudev_functions)', + ], + 'message': 'Generating libudev1 library loader', + 'process_outputs_as_sources': 1, + }, + ], }], ], }, @@ -520,12 +628,7 @@ # and get it fixed so that we don't need --use-extern-c. '--use-extern-c', '--link-directly=<(linux_link_libpci)', - 'pci_alloc', - 'pci_init', - 'pci_cleanup', - 'pci_scan_bus', - 'pci_fill_info', - 'pci_lookup_name', + '<@(libpci_functions)', ], 'message': 'Generating libpci library loader', 'process_outputs_as_sources': 1, @@ -706,13 +809,7 @@ '--output-cc', '<(output_cc)', '--header', '<gio/gio.h>', '--link-directly=<(linux_link_gsettings)', - 'g_settings_new', - 'g_settings_get_child', - 'g_settings_get_string', - 'g_settings_get_boolean', - 'g_settings_get_int', - 'g_settings_get_strv', - 'g_settings_list_schemas', + '<@(libgio_functions)', ], 'message': 'Generating libgio library loader', 'process_outputs_as_sources': 1, @@ -882,17 +979,7 @@ '--output-cc', '<(output_cc)', '--header', '<brlapi.h>', '--link-directly=<(linux_link_libbrlapi)', - 'brlapi_getHandleSize', - 'brlapi_error_location', - 'brlapi_strerror', - 'brlapi__acceptKeys', - 'brlapi__openConnection', - 'brlapi__closeConnection', - 'brlapi__getDisplaySize', - 'brlapi__enterTtyModeWithPath', - 'brlapi__leaveTtyMode', - 'brlapi__writeDots', - 'brlapi__readKey', + '<@(libbrlapi_functions)', ], 'message': 'Generating libbrlapi library loader', 'process_outputs_as_sources': 1, |