File debian.rules of Package belle-sip

#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DIR_WHERE_FIRST_CMAKELISTS_DOT_TEXT_IS=buildstartshere

# Get some information about the machine we are building on:
export ARCHITECTURE=$(shell uname -m)
export numberOfProcessorsOnMachine=$(shell nproc)
export wantedJobs=$(shell echo "1.25*$(numberOfProcessorsOnMachine)" | bc -l)
export jobsIget=$(shell echo $(wantedJobs) | awk '{print int($$1+0.5)}')
export TOTAL_DISK = $(shell df -h --total | awk 'END{print $$2}')
export FREEMEM = $(shell free --mega)
export TOTAL_MEM = $(shell free --total --mega | xargs | awk '{print $$19"MB"}')
export TOTAL_RAM = $(shell free --total --mega | xargs | awk '{print $$8"MB"}')
export TOTAL_SWAP = $(shell free --total --mega | xargs | awk '{print $$15"MB"}')

export PRETTY_NAME=$(shell cat /etc/*-release | egrep "PRETTY_NAME" | cut -d = -f 2)

#ifeq ($(PRETTY_NAME),Raspbian)
#    export PLATFORM=Raspbian
#    export BUILDDIR=obj-arm-linux-gnueabihf
#    export LIBDIR=arm-linux-gnueabihf
#endif

ifeq ($(findstring Raspbian,$(PRETTY_NAME)),Raspbian)
    # Found
    export PLATFORM=Raspbian
    export BUILDDIR=obj-arm-linux-gnueabihf
    export LIBDIR=arm-linux-gnueabihf
else
    # Not found
    export PLATFORM=DebianOrUbuntu
    export BUILDDIR=obj-x86_64-linux-gnu
    export LIBDIR=x86_64-linux-gnu
endif

#
# To Fix:
# =======
#
# Is the following line from the SPEC file needed also in Ubuntu/Debian?
#
# chrpath -d %{buildroot}%{_bindir}/belle_sip_tester %{buildroot}%{_libdir}/%{soname}.so.%{sover}*
#

%:
	echo
	echo "----- Entering section % -----"
	echo
	# dh $@
	# dh $@ --buildsystem=cmake
	# dh $@ --buildsystem=cmake --builddirectory=$(DIR_WHERE_FIRST_CMAKELISTS_DOT_TEXT_IS) --parallel --max-parallel=$(jobsIget)
	dh $@ --buildsystem=cmake --parallel --max-parallel=$(jobsIget)
	echo
	echo "----- Exiting section % -----"
	echo
    


override_dh_auto_configure:
	echo
	echo "--- Start override_dh_auto_configure: ---"
	echo
	echo "--- Machine data we are building on ---"
	echo "ARCHITECTURE: $$ARCHITECTURE"
	echo "Total disk: $$TOTAL_DISK"
	echo "Output of free -h:"
	echo "$$FREEMEM" 
	echo "Total memory: $$TOTAL_MEM"
	echo "Total RAM: $$TOTAL_RAM"
	echo "Total SWAP: $$TOTAL_SWAP"
	echo "numberOfProcessorsOnMachine=$$numberOfProcessorsOnMachine"
	echo "wantedJobs=$$wantedJobs"
	echo "jobsIget=$$jobsIget"
	echo "--- End machine data we are building on ---"
	echo
	echo "--- List files ---"
	ls /usr/lib
	find /usr/src/packages
	echo "--- End list files ---"
	echo
	echo "Current directory:" #/usr/src/packages/BUILD
	echo "    $(shell pwd)"
	echo
	echo PRETTY_NAME=$(PRETTY_NAME)
	echo PLATFORM=$(PLATFORM)
	echo BUILDDIR=$(BUILDDIR)
	echo LIBDIR=$(LIBDIR)
	echo
	# To avoid error, we have to create directory Debian/Ubuntu:
	# /usr/src/packages/BUILD/obj-x86_64-linux-gnu
	# On Raspbian we have to create directory:
	# /usr/src/packages/BUILD/obj-arm-linux-gnueabihf
	mkdir -v $(BUILDDIR)
	# cmake -S /path/to/source-dir -B /path/to/build-dir -DCMAKE_VARIABLES_HERE=something
	cmake -S /usr/src/packages/BUILD/ -B /usr/src/packages/BUILD/$(BUILDDIR) \
	  -DCMAKE_BUILD_PARALLEL_LEVEL=$(jobsIget) \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DBUILD_SHARED_LIBS=YES \
	  -DENABLE_STRICT=OFF \
	  -DENABLE_STATIC=OFF
	echo
	echo "--- End override_dh_auto_configure: ---"
	echo
    


override_dh_update_autotools_config:
	echo
	echo "--- Start override_dh_update_autotools_config: ---"
	echo
	echo "Skipping running override_dh_update_autotools_config"
	echo
	echo "--- End override_dh_update_autotools_config: ---"
	echo
    


override_dh_autoreconf:
	echo
	echo "--- Start override_dh_autoreconf: ---"
	echo
	echo "Skipping running dh_autoreconf"
	echo
	echo "--- End override_dh_autoreconf: ---"
	echo
    


override_dh_auto_test:
	echo
	echo "--- Start override_dh_auto_test: ---"
	echo
	echo "Skipping running dh_auto_test"
	echo
	echo "--- End override_dh_auto_test: ---"
	echo
openSUSE Build Service is sponsored by