meson: Fix find_program and subproject usage
authorNirbheek Chauhan <nirbheek@centricular.com>
Sun, 18 Dec 2022 04:41:54 +0000 (10:11 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Sun, 18 Dec 2022 21:39:11 +0000 (03:09 +0530)
Dummy dependencies are not required to execute a subproject
automatically for providing a program, nor do you need to explicitly
call subproject() to do that.

A `[provide]` section in the wrap file is enough.

docs/reference/meson.build
gtk/meson.build
meson.build
subprojects/gi-docgen.wrap
subprojects/sassc.wrap

index df5e3d9909008c9b68956920e3c99afb5a323eec..0d294137d796aeffdad54480c654e42842af3b15 100644 (file)
@@ -1,7 +1,9 @@
 toml_conf = configuration_data()
 toml_conf.set('version', meson.project_version())
 
-gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
+gidocgen = find_program('gi-docgen',
+                        required: get_option('gtk_doc') and get_option('introspection').enabled(),
+                        native: true)
 
 gidocgen_common_args = [
   '--quiet',
index 72e283b71deabba367d696c6ec179cc136148a7a..61185696dd79a0bfea9c160a081e89860c9d4fd3 100644 (file)
@@ -779,21 +779,14 @@ theme_deps = []
 # For git checkouts, but not for tarballs...
 if not fs.exists('theme/Default/Default-light.css')
   # ... build the theme files
-  sassc = find_program('sassc', required: false)
-  if not sassc.found()
-    subproject('sassc')
-    sassc = find_program('sassc', required: true)
-  endif
-
-  if sassc.found()
-    sassc_opts = [ '-a', '-M', '-t', 'compact' ]
+  sassc = find_program('sassc', native: true)
+  sassc_opts = [ '-a', '-M', '-t', 'compact' ]
 
-    subdir('theme/Default')
+  subdir('theme/Default')
 
-    theme_deps += [
-      default_theme_deps,
-    ]
-  endif
+  theme_deps += [
+    default_theme_deps,
+  ]
 endif
 
 
index 5a461c0336ebcfc3dc8a0db01fa94be9a4369ce2..d0d3b432c52ba44c209ff76d99af69229ecd9f44 100644 (file)
@@ -406,11 +406,6 @@ xkbdep         = dependency('xkbcommon', version: xkbcommon_req, required: wayla
 graphene_dep   = dependency('graphene-gobject-1.0', version: graphene_req,
                             default_options: ['tests=false'])
 iso_codes_dep  = dependency('iso-codes', required: false)
-
-gidocgen_dep    = dependency('gi-docgen', version: '>= 2021.1',
-                             fallback: ['gi-docgen', 'dummy_dep'],
-                             required: get_option('gtk_doc') and get_option('introspection').enabled(),
-                             native: true)
 gi_dep         = dependency('gobject-introspection-1.0', version: introspection_req,
                             required: get_option('introspection').enabled() and
                                       get_option('build-tests'))
index 01606cee4a3cfb86a5b8e312f930abf9c92550c5..85c85da16f78efb897d5bf56d1c1fd430de8acdf 100644 (file)
@@ -4,3 +4,6 @@ url = https://gitlab.gnome.org/GNOME/gi-docgen.git
 push-url = ssh://git@ssh.gitlab.gnome.org:GNOME/gi-docgen.git
 revision = main
 depth = 1
+
+[provide]
+program_names = gi-docgen
index edd76c61beda78176e566c2cf053d2681b2d1ddb..2930f5c1a364e2497ccc2b002fd6442f2b89918e 100644 (file)
@@ -1,5 +1,8 @@
 [wrap-git]
-directory=sassc
-url=https://github.com/lazka/sassc.git
-revision=meson
-depth=1
+directory = sassc
+url = https://github.com/lazka/sassc.git
+revision = meson
+depth = 1
+
+[provide]
+program_names = sassc