[meson] Add graphite2 option and deprecate graphite

Fixes https://github.com/harfbuzz/harfbuzz/issues/3241

Should be better handled when we can use https://github.com/mesonbuild/meson/pull/9184
diff --git a/meson.build b/meson.build
index 389c49c..da426ed 100644
--- a/meson.build
+++ b/meson.build
@@ -96,7 +96,8 @@
                       fallback: ['glib', 'libglib_dep'])
 gobject_dep = dependency('gobject-2.0', required: get_option('gobject'),
                          fallback: ['glib', 'libgobject_dep'])
-graphite2_dep = dependency('graphite2', required: get_option('graphite'))
+graphite2_dep = dependency('graphite2', required: get_option('graphite2'))
+graphite_dep = dependency('graphite2', required: get_option('graphite'))
 
 icu_dep = null_dep
 if not get_option('icu').disabled()
@@ -188,7 +189,7 @@
   conf.set('HAVE_CHAFA', 1)
 endif
 
-if graphite2_dep.found()
+if graphite2_dep.found() or graphite_dep.found()
   conf.set('HAVE_GRAPHITE2', 1)
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index cd4526b..9ebba72 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,8 @@
 option('icu', type: 'feature', value: 'auto',
   description: 'Enable ICU library unicode functions')
 option('graphite', type: 'feature', value: 'disabled',
+  description: 'Deprecated use graphite2 option instead')
+option('graphite2', type: 'feature', value: 'disabled',
   description: 'Enable Graphite2 complementary shaper')
 option('freetype', type: 'feature', value: 'auto',
   description: 'Enable freetype interop helpers')
diff --git a/src/meson.build b/src/meson.build
index e15da3a..18f7fa1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -345,7 +345,7 @@
 if conf.get('HAVE_GRAPHITE2', 0) == 1
   hb_sources += hb_graphite2_sources
   hb_headers += hb_graphite2_headers
-  harfbuzz_deps += [graphite2_dep]
+  harfbuzz_deps += [graphite2_dep, graphite_dep]
 endif
 
 if conf.get('HAVE_GLIB', 0) == 1