blob: a541893a2e5770502945c3eff3e862e7aafd563a (
plain)
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
|
# $NetBSD: list-licenses.mk,v 1.1 2019/11/30 22:14:39 rillig Exp $
#
# list-licenses:
# Downloads the addon page of each language pack to determine the
# license.
#
# As of Firefox 70, the license information is not included in the
# .xpi files themselves, therefore this seemed to be the best
# alternative.
TOOL_DEPENDS+= curl-[0-9]*:../../www/curl
USE_TOOLS+= perl
# To declare WRKDIR; WRKSRC is still undefined.
.include "../../mk/bsd.prefs.mk"
list-licenses: .PHONY
.for locale in ${FIREFOX_LOCALES}
${WRKDIR}/${locale}.html:
${RUN} \
url="https://addons.mozilla.org/en-US/firefox/addon/langpack-${locale}@firefox.mozilla.org"; \
${PREFIX}/bin/curl -ksSL "$$url" > ${.TARGET}.tmp; \
${MV} ${.TARGET}.tmp ${.TARGET}
${WRKDIR}/${locale}.license: ${WRKDIR}/${locale}.html
# Cannot use sed here since nbsed cannot handle long lines.
# It gets caught in a seemingly endless loop.
${RUN} ${PREFIX}/bin/perl -ne 'print "$$1\n" if /class="AddonMoreInfo-license-link" href="([^"]*)"/' \
< ${WRKDIR}/${locale}.html > ${.TARGET}.tmp \
&& ${MV} ${.TARGET}.tmp ${.TARGET}
list-licenses: show-license-${locale}
show-license-${locale}: .PHONY ${WRKDIR}/${locale}.license
${RUN} printf '%s\t%s\n' ${locale:Q} "`${CAT} ${WRKDIR}/${locale}.license`"
.endfor
|