git: 68286c8108b0 - main - textproc/p5-XML-Parser: Convert XMLPARSER_EUCJP and XMLPARSER_SJIS to option framework

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 07 Jul 2022 12:38:26 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=68286c8108b0ad92535134516d05ffb778532363

commit 68286c8108b0ad92535134516d05ffb778532363
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-07-07 12:23:38 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-07-07 12:36:27 +0000

    textproc/p5-XML-Parser: Convert XMLPARSER_EUCJP and XMLPARSER_SJIS to option framework
---
 textproc/p5-XML-Parser/Makefile  | 60 ++++++++++++++++++++++++++--------------
 textproc/p5-XML-Parser/pkg-plist |  8 ++++--
 2 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/textproc/p5-XML-Parser/Makefile b/textproc/p5-XML-Parser/Makefile
index 93e197978f94..edcdd809a5b4 100644
--- a/textproc/p5-XML-Parser/Makefile
+++ b/textproc/p5-XML-Parser/Makefile
@@ -17,31 +17,51 @@ USE_PERL5=	configure
 
 CONFIGURE_ARGS=	EXPATINCPATH=${LOCALBASE}/include EXPATLIBPATH=${LOCALBASE}/lib
 
-PLIST_SUB=	EUCJP=${EUCJP} SJIS=${SJIS}
-
 CONV_ENC=	${PERL} -e '$$e=shift @ARGV; undef $$/; $$_=<>; substr($$_,4,40)=pack("a40","$$e"); print'
 
-# XMLPARSER_EUCJP=	x-euc-jp-(jisx0221|unicode)
-# XMLPARSER_SJIS=	x-sjis-(cp932|jdk117|jisx0221|unicode)
-.if !defined(XMLPARSER_EUCJP)
-EUCJP=		"@comment "
-.endif
-.if !defined(XMLPARSER_SJIS)
-SJIS=		"@comment "
-.endif
-.if defined(XMLPARSER_EUCJP) || defined(XMLPARSER_SJIS)
-USE_PERL5+=	patch
-.endif
+OPTIONS_RADIO=	EUCJP SJIS
+OPTIONS_RADIO_EUCJP=	EUCJP_JISX0221 EUCJP_UNICODE
+OPTIONS_RADIO_SJIS=	SJIS_CP932 SJIS_JDK117 SJIS_JISX0221 SJIS_UNICODE
+OPTIONS_SUB=	yes
+EUCJP_JISX0221_DESC=	Install euc-jp.enc (generated from x-euc-jp-jisx0221.enc)
+EUCJP_UNICODE_DESC=	Install euc-jp.enc (generated from x-euc-jp-unicode.enc)
+SJIS_CP932_DESC=	Install shift_jis.enc (generated from x-sjis-cp932.enc)
+SJIS_JDK117_DESC=	Install shift_jis.enc (generated from x-sjis-jdk117.enc)
+SJIS_JISX0221_DESC=	Install shift_jis.enc (generated from x-sjis-jisx0221.enc)
+SJIS_UNICODE_DESC=	Install shift_jis.enc (generated from x-sjis-unicode.enc)
 
-post-patch:
-.if defined(XMLPARSER_EUCJP)
-	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} euc-jp ${XMLPARSER_EUCJP}.enc > euc-jp.enc
+EUCJP_JISX0221_USE=	PERL5=patch
+EUCJP_UNICODE_USE=	PERL5=patch
+SJIS_CP932_USE=		PERL5=patch
+SJIS_JDK117_USE=	PERL5=patch
+SJIS_JISX0221_USE=	PERL5=patch
+SJIS_UNICODE_USE=	PERL5=patch
+
+pre-patch-EUCJP_JISX0221-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} euc-jp x-euc-jp-jisx0221.enc > euc-jp.enc
 	@${ECHO_CMD} Parser/Encodings/euc-jp.enc >> ${WRKSRC}/MANIFEST
-.endif
-.if defined(XMLPARSER_SJIS)
-	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} shift_jis ${XMLPARSER_SJIS}.enc > shift_jis.enc
+
+pre-patch-EUCJP_UNICODE-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} euc-jp x-euc-jp-unicode.enc > euc-jp.enc
+	@${ECHO_CMD} Parser/Encodings/euc-jp.enc >> ${WRKSRC}/MANIFEST
+
+pre-patch-SJIS_CP932-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} shift_jis x-sjis-cp932.enc > shift_jis.enc
+	@${ECHO_CMD} Parser/Encodings/shift_jis.enc >> ${WRKSRC}/MANIFEST
+
+pre-patch-SJIS_JDK117-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} shift_jis x-sjis-jdk117.enc > shift_jis.enc
+	@${ECHO_CMD} Parser/Encodings/shift_jis.enc >> ${WRKSRC}/MANIFEST
+
+pre-patch-SJIS_JISX0221-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} shift_jis x-sjis-jisx0221.enc > shift_jis.enc
 	@${ECHO_CMD} Parser/Encodings/shift_jis.enc >> ${WRKSRC}/MANIFEST
-.endif
+
+pre-patch-SJIS_UNICODE-on:
+	@cd ${WRKSRC}/Parser/Encodings && ${CONV_ENC} shift_jis x-sjis-unicode.enc > shift_jis.enc
+	@${ECHO_CMD} Parser/Encodings/shift_jis.enc >> ${WRKSRC}/MANIFEST
+
+post-patch:
 	@${CP} ${FILESDIR}/*.enc ${WRKSRC}/Parser/Encodings/
 .for e in 1 6 10 11 13 14 15
 	@${ECHO_CMD} Parser/Encodings/iso-8859-${e}.enc >> ${WRKSRC}/MANIFEST
diff --git a/textproc/p5-XML-Parser/pkg-plist b/textproc/p5-XML-Parser/pkg-plist
index 92559b641384..faceadcb5b59 100644
--- a/textproc/p5-XML-Parser/pkg-plist
+++ b/textproc/p5-XML-Parser/pkg-plist
@@ -3,7 +3,8 @@
 %%SITE_ARCH%%/XML/Parser/Encodings/README
 %%SITE_ARCH%%/XML/Parser/Encodings/big5.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/euc-kr.enc
-%%EUCJP%%%%SITE_ARCH%%/XML/Parser/Encodings/euc-jp.enc
+%%EUCJP_JISX0221%%%%SITE_ARCH%%/XML/Parser/Encodings/euc-jp.enc
+%%EUCJP_UNICODE%%%%SITE_ARCH%%/XML/Parser/Encodings/euc-jp.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/ibm866.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/iso-8859-1.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/iso-8859-10.enc
@@ -20,7 +21,10 @@
 %%SITE_ARCH%%/XML/Parser/Encodings/iso-8859-8.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/iso-8859-9.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/koi8-r.enc
-%%SJIS%%%%SITE_ARCH%%/XML/Parser/Encodings/shift_jis.enc
+%%SJIS_CP932%%%%SITE_ARCH%%/XML/Parser/Encodings/shift_jis.enc
+%%SJIS_JDK117%%%%SITE_ARCH%%/XML/Parser/Encodings/shift_jis.enc
+%%SJIS_JISX0221%%%%SITE_ARCH%%/XML/Parser/Encodings/shift_jis.enc
+%%SJIS_UNICODE%%%%SITE_ARCH%%/XML/Parser/Encodings/shift_jis.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/windows-1250.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/windows-1251.enc
 %%SITE_ARCH%%/XML/Parser/Encodings/windows-1252.enc