File: rules

package info (click to toggle)
opm-simulators 2025.10%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 21,552 kB
  • sloc: cpp: 193,037; sh: 1,807; python: 1,704; lisp: 1,108; makefile: 31; awk: 10
file content (51 lines) | stat: -rwxr-xr-x 2,242 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/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)