File debian.rules of Package bctoolbox

#!/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 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"}')

# Fix compilation errors
export CFLAGS = $(shell echo "$$CFLAGS -Wno-error=maybe-uninitialized -Wno-error=unused-parameter")
export CXXFLAGS = $(shell echo "$$CXXFLAGS -Wno-error=maybe-uninitialized -Wno-error=unused-parameter")



%:
	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
	#find /usr/src/packages
	#
	# CMake cannot find Decaf and asks for variable Decaf_DIR
	#   -- Could NOT find Decaf (missing: Decaf_DIR)
	# Decaf is in:
	# /usr/lib/x86_64-linux-gnu/cmake/decaf
	# Should it be in?
	# /usr/share/decaf/cmake
	#
	#  -DENABLE_STATIC=OFF
	#  %if %{enable_tests} == 0
	#  -DENABLE_TESTS_COMPONENT=OFF \
	#  -DENABLE_UNIT_TESTS=OFF \
	#  %endif
	#  -DENABLE_STATIC=OFF \
	# 2024-01-27
	# other libraries require crypto.h , which is only created by ENABLE_OPENSSL
	# compilation of test code breaks compilation and is therefore disabled
	# tester code does not compile
	# use -DBUILD_SHARED_LIBS=YES to avoid creating static libraries
	#  -DENABLE_MBEDTLS=OFF \
	#  -DENABLE_OPENSSL=YES \
	cmake . -DCMAKE_BUILD_PARALLEL_LEVEL=$(jobsIget) \
	  -DDecaf_DIR=/usr/lib/x86_64-linux-gnu/cmake/decaf \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DENABLE_STRICT=OFF \
	  -DBUILD_SHARED_LIBS=YES \
	  -DENABLE_TESTS_COMPONENT=OFF \
	  -DENABLE_UNIT_TESTS=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_build:
	echo
	echo "--- Start override_dh_auto_build: ---"
	echo
	echo "--- Machine data we are building on ---"
	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 "--- Show files ---"
	find /usr/src/packages
	echo "--- End show files ---"
	echo
	cmake --build . -j $(jobsIget)
	echo
	echo "--- End override_dh_auto_build: ---"
	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_auto_install:
	echo
	echo "--- Start override_dh_auto_install: ---"
	echo
	make -j$(jobsIget) install DESTDIR=/usr/src/packages/BUILD/debian/tmp AM_UPDATE_INFO_DIR=no
	echo
	echo "--- End override_dh_auto_install: ---"
	echo



execute_after_dh_install:
	echo
	echo "--- Start execute_before_dh_auto_install: ---"
	echo
	echo "--- Show files ---"
	find /usr/src/packages/BUILD/debian/tmp
	echo "--- End show files ---"
	echo
	echo "--- End execute_before_dh_auto_install: ---"
	echo
openSUSE Build Service is sponsored by