git: 72b9da5ac99d - main - textproc/linuxdoc-tools: Fix expand(1) locale

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Tue, 30 Jun 2026 20:06:23 UTC
The branch main has been updated by tijl:

URL: https://cgit.FreeBSD.org/ports/commit/?id=72b9da5ac99d1240e717857998556c4a2825d136

commit 72b9da5ac99d1240e717857998556c4a2825d136
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2026-06-09 17:40:49 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2026-06-30 20:03:56 +0000

    textproc/linuxdoc-tools: Fix expand(1) locale
    
    Add a patch so linuxdoc runs expand(1) with the right locale to
    interpret multibyte characters.
    
    PR:             295945
    Exp-run by:     antoine
---
 textproc/linuxdoc-tools/Makefile                   |  6 +++++-
 .../files/patch-perl5lib_LinuxDocTools.pm          | 24 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/textproc/linuxdoc-tools/Makefile b/textproc/linuxdoc-tools/Makefile
index f6bf287274d0..9305e1475cb7 100644
--- a/textproc/linuxdoc-tools/Makefile
+++ b/textproc/linuxdoc-tools/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	linuxdoc-tools
 DISTVERSION=	0.9.83
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	textproc
 
 MAINTAINER=	ports@FreeBSD.org
@@ -36,4 +36,8 @@ DOCS_USES=		makeinfo tex
 DOCS_USE=		TEX=dvipsk:build,latex:build,pdftex:build
 DOCS_CONFIGURE_ENABLE=	docs
 
+post-stage:
+	@${RM} ${STAGEDIR}${DOCSDIR}/Makefile.orig \
+		${STAGEDIR}${DOCSDIR}/example/Makefile.orig
+
 .include <bsd.port.mk>
diff --git a/textproc/linuxdoc-tools/files/patch-perl5lib_LinuxDocTools.pm b/textproc/linuxdoc-tools/files/patch-perl5lib_LinuxDocTools.pm
new file mode 100644
index 000000000000..0c86c6c997ce
--- /dev/null
+++ b/textproc/linuxdoc-tools/files/patch-perl5lib_LinuxDocTools.pm
@@ -0,0 +1,24 @@
+--- perl5lib/LinuxDocTools.pm.orig	2023-06-12 16:57:27 UTC
++++ perl5lib/LinuxDocTools.pm
+@@ -621,8 +621,20 @@ sub process_file {
+     }
+   }
+ 
++  my %EXPAND_locale = (
++    'ascii' => 'C',
++    'latin' => 'C',
++    'latin1' => 'C',
++    'utf-8' => 'C.UTF-8',
++    'nippon' => 'ja_JP.eucJP',
++    'euc-kr' => 'ko_KR.eucKR'
++  );
++  die "$error_header: Unkown character set $global->{charset}.\n"
++    unless exists $EXPAND_locale{$global->{charset}};
++  my $EXPAND_envvars = "LC_ALL=$EXPAND_locale{$global->{charset}}";
++
+   my $sgmlsasp_command = "$main::progs->{SGMLSASP} $mapping < $preaspout |
+-      expand -t $global->{tabsize} > $aspout";
++      $EXPAND_envvars expand -t $global->{tabsize} > $aspout";
+   ldt_log "  ${error_header}::sgmlsasp_command:\n    $sgmlsasp_command";
+   system ($sgmlsasp_command) == 0
+     or die "$error_header: Error running $sgmlsasp_command. Aborting ...\n";