File: rules

package info (click to toggle)
opm-simulators 2024.10%2Bds-6
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 19,416 kB
  • sloc: cpp: 165,337; sh: 1,285; lisp: 1,108; python: 355; makefile: 24; awk: 10
file content (38 lines) | stat: -rwxr-xr-x 1,547 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
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS+=optimize=-lto

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

# 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

%:
	echo "ram in gb: $(free_ram), needed ram per thread: $(need_gb_ram_per_process), threads: $(parallel_procs)"
	dh $@ --max-parallel=$(parallel_procs)