File: rules

package info (click to toggle)
ns3 3.31%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 131,744 kB
  • sloc: cpp: 520,245; python: 415,675; ansic: 7,327; xml: 4,012; makefile: 2,088; sh: 825; javascript: 161; perl: 102
file content (98 lines) | stat: -rwxr-xr-x 3,413 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/make -f
export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

ifeq ($(DEB_HOST_GNU_CPU),mipsel)
  # Drop the debug symbols all together on mipsel to avoid OOM causing FTBFS
  export DEB_CFLAGS_MAINT_STRIP=-g
  export DEB_CXXFLAGS_MAINT_STRIP=-g
endif
LDFLAGS+=-Wl,--as-needed

# Define CFLAGS and friends to harden the build -- must come any addtion to these variables
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifeq ($(DEB_HOST_GNU_CPU),mipsel)
  # Further reduce the memory consumption on mipsel
  LDFLAGS += -Wl,--reduce-memory-overheads -Wl,--no-keep-memory
endif

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)

include /usr/share/dpkg/architecture.mk

# Reproducible Build wants us to use always the same date when building the documentation
include /usr/share/dpkg/pkg-info.mk
SPHINXOPTS := -D today=\"$(SOURCE_DATE_EPOCH)\"
SPHINXOPTS += -D html_last_updated_fmt=\"$(SOURCE_DATE_EPOCH)\"

%:
	dh $@ --with python3

override_dh_auto_build-indep:
	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 -f ns-3.*/doc/*/build/*/_static/jquery.js
	rm -f ns-3.*/doc/*/build/*/_static/underscore.js
	touch $@

override_dh_auto_configure:
	cd $(NS3_DIR) ; ./waf configure \
	           --prefix=/usr --enable-mpi -d release -o build-shared \
	           --libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	           --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_build-arch:
	####### build and install shared libraries, python bindings for default python.
	cd $(NS3_DIR) ; ./waf build $(BUILD_OPTION)

	cd ./$(NS3_DIR); ./waf install --destdir=../debian/tmp
	# delete test of modules but not libns3.${ver}-test.so which seems used
	# MQ: it seems that these test modules does not exist anymore in v3.27
	# MQ: so only remove them if they exist
	test -e debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/ && ls debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libns3*-*-test.so*|rm -fv
	# cp netanim-*/NetAnim debian/tmp/usr/bin
	# Install my own little script as a compiler
	cp debian/ns3++ debian/tmp/usr/bin
	chmod +x debian/tmp/usr/bin/ns3++
	# Install the upstream changelog as NEWS, as requested by the policy
	(cd ns-3.*; cp RELEASE_NOTES NEWS)
	
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:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	dh_compress -Xusr/share/doc/ns3/examples/  -Xusr/share/doc/ns3/manual/  -Xusr/share/doc/ns3/models/  -Xusr/share/doc/ns3/tutorial/
endif

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