#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 include /usr/share/dpkg/architecture.mk OPM_DEBIAN_CMAKE_FLAGS = -DOPM_ENABLE_PYTHON=1 -DOPM_INSTALL_PYTHON=1 -DPYTHON_EXECUTABLE=/usr/bin/python3 -DOPM_INSTALL_COMPILED_PYTHON=OFF -DOPM_ENABLE_PYTHON_TESTS=0 -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON OPM_DEBIAN_MK ?= /usr/share/opm/opm-debian.mk ifneq ("$(wildcard $(OPM_DEBIAN_MK))","") include $(OPM_DEBIAN_MK) endif OPM_LIB_DEBIAN_MK ?= /usr/share/opm/opm-lib-debian.mk ifneq ("$(wildcard $(OPM_LIB_DEBIAN_MK))","") include $(OPM_LIB_DEBIAN_MK) # for makeshlibs endif # We have failing tests with LTO on riscv64. Hence we deactivate it. ifneq (,$(filter $(DEB_HOST_ARCH), riscv64)) # Deactivate lto on Debian and in OPM (it will try to activate LTO if we do not set OPM_INTERPROCEDURAL_OPTIMIZATION_TYPE to NONE export DEB_BUILD_MAINT_OPTIONS+=optimize=-lto export OPM_DEBIAN_CMAKE_FLAGS+=-DOPM_INTERPROCEDURAL_OPTIMIZATION_TYPE=NONE # The above is ignored. Hence exclude the buggy test from ctest OPM_CTEST_OPTIONS = -E reservoir_ncp_ecfv # Hopefully bring down build time, see https://lists.debian.org/debian-riscv/2025/09/msg00019.html export DEB_CXXFLAGS_MAINT_APPEND +=-gno-variable-location-views endif # require 7GB of RAM per make process. Yes, peak seems to be above 6 GB currently need_gb_ram_per_process=7 free_ram=$(shell free -g | sed -n 2p| sed "s/ \+/ /g"| cut -d " " -f 2) max_procs=$(shell echo "$(free_ram)/$(need_gb_ram_per_process)" | bc) parallel_procs=$(shell if test "$(max_procs)" -lt "1"; then echo 1; else echo "$(max_procs)"; fi) override_dh_install: # Manually delete runpath set by openmpi 5.0.5 # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085509 find debian/tmp/ \( -name \*.so -o -name \*.so.\* \) -print || true find debian/tmp/ \( -name \*.so -o -name \*.so.\* \) -exec chrpath -d '{}' \; || true find debian/tmp/usr/bin -type f -exec chrpath -d '{}' \; || true dh_install override_dh_auto_test: dh_auto_test -- ARGS\+="$(OPM_CTEST_OPTIONS)" %: echo "ram in gb: $(free_ram), needed ram per thread: $(need_gb_ram_per_process), threads: $(parallel_procs)" dh $@ --max-parallel=$(parallel_procs)