#!/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 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)