#!/usr/bin/make -f include /usr/share/dpkg/pkg-info.mk BUILDS := builds/moment-timezone-with-data.js \ builds/moment-timezone-with-data-1970-2030.js \ builds/moment-timezone-with-data-2012-2022.js \ builds/moment-timezone-with-data-10-year-range.js TARGETS := $(patsubst %.js,%.min.js,$(BUILDS)) \ moment-timezone.min.js \ moment-timezone-utils.min.js # get TZVER from tzdata TZVER := $(shell grep -m1 -Po '^# version \K\w+$$' /usr/share/zoneinfo/tzdata.zi) ifeq (,$(TZVER)) $(error Could not find tzdata version in /usr/share/zoneinfo/tzdata.zi) endif BUILT_USING_PKGS := tzdata-legacy BUILT_USING_VAR := $(shell \ dpkg-query -f='$${source:Package} (= $${source:Version}), ' \ -W $(BUILT_USING_PKGS)) all: binary %: dh $@ execute_before_dh_auto_build: # Bootstrap the build: a data/packed/latest.json needs to # exist with the right tzdata version and it is later rebuilt. mkdir -p data/packed echo '{ "version": "$(TZVER)", "zones": [], "links": [] }' > \ data/packed/latest.json execute_before_dh_gencontrol: # Generate substvars. echo 'misc:Built-Using=$(BUILT_USING_VAR)' >> debian/substvars override_dh_auto_build: $(TARGETS) execute_before_dh_auto_test: tests/zones/zulu.js override_dh_auto_test: grunt nodeunit tsc --project ./typing-tests execute_after_dh_auto_clean: rm -rf temp/ rm -rf data/packed/* rm -rf data/unpacked/* rm -rf data/meta/* rm -rf tests/zones/* tests/countries/* %/latest.json: %/$(TZVER).json ln -sfr $< $@ temp/download/$(TZVER)/NEWS: mkdir -p temp/download/$(TZVER) ln -s /usr/share/zoneinfo/*.tab temp/download/$(TZVER)/ zcat /usr/share/doc/tzdata/changelog.gz > temp/download/$(TZVER)/NEWS data/meta/$(TZVER).json: temp/download/$(TZVER)/NEWS grunt data-meta:$(TZVER) data/unpacked/$(TZVER).json: data/meta/$(TZVER).json mkdir -p temp/zic/$(TZVER) temp/zdump/$(TZVER) cp -RL /usr/share/zoneinfo/[A-Z]* temp/zic/$(TZVER)/ # Not supported. rm -f temp/zic/$(TZVER)/Factory grunt data-zdump:$(TZVER) grunt data-collect:$(TZVER) grunt data-dedupe:$(TZVER) data/packed/$(TZVER).json: data/unpacked/$(TZVER).json grunt data-pack:$(TZVER) $(BUILDS): data/meta/latest.json data/packed/latest.json \ data/unpacked/latest.json moment-timezone.js grunt build builds/moment-timezone.min.js: moment-timezone.js uglifyjs $< -o $@ %.min.js: %.js uglifyjs $< -o $@ tests/zones/zulu.js tests/countries/countries.js: data/packed/latest.json \ temp/collect/latest.json grunt data-tests