File: rules

package info (click to toggle)
dict-foldoc 20170105-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,412 kB
  • ctags: 6
  • sloc: perl: 85; makefile: 59; sh: 47
file content (78 lines) | stat: -rwxr-xr-x 2,029 bytes parent folder | download
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#! /usr/bin/make -f

FILES_TO_CLEAN  = foldoc.* newdict
DICTDIR = debian/dict-foldoc/usr/share/dictd
BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)

install_file = install -p -o root -g root -m 644

get-orig-source:
	set -ex; tempdir=$$(mktemp -d); \
	udate=$$(curl -s -I https://foldoc.org/Dictionary.txt| \
	sed -n 's/^[Ll]ast-[Mm]odified: //p'); \
	uver=$$(date -d "$$udate" +"%Y%m%d"); \
	fdir="$$tempdir/dict-foldoc-$$uver"; \
	mkdir "$$fdir"; \
	curl -s -f -o $$fdir/Dictionary https://foldoc.org/Dictionary.txt; \
	tar czf dict-foldoc-$$uver.tar.gz -C $$tempdir .; \
	rm -rf $$tempdir

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp

build-stamp:
	dh_testdir

	cat Dictionary debian/Dictionary.debian > newdict
	set -ex ; \
	uver=$$(dpkg-parsechangelog |\
	sed -rn -e 's/^Version: ([0-9]+)-.*$$/\1/p') ; \
	udate=$$(LC_ALL=C date -d "$$uver" +"%d %B %Y"); \
	perl debian/condense newdict | \
	  /usr/bin/dictfmt -f --headword-separator %%% --break-headwords \
	  --allchars -u http://foldoc.org/Dictionary.gz \
	  -s "The Free On-line Dictionary of Computing ($$udate)" \
	  --utf8 --without-time foldoc
	# Ensure deterministic mtime for dictzip to inherit
	touch --date='$(BUILD_DATE)' foldoc.dict
	/usr/bin/dictzip -v foldoc.dict

	touch $@

clean:
# Undoes the effect of `$(MAKE) -f debian/rules build'.
	dh_testdir
	dh_testroot
	rm -f $(FILES_TO_CLEAN)
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(install_file) foldoc.dict.dz $(DICTDIR)
	$(install_file) foldoc.index   $(DICTDIR)

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir Dictionary
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch
.PHONY: build build-arch build-indep clean \
	binary-indep binary-arch binary install