File: rules

package info (click to toggle)
nim 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 290,936 kB
  • ctags: 1,049,726
  • sloc: sh: 7,408; ansic: 1,464; makefile: 358; objc: 224; asm: 199; xml: 129; java: 56; pascal: 32; python: 20
file content (76 lines) | stat: -rwxr-xr-x 3,287 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
#!/usr/bin/make -f

export DH_VERBOSE=1
include /usr/share/dpkg/default.mk

platform_tr = $(shell { grep '^$(1)\b' debian/platforms.table || echo '	unsupported:$(1)'; } | cut -f2)

NIMFLAGS = $(addprefix --passC:,$(CPPFLAGS)) $(addprefix --passC:,$(CFLAGS)) $(addprefix --passL:,$(LDFLAGS))
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
	# work around https://github.com/nim-lang/Nim/issues/3165
	NIMFLAGS += --parallelBuild:1
endif

# TODO: remove this when https://github.com/nim-lang/Nim/issues/3506 is fixed
EXTRA_KOCHFLAGS = -p:. -p:lib/packages/docutils

%:
	dh $@

override_dh_auto_build:
	$(MAKE) -f makefile -j4 myos=$(call platform_tr,$(DEB_HOST_ARCH_OS)) mycpu=$(call platform_tr,$(DEB_HOST_ARCH_CPU))
	./bin/nim c $(NIMFLAGS) koch
	# Build until convergence; we must do this here, not dh_auto_test, to pick up
	# any changes in debian/patches. see also https://github.com/nim-lang/csources/issues/12
	echo "running koch boot"
	PATH=./bin/:$$PATH ./koch boot -d:release $(EXTRA_KOCHFLAGS) $(NIMFLAGS)
	#PATH=./bin/:$$PATH ./koch web
	echo "running koch web to generate docs into doc/html"
	./koch web --onlyDocs
	echo "running koch tools to build nimble, nimsuggest, nimgrep"
	./koch tools
	echo "generating manpages"
	help2man --name="Nim Language Compiler" -s1 -N --version-string="$(DEB_VERSION)" -i debian/nim.h2m -o debian/nim.1 ./bin/nim
	help2man --name="Nimsuggest"            -s1 -N --version-string="$(DEB_VERSION)" -i debian/nim.h2m -o debian/nimsuggest.1 ./bin/nimsuggest
	help2man --name="Nimgrep"               -s1 -N --version-string="$(DEB_VERSION)" -i debian/nim.h2m -o debian/nimgrep.1 ./bin/nimgrep
	PATH=./bin/:$$PATH help2man --name="Nim Package Installer" -s1 -N --version-string="$(DEB_VERSION)" -i debian/nim.h2m -o debian/nimble.1 ./bin/nimble
	echo "running koch distrohelper to generate install.sh"
	./koch distrohelper

override_dh_auto_install:
	echo "running install.sh to populate debian/tmp"
	./install.sh debian/tmp
	for fn in nimble nimsuggest nimgrep; do cp ./bin/$$fn debian/tmp/nim/bin/; done
	cp -a doc/html debian/html  # Install docs. There is no version number in the path.
	find debian/html -name '*.idx' -delete
	ln -sf manual.html debian/html/index.html

override_dh_auto_test:
	if [ -f compiler/nim2 ]; then cmp ./bin/nim compiler/nim2; else cmp ./bin/nim compiler/nim1; fi
	# TODO: do this with autopkgtest instead; it requires libsqlite3-0 and nodejs
	#PATH=./bin:$$PATH ./koch test

override_dh_auto_clean:
	rm -f ./koch tools/nimweb tools/niminst/niminst compiler/nim compiler/nim0 compiler/nim1 compiler/nim2
	rm -rf bin rnimcache
	rm -rf web/upload/
	# TODO: use this instead when https://github.com/nim-lang/Nim/issues/2127 is fixed
	#PATH=./bin:$$PATH ./koch clean
	find . -name nimcache \
		-prune -execdir rm -rf nimcache \;
	find . -name '*.o' -not -name 'koch_icon.o' -and -not -name 'nim_icon.o' \
		-delete -print
	find doc -name '*.idx' -delete -print
	find doc -name '*.html' -delete -print
	find examples lib tests -type f -executable -and -not -name '*.nim' \
		-delete -print
	rm -f tests/dll/libnimrtl.dylib
	rm -f testament.db testresults.*

override_dh_installdocs:
	dh_installdocs -Xcopying.txt

override_dh_clean:
	dh_clean
	rm -f debian/nim.1 debian/nimble.1 debian/nimgrep.1 debian/nimsuggest.1
	rm -rf debian/html