File debian.rules of Package mediastreamer2
#!/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
%:
echo
echo "----- Entering section % -----"
echo
# Template
# 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_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_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 "Source code incompatible with system package zxing:"
echo "Replace FindZxing.cmake"
echo find /usr/src/packages/BUILD/cmake -name FindZxing.cmake -delete
echo cp /usr/src/packages/SOURCES/FindZXing.cmake /usr/src/packages/BUILD/cmake/FindZxing.cmake
echo "--- List files ---"
echo find /usr/src/packages
echo find /usr/lib/x86_64-linux-gnu/cmake/ortp
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)
echo "CMake have problems to find ortp:"
find /usr -name ortpConfig.cmake 2>/dev/null
# cmake --trace-expand -S /path/to/source-dir -B /path/to/build-dir -DCMAKE_VARIABLES_HERE=something
# -DCMAKE_PREFIX_PATH="$$CMAKE_PREFIX_PATH;/usr/lib/$(LIBDIR)/cmake/ortp" \
# -Dortp_DIR="/usr/lib/$(LIBDIR)/cmake/ortp" \
cmake -S /usr/src/packages/BUILD/ -B /usr/src/packages/BUILD/$(BUILDDIR) \
-DCMAKE_BUILD_PARALLEL_LEVEL=$(jobsIget) \
-DCMAKE_MODULE_PATH="$$CMAKE_MODULE_PATH;/usr/src/packages/SOURCES" \
-DCMAKE_INSTALL_LIBDIR=lib/$(LIBDIR) \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=YES \
-DENABLE_STRICT=OFF \
-DENABLE_STATIC=OFF \
-DENABLE_QT_GL=ON \
-DENABLE_QRCODE=OFF
echo
echo "--- End override_dh_auto_configure: ---"
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
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info