| 1 |
|
| 2 |
include /usr/share/dpkg/pkg-info.mk |
| 3 |
|
| 4 |
PKGS := $(shell dh_listpackages) |
| 5 |
|
| 6 |
BUILDS := builds/moment-timezone-with-data.js \ |
| 7 |
builds/moment-timezone-with-data-1970-2030.js \ |
| 8 |
builds/moment-timezone-with-data-2012-2022.js \ |
| 9 |
builds/moment-timezone-with-data-10-year-range.js |
| 10 |
|
| 11 |
TARGETS := $(patsubst %.js,%.min.js,$(BUILDS)) \ |
| 12 |
moment-timezone.min.js \ |
| 13 |
moment-timezone-utils.min.js |
| 14 |
|
| 15 |
|
| 16 |
TZVER := $(shell grep -m1 -Po '^# version \K\w+$$' /usr/share/zoneinfo/tzdata.zi) |
| 17 |
|
| 18 |
ifeq (,$(TZVER)) |
| 19 |
$(error Could not find tzdata version in /usr/share/zoneinfo/tzdata.zi) |
| 20 |
endif |
| 21 |
|
| 22 |
BUILT_USING_PKGS := tzdata-legacy |
| 23 |
BUILT_USING_VAR := $(shell \ |
| 24 |
dpkg-query -f='$${source:Package} (= $${source:Version}), ' \ |
| 25 |
-W $(BUILT_USING_PKGS)) |
| 26 |
|
| 27 |
all: binary |
| 28 |
%: |
| 29 |
dh $@ |
| 30 |
|
| 31 |
execute_before_dh_auto_build: |
| 32 |
|
| 33 |
|
| 34 |
mkdir -p data/packed |
| 35 |
echo '{ "version": "$(TZVER)", "zones": [], "links": [] }' > \ |
| 36 |
data/packed/latest.json |
| 37 |
|
| 38 |
execute_before_dh_gencontrol: |
| 39 |
|
| 40 |
for pkg in $(PKGS); do \ |
| 41 |
echo 'misc:Built-Using=$(BUILT_USING_VAR)' >> debian/$${pkg}.substvars; \ |
| 42 |
done |
| 43 |
|
| 44 |
override_dh_auto_build: $(TARGETS) |
| 45 |
|
| 46 |
execute_before_dh_auto_test: tests/zones/zulu.js |
| 47 |
|
| 48 |
override_dh_auto_test: |
| 49 |
grunt nodeunit |
| 50 |
tsc --project ./typing-tests |
| 51 |
|
| 52 |
execute_after_dh_auto_clean: |
| 53 |
rm -rf temp/ |
| 54 |
rm -rf data/packed/* |
| 55 |
rm -rf data/unpacked/* |
| 56 |
rm -rf data/meta/* |
| 57 |
rm -rf tests/zones/* tests/countries/* |
| 58 |
|
| 59 |
%/latest.json: %/$(TZVER).json |
| 60 |
ln -sfr $< $@ |
| 61 |
|
| 62 |
temp/download/$(TZVER)/NEWS: |
| 63 |
mkdir -p temp/download/$(TZVER) |
| 64 |
ln -s /usr/share/zoneinfo/*.tab temp/download/$(TZVER)/ |
| 65 |
printf "\nRelease %s - \n" "$(TZVER)" > temp/download/$(TZVER)/NEWS |
| 66 |
|
| 67 |
data/meta/$(TZVER).json: temp/download/$(TZVER)/NEWS |
| 68 |
grunt data-meta:$(TZVER) |
| 69 |
|
| 70 |
data/unpacked/$(TZVER).json: data/meta/$(TZVER).json |
| 71 |
mkdir -p temp/zic/$(TZVER) temp/zdump/$(TZVER) |
| 72 |
cp -RL /usr/share/zoneinfo/[A-Z]* temp/zic/$(TZVER)/ |
| 73 |
|
| 74 |
rm -f temp/zic/$(TZVER)/Factory |
| 75 |
grunt data-zdump:$(TZVER) |
| 76 |
grunt data-collect:$(TZVER) |
| 77 |
grunt data-dedupe:$(TZVER) |
| 78 |
|
| 79 |
data/packed/$(TZVER).json: data/unpacked/$(TZVER).json |
| 80 |
grunt data-pack:$(TZVER) |
| 81 |
|
| 82 |
$(BUILDS): data/meta/latest.json data/packed/latest.json \ |
| 83 |
data/unpacked/latest.json moment-timezone.js |
| 84 |
grunt build |
| 85 |
|
| 86 |
builds/moment-timezone.min.js: moment-timezone.js |
| 87 |
uglifyjs $< -o $@ |
| 88 |
|
| 89 |
%.min.js: %.js |
| 90 |
uglifyjs $< -o $@ |
| 91 |
|
| 92 |
tests/zones/zulu.js tests/countries/countries.js: data/packed/latest.json \ |
| 93 |
temp/collect/latest.json |
| 94 |
grunt data-tests |