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
|
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
# don't fail on experimental builds
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))
# GNU LibreJS 5.0 compatible license string
# * See <https://www.gnu.org/software/librejs/free-your-javascript.html>
LICENSE = // @license magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt BSD-2-Clause
# generate documentation unless nodoc requested
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DOCS = README.html README.txt
endif
%:
dh $@
%.html: %.md
pandoc --from gfm-raw_html --to html --standalone --output $@ $<
%.txt: %.md
pandoc --from gfm-raw_html --to plain --output $@ $<
# build browser library and documentation
# * include plain uncompressed flavor, and minified with source-map
# * pre-compress minified files in gzip, and brotli formats
# * generate manpage from --help option of script unless nodoc requested
override_dh_auto_build: $(DOCS)
mkdir --parents debian/js
node bin/uglifyjs --self \
--mangle \
--beautify "preamble='$(LICENSE)'" --comments /Copyright/ \
--output debian/js/uglify.js
printf '\n// @license-end\n' >> debian/js/uglify.js
node bin/uglifyjs --self \
--source-map "base='$(CURDIR)',url='uglify.min.js.map'" \
--compress --mangle \
--output debian/js/uglify.min.js
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
find debian/js -name '*.min.js' -or -name '*.min.js.map' \
-exec pigz --force --keep -11 -- {} + \
-exec brotli --force --keep --best --suffix=.brotli -- {} +
endif
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
NODE_PATH=lib help2man \
--name="JavaScript parser, mangler/compressor and beautifier toolkit" \
--no-info \
--output=debian/uglifyjs.1 \
bin/uglifyjs \
|| { NODE_PATH=lib bin/uglifyjs --help; false; }
endif
override_dh_auto_test:
NODE_PATH=lib node test/mocha.js \
$(if $(DEB_SUITE_EXP),|| true)
# install core documentation with all binary packages
override_dh_installdocs:
dh_installdocs -- $(DOCS)
|