git: 187f5dc16e9a - main - textproc/sonic: Fix build.

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Fri, 01 Sep 2023 14:00:36 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=187f5dc16e9ad4d10edc253c8bce31a1a8e5c91a

commit 187f5dc16e9ad4d10edc253c8bce31a1a8e5c91a
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2023-08-31 12:40:55 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2023-09-01 13:59:41 +0000

    textproc/sonic: Fix build.
    
    Add missing distfiles
---
 textproc/sonic/Makefile                                      |  4 ++++
 textproc/sonic/distinfo                                      |  4 +++-
 .../sonic/files/patch-cargo-crates_lindera-unidic-build.rs   | 12 ++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/textproc/sonic/Makefile b/textproc/sonic/Makefile
index 1f8bd54ec2cd..2a731c333d17 100644
--- a/textproc/sonic/Makefile
+++ b/textproc/sonic/Makefile
@@ -2,6 +2,8 @@ PORTNAME=	sonic
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.4.1
 CATEGORIES=	textproc
+MASTER_SITES+=	https://clrd.ninjal.ac.jp/unidic_archive/cwj/2.1.2/:unidic
+DISTFILES+=	unidic-mecab-2.1.2_src.zip:unidic # check cargo-crates/lindera-unidic-XXX/build.rs
 
 MAINTAINER=	mikael@FreeBSD.org
 COMMENT=	Fast, lightweight, and schema-less search backend
@@ -216,6 +218,8 @@ PLIST_FILES=	bin/sonic \
 PORTDOCS=	CONFIGURATION.md PROTOCOL.md README.md
 OPTIONS_DEFINE=	DOCS
 
+CARGO_ENV+=	DISTDIR=${DISTDIR}
+
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/sonic
 	@${MKDIR} ${STAGEDIR}${ETCDIR}
diff --git a/textproc/sonic/distinfo b/textproc/sonic/distinfo
index 5a44966cd55a..2c3bed178ab8 100644
--- a/textproc/sonic/distinfo
+++ b/textproc/sonic/distinfo
@@ -1,4 +1,6 @@
-TIMESTAMP = 1692815272
+TIMESTAMP = 1693485642
+SHA256 (unidic-mecab-2.1.2_src.zip) = 6cce98269214ce7de6159f61a25ffc5b436375c098cc86d6aa98c0605cbf90d4
+SIZE (unidic-mecab-2.1.2_src.zip) = 140517811
 SHA256 (rust/crates/adler-1.0.2.crate) = f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe
 SIZE (rust/crates/adler-1.0.2.crate) = 12778
 SHA256 (rust/crates/aes-0.8.3.crate) = ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2
diff --git a/textproc/sonic/files/patch-cargo-crates_lindera-unidic-build.rs b/textproc/sonic/files/patch-cargo-crates_lindera-unidic-build.rs
new file mode 100644
index 000000000000..c764cb7eb4d8
--- /dev/null
+++ b/textproc/sonic/files/patch-cargo-crates_lindera-unidic-build.rs
@@ -0,0 +1,12 @@
+--- cargo-crates/lindera-unidic-0.24.0/build.rs.orig	2006-07-24 03:21:28 UTC
++++ cargo-crates/lindera-unidic-0.24.0/build.rs
+@@ -56,7 +56,8 @@ fn main() -> Result<(), Box<dyn Error>> {
+         dummy_matrix_def.write_all(b"0 1 0\n")?;
+     } else {
+         // Source file path for build package
+-        let source_path_for_build = Path::new(&build_dir).join(file_name);
++        let file_dir = env::var_os("DISTDIR").unwrap(); // ex) /usr/ports/distfiles
++        let source_path_for_build = Path::new(&file_dir).join(file_name);
+ 
+         // Download source file to build directory
+         if !source_path_for_build.exists() {