aboutsummaryrefslogtreecommitdiffstats
path: root/www/firefox-esr-i18n/Makefile
blob: 23daa1486d5a92a528913cd44ceccc19585626ea (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Created by: Andrew Pantyukhin <infofarmer@FreeBSD.org>
# $FreeBSD$

PORTNAME=   firefox
PORTVERSION=    38.7.1
CATEGORIES= www
MASTER_SITES=   MOZILLA/${PORTNAME:S|-i18n||}/releases/${DISTVERSION}esr/linux-i686/xpi \
        MOZILLA/${PORTNAME:S|-i18n||}/candidates/${DISTVERSION}esr-candidates/build1/linux-i686/xpi
PKGNAMEPREFIX=
PKGNAMESUFFIX=  -esr-i18n
DISTFILES=  ${FIREFOX_I18N_:S/$/.xpi/}
DIST_SUBDIR=    xpi/${DISTNAME}

MAINTAINER= gecko@FreeBSD.org
COMMENT=    Localized interface for Firefox

EXTRACT_DEPENDS=    zip:archivers/zip

USES=       zip:infozip gecko:firefox,build
USE_XPI=    firefox

NO_ARCH=    yes
USE_SUBMAKE=    yes

WDIR=   langpack-*@firefox.mozilla.org

XPI_DISTNAMES=  ${FIREFOX_I18N_}

PLIST?=     ${WRKDIR}/plist
PLISTF?=    ${WRKDIR}/plist_files

.include "${.CURDIR}/Makefile.option"
.include <bsd.port.pre.mk>

.ifndef WITHOUT_SWITCHER
RUN_DEPENDS+=   xpi-quick-locale-switcher>=0:www/xpi-quick-locale-switcher
.endif

.include "${.CURDIR}/Makefile.lang"

FIREFOX_I18N_?= ${FIREFOX_I18N}

.for dist in ${XPI_DISTNAMES}
XPI_ID_${dist}=     langpack-${dist}@firefox.mozilla.org
.endfor

pre-everything::
    @${ECHO_CMD}
    @${ECHO_CMD} "Please define FIREFOX_I18N_ALL to install all languages."
    @${ECHO_CMD}

do-extract:
    @${MKDIR} ${WRKSRC}
    @for lang in ${FIREFOX_I18N_}; do \
        if ! (${UNZIP_CMD} -qo ${_DISTDIR}/$$lang.xpi -d ${WRKSRC}/langpack-$$lang@firefox.mozilla.org);\
        then \
            exit 1; \
        fi; \
        cd ${WRKSRC}/langpack-$$lang@firefox.mozilla.org/; \
        ${FIND} -H -s * ! -type d | \
        ${SED} -e "s|^|lib/xpi/langpack-$$lang@firefox.mozilla.org/|" >> ${PLISTF}; \
    done
    ${CAT} ${PLISTF} | ${SORT} >> ${PLIST}

do-install:
    @${MKDIR} ${STAGEDIR}${XPI_LIBDIR}
    cd ${WRKSRC}; ${PAX} -rw . ${STAGEDIR}${XPI_LIBDIR}
    ${CHMOD} -R a+rX,go-w ${STAGEDIR}${XPI_LIBDIR}/${WDIR}/
    @for e in ${STAGEDIR}${XPI_LIBDIR}/${WDIR}; do \
        for _dir in ${XPI_LINKFARMS} ; do \
        ${LN} -sf $${_e##*/} ${STAGEDIR}$$_dir/ ${_Q} ; \
        done \
    done
    @${ECHO_CMD} '@exec ${INSTALL} -d ${XPI_SLDIRS_ALL:S,^${PREFIX},%D,}' ${_A}
    @${ECHO_CMD} '@exec for _dir in ${XPI_LINKFARMS} ; { \
        ${LN} -sf ${XPI_LIBDIR}/${WDIR} $$_dir/ ${_Q}; }' ${_A}
    @${ECHO_CMD} '@unexec for _dir in ${XPI_LINKFARMS}; { ${RM} -f $$_dir/${WDIR} ; }' ${_A}

post-patch:
    ${FIND} ${WRKSRC} -name install.rdf -print0 | \
        ${XARGS} -0L1 ${REINPLACE_CMD} -i '' -e '/<?xml/,$$!d'

list-langs:
    @fetch -qo- "https://ftp.mozilla.org/pub/mozilla.org/${PORTNAME:S|-i18n||}/releases/${PORTVERSION}esr/linux-i686/xpi"|\
        ${PERL} -ne 'if(/.*href="([a-zA-Z-]+).xpi.*/){print "$$1\n"}' |\
        ${AWK} 'BEGIN{ORS=" "}{print $$1}END{printf "\nNumber of languages: %d\n",NR}'

.include "${.CURDIR}/../xpi-adblock/Makefile.xpi"

.include <bsd.port.post.mk>