| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# resolve DEB_VERSION |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
|
| 6 |
ESLINT = eslint |
| 7 |
# normalize output with TAP where possible unless terse requested |
| 8 |
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) |
| 9 |
ESLINT += --format tap |
| 10 |
else |
| 11 |
ESLINT += --format unix |
| 12 |
endif |
| 13 |
|
| 14 |
STEM = rdflib |
| 15 |
UGLIFY_SOURCES = lib/index.js $(filter-out lib/index.js,$(wildcard lib/*.js)) |
| 16 |
|
| 17 |
override_dh_auto_build: debian/js/$(STEM).min.js.gz |
| 18 |
|
| 19 |
lib/index.js: src/index.js |
| 20 |
babeljs src -d lib |
| 21 |
|
| 22 |
debian/js/$(STEM).js: lib/index.js |
| 23 |
mkdir -p debian/js |
| 24 |
cat $(UGLIFY_SOURCES) > debian/js/$(STEM).js |
| 25 |
|
| 26 |
# TODO: enable mocha test when chai-things is in Debian |
| 27 |
# TODO: check spec when node-arrayify-stream and node-streamify-stream are in Debian |
| 28 |
override_dh_auto_test: |
| 29 |
$(ESLINT) src perf test spec |
| 30 |
# standard Xqueue |
| 31 |
tape Xqueue/test/*.js |
| 32 |
# mocha |
| 33 |
# rdf-test-suite spec/parser.js http://w3c.github.io/rdf-tests/turtle/manifest.ttl -i '{ \"format\": \"turtle\" }' -c .rdf-test-suite-cache/ |
| 34 |
# rdf-test-suite spec/parser.js http://w3c.github.io/rdf-tests/ntriples/manifest.ttl -i '{ \"format\": \"n-triples\" }' -c .rdf-test-suite-cache/ |
| 35 |
# rdf-test-suite spec/parser.js http://w3c.github.io/rdf-tests/nquads/manifest.ttl -i '{ \"format\": \"n-quads\" }' -c .rdf-test-suite-cache/ |
| 36 |
# rdf-test-suite spec/parser.js http://w3c.github.io/rdf-tests/trig/manifest.ttl -i '{ \"format\": \"trig\" }' -c .rdf-test-suite-cache/ |
| 37 |
|
| 38 |
override_dh_gencontrol: |
| 39 |
dh_gencontrol -- \ |
| 40 |
-V"queue:VERSION=$(shell jq --raw-output .version < Xqueue/package.json)~$(DEB_VERSION)" \ |
| 41 |
-V"types:VERSION=$(shell jq --raw-output .version < Xtypes/package.json)~$(DEB_VERSION)" |
| 42 |
|
| 43 |
# optimize JavaScript for browser use |
| 44 |
# * include source-map using upstream intermediary |
| 45 |
debian/js/%.min.js: debian/js/%.js |
| 46 |
uglifyjs --compress --mangle --comments \ |
| 47 |
--source-map "base='$(abspath $(dir $@))',url='$(notdir $@).map'" \ |
| 48 |
--output debian/js/$(STEM).min.js \ |
| 49 |
-- $(UGLIFY_SOURCES) |
| 50 |
|
| 51 |
# pre-compress for browser use |
| 52 |
%.gz: % |
| 53 |
pigz --force --keep -11 -- $< |
| 54 |
brotli --force --keep --best --suffix=.brotli -- $< |
| 55 |
|
| 56 |
%: |
| 57 |
dh $@ |
| 58 |
|
| 59 |
.SECONDARY: |