#!/usr/bin/make -f include /usr/share/dpkg/pkg-info.mk export DH_VERBOSE = 1 SCONS=scons %: dh $@ SCONS_COMPILE_FLAGS= \ --ssl=SSL \ --use-sasl-client \ --sharedclient \ --disable-warnings-as-errors \ --c++11=on \ CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" \ CFLAGS="$(CFLAGS) $(CPPFLAGS)" \ LINKFLAGS="$(LDFLAGS)" # Set _DEFAULT_SOURCE to use the system's timegm(3). The vendored timegm() # implementation is buggy under gcc-7. SCONS_COMPILE_FLAGS += CPPDEFINES="_DEFAULT_SOURCE" ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) SCONS_COMPILE_FLAGS += -j $(NUMJOBS) endif BACKUP= \ src/third_party/jsoncpp \ src/third_party/gtest-1.7.0/src \ src/third_party/gtest-1.7.0/include override_dh_auto_build: # Backup directories contained sources that should not be used. set -e ; for i in $(BACKUP); do \ if [ ! -d "$$i".backup ]; then mv -v "$$i" "$$i".backup; fi ; \ done $(SCONS) --prefix=/usr $(SCONS_COMPILE_FLAGS) ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: # The following line perform unit tests only as integration and examples # tests are not functional without a working mongodb instance. $(SCONS) unit $(SCONS_COMPILE_FLAGS) endif override_dh_auto_clean: dh_auto_clean $(SCONS) --clean --disable-warnings-as-errors $(RM) -r build tmp $(RM) `find -name "*.pyc"` set -e ; for i in $(BACKUP); do \ if [ -d "$$i".backup ]; then rm -fr "$$i"; mv -v -f "$$i".backup "$$i"; fi ; \ done override_dh_install-arch: dh_install # Move generated header files to the arch-specific include path install -d "$(CURDIR)/debian/libmongoclient-dev/usr/include/$${DEB_HOST_MULTIARCH}/mongo" mv $(CURDIR)/debian/libmongoclient-dev/usr/include/mongo/config.h \ $(CURDIR)/debian/libmongoclient-dev/usr/include/mongo/version.h \ "$(CURDIR)/debian/libmongoclient-dev/usr/include/$${DEB_HOST_MULTIARCH}/mongo" override_dh_install-indep: override_dh_auto_install: $(SCONS) install --prefix=$(CURDIR)/tmp $(SCONS_COMPILE_FLAGS) override_dh_makeshlibs: dh_makeshlibs -V