File: rules

package info (click to toggle)
ns3 3.26%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 117,520 kB
  • ctags: 72,063
  • sloc: cpp: 462,724; python: 364,339; perl: 8,720; ansic: 7,153; xml: 3,401; makefile: 1,981; sh: 628
file content (83 lines) | stat: -rwxr-xr-x 3,404 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
79
80
81
82
83
#!/usr/bin/make -f
export DH_VERBOSE=1
LDFLAGS+=-Wl,--as-needed

TOPDIR=$(shell pwd)
NS3_DIR=$(shell ls -d ns-*)
PYBINDGENV_DIR=$(shell ls -d pybindgen-*)

# Build in parallel, unless there is less than 3GiB
MEMORY=$(shell awk '/MemTotal:/{print $$2}' /proc/meminfo)
CPU_CORES=$(shell nproc)
BUILD_OPTION=$(shell if [ $(MEMORY) -lt 3090252 ]; then echo "-j1"; else echo "-j$(CPU_CORES)"; fi)

# Reproducible Build wants us to use always the same date when building the documentation
LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
SPHINXOPTS := -D today=\"$(BUILD_DATE)\"
SPHINXOPTS += -D html_last_updated_fmt=\"$(BUILD_DATE)\"

%:
	dh $@ --with python2

build-indep: build-doc-stamp

build-doc-stamp:
	make html man -C ./$(NS3_DIR)/doc/manual/ SPHINXOPTS="$(SPHINXOPTS)"
	make html man -C ./$(NS3_DIR)/doc/models/ SPHINXOPTS="$(SPHINXOPTS)"
	make html man -C ./$(NS3_DIR)/doc/tutorial/ SPHINXOPTS="$(SPHINXOPTS)"
	rm ns-3.*/doc/*/build/*/_static/jquery.js
	rm ns-3.*/doc/*/build/*/_static/underscore.js
	touch $@

override_dh_auto_build:
	####### build and install shared libraries, python bindings for default python.
	./build.py --disable-netanim --enable-tests --build-options="$(BUILD_OPTION)" -- --prefix=/usr --enable-mpi -d release -o build-shared
	cd ./$(NS3_DIR);./waf install --destdir=../debian/tmp
	rm debian/tmp/usr/lib/libns3*-*-test.so* # delete test of modules but not libns3.${ver}-test.so which seems used
	# cp netanim-*/NetAnim debian/tmp/usr/bin
	# Fixup the installation of PyViz
	mv debian/tmp/usr/lib/python2.7/dist-packages/visualizer/visualizer/* debian/tmp/usr/lib/python2.7/dist-packages/visualizer/
	mv debian/tmp/usr/lib/python2.7/dist-packages/visualizer/src/visualizer/visualizer/* debian/tmp/usr/lib/python2.7/dist-packages/visualizer/
	rmdir debian/tmp/usr/lib/python2.7/dist-packages/visualizer/visualizer
	rm -rf debian/tmp/usr/lib/python2.7/dist-packages/visualizer/src
	mv debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/visualizer/plugins/* debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/
	mv debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/src/visualizer/visualizer/plugins/* debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/
	rm -rf debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/visualizer
	rm -rf debian/tmp/usr/lib/python2.7/dist-packages/visualizer/plugins/src
	# Install my own little script as a compiler
	cp debian/ns3++ debian/tmp/usr/bin
	chmod +x debian/tmp/usr/bin/ns3++
	
override_dh_auto_test:
	-cd ./$(NS3_DIR); ./test.py -v

override_dh_prep:
	#I install files here when build.
	#The upstream cannot work well for us.
	#I will remove this dir when dh_clean, surely.
	dh_prep -Xdebian/tmp
	
override_dh_python2:
	#### upstream now can only build for the default version of python.
	dh_python2 --no-guessing-versions

override_dh_installchangelogs:
	dh_installchangelogs ./$(NS3_DIR)/CHANGES.html

override_dh_auto_clean:
	#-sh ./debian/clean-tree.sh
	dh_auto_clean

override_dh_compress:
	dh_compress -Xusr/share/doc/ns3/examples/  -Xusr/share/doc/ns3/manual/  -Xusr/share/doc/ns3/models/  -Xusr/share/doc/ns3/tutorial/

override_dh_builddeb:
	dh_builddeb -- -Zxz

update-patches:
	cd debian/patches; \
	sed -i 's#ns-3.[0-9]*#$(NS3_DIR)#g' *.diff

get-orig-source:
	uscan --verbose --force-download