meson: simplify dependencies

Leverage wrapfile `[provide]` directives to simplify the dependency
searching in the meson.build.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id8a0909445b38271c0cdea79bad0ca9198cf7f0a
diff --git a/meson.build b/meson.build
index 0962ee5..f227b1a 100644
--- a/meson.build
+++ b/meson.build
@@ -23,16 +23,9 @@
 conf_data.set('SYNC_MAC_FROM_INVENTORY', get_option('sync-mac'))
 conf_data.set('PERSIST_MAC', get_option('persist-mac'))
 
-sdbusplus_dep = dependency('sdbusplus', required: false)
-if sdbusplus_dep.found() and sdbusplus_dep.type_name() != 'internal'
-  sdbusplusplus_prog = find_program('sdbus++', native: true)
-  sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
-else
-  sdbusplus_proj = subproject('sdbusplus', required: true)
-  sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
-  sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
-  sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable('sdbuspp_gen_meson_prog')
-endif
+sdbusplus_dep = dependency('sdbusplus')
+sdbusplusplus_prog = find_program('sdbus++', native: true)
+sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
 
 generated_sources = []
 generated_others = []
@@ -41,9 +34,7 @@
 subdir('gen/xyz')
 networkd_dbus_includes = include_directories('gen')
 
-phosphor_dbus_interfaces_dep = dependency(
-  'phosphor-dbus-interfaces',
-  fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'])
+phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
 
 networkd_dbus_deps = [
   phosphor_dbus_interfaces_dep,
diff --git a/src/meson.build b/src/meson.build
index 7916856..304db1f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,6 +1,4 @@
-phosphor_logging_dep = dependency(
-  'phosphor-logging',
-  fallback: ['phosphor-logging', 'phosphor_logging_dep'])
+phosphor_logging_dep = dependency('phosphor-logging')
 
 src_includes = include_directories('.')
 
@@ -45,10 +43,7 @@
     'nlohmann::json::string_t',
     required: false)
   if not has_json
-    json_dep = dependency(
-      'nlohmann_json',
-      fallback: ['nlohmann_json', 'nlohmann_json_dep'],
-      required: true)
+    json_dep = dependency('nlohmann_json')
   endif
 endif
 
@@ -58,8 +53,8 @@
   phosphor_logging_dep,
   networkd_dbus_dep,
   sdbusplus_dep,
-  dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']),
-  dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']),
+  dependency('sdeventplus'),
+  dependency('stdplus'),
 ]
 
 conf_header = configure_file(
diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap
index 0ba9c03..477e844 100644
--- a/subprojects/nlohmann_json.wrap
+++ b/subprojects/nlohmann_json.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
 url = https://github.com/nlohmann/json
 revision = HEAD
+
+[provide]
+nlohmann_json = nlohmann_json_dep
diff --git a/subprojects/phosphor-dbus-interfaces.wrap b/subprojects/phosphor-dbus-interfaces.wrap
index 0be70dd..346aa0c 100644
--- a/subprojects/phosphor-dbus-interfaces.wrap
+++ b/subprojects/phosphor-dbus-interfaces.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
-url = https://github.com/openbmc/phosphor-dbus-interfaces
+url = https://github.com/openbmc/phosphor-dbus-interfaces.git
 revision = HEAD
+
+[provide]
+phosphor-dbus-interfaces = phosphor_dbus_interfaces_dep
diff --git a/subprojects/phosphor-logging.wrap b/subprojects/phosphor-logging.wrap
index 8db07b6..71eee8b 100644
--- a/subprojects/phosphor-logging.wrap
+++ b/subprojects/phosphor-logging.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
-url = https://github.com/openbmc/phosphor-logging
+url = https://github.com/openbmc/phosphor-logging.git
 revision = HEAD
+
+[provide]
+phosphor-logging = phosphor_logging_dep
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
index 7f736e7..edd9a31 100644
--- a/subprojects/sdbusplus.wrap
+++ b/subprojects/sdbusplus.wrap
@@ -1,3 +1,7 @@
 [wrap-git]
-url = https://github.com/openbmc/sdbusplus
+url = https://github.com/openbmc/sdbusplus.git
 revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
+program_names = sdbus++, sdbus++-gen-meson
diff --git a/subprojects/sdeventplus.wrap b/subprojects/sdeventplus.wrap
index 7503664..f871ac0 100644
--- a/subprojects/sdeventplus.wrap
+++ b/subprojects/sdeventplus.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
-url = https://github.com/openbmc/sdeventplus
+url = https://github.com/openbmc/sdeventplus.git
 revision = HEAD
+
+[provide]
+sdeventplus = sdeventplus_dep
diff --git a/subprojects/stdplus.wrap b/subprojects/stdplus.wrap
index 00dae65..765ba71 100644
--- a/subprojects/stdplus.wrap
+++ b/subprojects/stdplus.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
 url = https://github.com/openbmc/stdplus
 revision = HEAD
+
+[provide]
+stdplus = stdplus_dep