aboutsummaryrefslogtreecommitdiffstats
path: root/russian/p5-XML-Parser-encodings/Makefile
blob: c854e98af3feb55116a814387de6d32a074df00a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Created by: Sergey Skvortsov <skv@protey.ru>
# $FreeBSD$

PORTNAME=   XML-Parser-encodings
PORTVERSION=    1.03
CATEGORIES= russian textproc perl5
PKGNAMEPREFIX=  p5-
DISTFILES=

MAINTAINER= perl@FreeBSD.org
COMMENT=    Additional Russian encodings for XML::Parser

RUN_DEPENDS=    p5-XML-Parser>=2.40:${PORTSDIR}/textproc/p5-XML-Parser
BUILD_DEPENDS:= ${RUN_DEPENDS} \
        p5-XML-Encoding>=0:${PORTSDIR}/textproc/p5-XML-Encoding \
        ${NONEXISTENT}:${PORTSDIR}/converters/iconv:extract \
        ${NONEXISTENT}:${PORTSDIR}/converters/iconv-extra:extract

USES=       perl5
NO_WRKSUBDIR=   YES
RUSSIANENC= cp1251 cp866 mac-cyrillic

NO_STAGE=   yes
post-extract:
.for ICONVPORT in iconv iconv-extra
    @${LN} -sfh \
    `cd ${PORTSDIR}/converters/${ICONVPORT} && ${MAKE} -V WRKSRC`/ccs \
    ${WRKSRC}/${ICONVPORT}
.endfor

do-configure:
    @${CP} ${WRKSRC}/iconv/cp866.txt ${WRKDIR}
    @${CP} ${WRKSRC}/iconv-extra/windows-1251.txt ${WRKDIR}/cp1251.txt
    @${CP} ${WRKSRC}/iconv-extra/mac-cyrillic.txt ${WRKDIR}
    @${PERL} -pi -e 's/\r/\n/gm;' ${WRKDIR}/mac-cyrillic.txt

do-build:
.for ENC in ${RUSSIANENC}
    @${LOCALBASE}/bin/make_encmap ${ENC} ${WRKDIR}/${ENC}.txt | \
    ${PERL} -pi -e "s/(?<=^<encmap name='${ENC}')()(?=>)/ expat='yes'/;" \
        >${WRKDIR}/${ENC}.xml
    @${LOCALBASE}/bin/compile_encoding \
        -o ${WRKDIR}/${ENC}.enc ${WRKDIR}/${ENC}.xml
.endfor

do-install:
    ${INSTALL_DATA} ${WRKSRC}/*.enc \
        ${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/XML/Parser/Encodings/

.include <bsd.port.mk>