From 5d69fdf22aa0d4360048e2e933e845215e8ba82b Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 3 Feb 2026 02:51:03 -0800
Subject: [PATCH] meson: Fix anthy-unicode.conf search path in mkdepgraph

Resolves issue where a blank anthy.dep is generated when using
the meson build system. This is due to the anthy-unicode.conf
path not being adjusted between meson and autotools.

BUG=#14
---
 depgraph/meson.build  | 3 ++-
 depgraph/mkdepgraph.c | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/depgraph/meson.build b/depgraph/meson.build
index 386480b..070e3ea 100644
--- a/depgraph/meson.build
+++ b/depgraph/meson.build
@@ -2,7 +2,8 @@ mkdepgraph = executable('mkdepgraph',
   sources: ['mkdepgraph.c'],
   include_directories: [top_srcdir],
   dependencies: [anthy_dep, anthydic_dep],
-  c_args: '-DSRCDIR="'+meson.current_source_dir()+'"',
+  c_args: [ '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
+            '-DCONFDIR="@0@"'.format((meson.project_build_root())) ],
 )
 
 anthy_dep_graph = custom_target('anthy.dep',
diff --git a/depgraph/mkdepgraph.c b/depgraph/mkdepgraph.c
index 972a6b8..03980f0 100644
--- a/depgraph/mkdepgraph.c
+++ b/depgraph/mkdepgraph.c
@@ -43,6 +43,10 @@
 #define SRCDIR "."
 #endif
 
+#ifndef CONFDIR
+#define CONFDIR ".."
+#endif
+
 static int verbose;
 
 static struct dep_node* gNodes;
@@ -482,7 +486,7 @@ main(int argc, char **argv)
   int i;
   const char *out_fn = "anthy.dep";
   /* 付属語辞書を読み込んでファイルに書き出す */
-  anthy_conf_override("CONFFILE", "../anthy-unicode.conf");
+  anthy_conf_override("CONFFILE", CONFDIR "/anthy-unicode.conf");
   anthy_conf_override("ANTHYDIR", SRCDIR "/../depgraph/");
 
   anthy_init_wtypes();
