#!/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