File: rules

package info (click to toggle)
ns3 3.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 95,192 kB
  • ctags: 56,763
  • sloc: cpp: 324,361; python: 291,824; perl: 8,720; ansic: 2,097; xml: 2,000; makefile: 1,447; sh: 458; cs: 89
file content (102 lines) | stat: -rwxr-xr-x 3,281 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
99
100
101
102
#!/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-*)
REFTRACE_DIR=$(shell ls -d ns-*-ref-traces)
NSC_DIR=$(shell ls -d nsc-*)

RELEASE=debug

###check system memory, if it is less than 3GiB, use "-j1" when build
MEMORY=$(shell awk '/MemTotal:/{print $$2}' /proc/meminfo)
BUILD_OPTION=$(shell if [ $(MEMORY) -lt 3090252 ]; then echo "-j1"; fi)
CPU_CORES=$(shell nproc)
BUILD_OPTION_OPTIPNG=$(shell echo "-j$(CPU_CORES)")

%:
	dh $@ --with python2

build-indep: build-doc-stamp build-doxygen-stamp optimize-doc-size-stamp

optimize-doc-size-stamp: build-doc-stamp build-doxygen-stamp
	sh debian/duplicate-files.sh ns-3.*/doc/html
	make $(BUILD_OPTION_OPTIPNG) -f debian/optipng.mk
	touch $@

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

build-doxygen-stamp: build-shared
	cd $(NS3_DIR); ./waf --doxygen
	touch $@

override_dh_auto_configure:
	#cp ./debian/upstream-back/build.config ./.config
	##############################################
	# build and copy waf
	cd debian/waf-1.7; ./configure; cp waf $(TOPDIR)/$(NS3_DIR); make distclean
	cd debian/waf-1.6; ./configure; cp waf $(TOPDIR)/$(PYBINDGENV_DIR); make distclean

override_dh_auto_build: build-static build-shared
	sed -i 's/-Wl,-Bdynamic//g' debian/tmp/usr/lib/pkgconfig/*.pc

build-static:
	######	build and install static libraries
	./build.py --disable-netanim --build-options="$(BUILD_OPTION)" -- --prefix=/usr --enable-static --enable-mpi -d release -o build-static
	cd ./$(NS3_DIR);./waf install --destdir=../debian/tmp

build-shared: build-static
	####### 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
	
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_auto_install:
	# they are installed in auto_build

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_strip:
	dh_strip -plibns3-3 --dbg-package=libns3-3-dbg 
	dh_strip -ppython-ns3 --dbg-package=python-ns3-dbg
	dh_strip

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

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

override_dh_builddeb:
	dh_builddeb -- -Zxz

dfsg:
	for i in `find -name waf`;do \
		if [ "$$(stat --format='%s' $$i)" -gt 10000 ];then rm -f $$i; fi;\
	done
	UP_V=$$(ls -d ns-3.*| cut -d '-' -f2); \
	DIR_NAME=$$(pwd |xargs basename);\
	cd ..;\
	tar --exclude-vcs --exclude=debian --exclude=.pc -cJf ns3_$${UP_V}+dfsg.orig.tar.xz $${DIR_NAME}