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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
#!/usr/bin/make -f
#
# build script for GROMACS
PACKAGE := gromacs
include /usr/share/dpkg/architecture.mk
DEB_DISTRO ?= $(shell lsb_release -si)
DEB_VERSION ?= $(shell dpkg-parsechangelog -S version)
# add hardening flags, using dpkg-buildflags
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
#653916 and http://www.cmake.org/Bug/view.php?id=12928 and https://gitlab.kitware.com/cmake/cmake/-/issues/12928
CFLAGS += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)
# DEB_BUILD_OPTIONS boilerplate.
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g -Wall
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKE += -j$(NUMJOBS)
endif
# General configuration options used for all builds.
COMMON_CONFIG_PARAMS = \
$(CURDIR) \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_RULE_MESSAGES=OFF \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
-DCMAKE_SKIP_RPATH=ON \
-DGMX_EXTERNAL_ZLIB=ON \
-DGMX_USE_MUPARSER=EXTERNAL \
-DGMX_VERSION_STRING_OF_FORK="$(DEB_DISTRO)-$(DEB_VERSION)" \
-DGMX_GIT_VERSION_INFO=OFF \
-DGMX_HWLOC=ON
# Specific options for the MPI-enabled builds.
MPI_CONFIG_PARAMS = \
-DGMX_MPI=ON \
-DMPIEXEC="/usr/bin/mpiexec"
# For compatibility reasons, disable SIMD CPU optimizations EXCEPT
# for SSE4.1 on amd64, and NEON on arm64.
# For local compilations, set DEB_BUILD_OPTIONS=cpuopt for automatic
# detection of the best available option.
# See https://manual.gromacs.org/documentation/current/user-guide/mdrun-performance.html#intra-core-parallelization
# and https://manual.gromacs.org/documentation/current/install-guide/index.html#gmx-simd-support
ifeq (,$(findstring cpuopt,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_HOST_ARCH), amd64)
COMMON_CONFIG_PARAMS += -DGMX_SIMD=SSE4.1
else ifeq ($(DEB_HOST_ARCH), arm64)
COMMON_CONFIG_PARAMS += -DGMX_SIMD=ARM_NEON_ASIMD
else
COMMON_CONFIG_PARAMS += -DGMX_SIMD=None
endif
endif
# Include "gpu" in DEB_BUILD_OPTIONS to build GPU-accelerated binaries as well.
# This build option is not always well tested, please send comments.
# You must have the packages "nvidia-cuda-toolkit" and "nvidia-cuda-dev"
# installed. Those are not official build dependencies to keep the package in
# Debian main!
#
# If you use this option, it is strongly recommended that you also set
# DEB_BUILD_OPTIONS=cpuopt, assuming you are compiling and running on the same
# machine.
#
# Further details at
# https://manual.gromacs.org/documentation/current/user-guide/mdrun-performance.html#running-mdrun-with-gpus
GPU_CONFIG_PARAMS =
ifneq (,$(findstring gpu,$(DEB_BUILD_OPTIONS)))
GPU_CONFIG_PARAMS += -DGMX_GPU=ON
endif
# Improve display of build-time tests.
export GTEST_COLOR=no
export CTEST_OUTPUT_ON_FAILURE=1
#######################################################################
build: build-arch build-indep
build-arch: configure-stamp build-basic build-mpi
build-indep: build-manual
configure: configure-stamp
configure-stamp:
dh_testdir
(mkdir -p build/basic; cd build/basic; cmake \
$(COMMON_CONFIG_PARAMS) $(GPU_CONFIG_PARAMS) -DGMX_MPI=OFF -DGMX_INSTALL_LEGACY_API=ON)
(mkdir -p build/basic-dp; cd build/basic-dp; cmake \
$(COMMON_CONFIG_PARAMS) -DGMX_MPI=OFF -DGMX_DOUBLE=ON)
(mkdir -p build/mpi; cd build/mpi; CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx cmake \
$(COMMON_CONFIG_PARAMS) $(MPI_CONFIG_PARAMS) $(GPU_CONFIG_PARAMS) -DGMXAPI=ON -DGMX_PYTHON_PACKAGE=ON)
(mkdir -p build/mpi-dp; cd build/mpi-dp; CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx cmake \
$(COMMON_CONFIG_PARAMS) $(MPI_CONFIG_PARAMS) -DGMX_DOUBLE=ON)
touch $@
# Standard builds, in single and double precision.
build-basic: configure-stamp
dh_testdir
$(MAKE) -C build/basic
$(MAKE) -C build/basic-dp
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C build/basic tests
(cd build/basic; LD_LIBRARY_PATH=$(CURDIR)/build/basic/lib ctest -V)
$(MAKE) -C build/basic-dp tests
(cd build/basic-dp; LD_LIBRARY_PATH=$(CURDIR)/build/basic-dp/lib ctest -V)
endif
touch $@
# MPI-enabled builds. Separated from the build-basic target mostly for ease of testing.
build-mpi: configure-stamp
dh_testdir
LD_LIBRARY_PATH=$(CURDIR)/build/mpi/lib $(MAKE) -C build/mpi
$(MAKE) -C build/mpi-dp
# Testing the single precision build only is sufficient to exercise the MPI-specific tests.
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
# oversubscribe: https://bugs.debian.org/850229#51 (OMPI_... for OpenMPI <=4,
# PRTE_... for OpenMPI >=5)
# Applicable only to OpenMPI, but no-ops on MPICH architectures
LD_LIBRARY_PATH=$(CURDIR)/build/mpi/lib $(MAKE) -C build/mpi tests
(cd build/mpi ; LD_LIBRARY_PATH=$(CURDIR)/build/mpi/lib \
OMPI_MCA_rmaps_base_oversubscribe=1 \
PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe \
ctest -V)
endif
touch $@
# Documentation.
build-manual:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
dh_testdir
# Build speedy, stripped-down version just for documentation generation.
# Derived from (former) admin/build-docs.sh
(mkdir -p build/documentation ; cd build/documentation; \
LD_LIBRARY_PATH=$(CURDIR)/build/documentation/lib cmake $(CURDIR) \
-DCMAKE_BUILD_TYPE=Debug -DGMX_OPENMP=OFF -DGMX_SIMD=None -DGMXAPI=ON \
-DGMX_PYTHON_PACKAGE=ON -DGMX_GPU=OFF -DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_RULE_MESSAGES=OFF -DGMX_BUILD_MANUAL=ON -DGMX_BUILD_HELP=ON \
-DGMX_VERSION_STRING_OF_FORK="$(DEB_DISTRO)-$(DEB_VERSION)")
# Generate PDF
$(MAKE) manual -C build/documentation
# Generate man pages
$(MAKE) man -C build/documentation
# Generate HTML
$(MAKE) webpage -C build/documentation
endif
touch $@
# Rules in this target largely handle the executable and library packages and arch-indep data (but not documentation).
install: build-arch
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) -C build/mpi install DESTDIR=$(CURDIR)/debian/tmp
$(MAKE) -C build/mpi-dp install DESTDIR=$(CURDIR)/debian/tmp
$(MAKE) -C build/basic install DESTDIR=$(CURDIR)/debian/tmp
$(MAKE) -C build/basic-dp install DESTDIR=$(CURDIR)/debian/tmp
# workaround for OpenMPI 5.x RPATH bug, #1085509
chrpath -d $(CURDIR)/debian/tmp/usr/bin/gmx_mpi $(CURDIR)/debian/tmp/usr/bin/gmx_mpi_d
chrpath -d $(CURDIR)/debian/tmp/usr/lib/*/libgromacs_mpi*.so.*
# concatenate bash completions into a single file; not just "cat * >" because they don't end in newlines
perl -lne 'print' $(CURDIR)/debian/tmp/usr/bin/gmx-completion.bash \
$(CURDIR)/debian/tmp/usr/bin/gmx-completion-*.bash > \
$(CURDIR)/debian/tmp/usr/bin/gmx-completion-concat
# rename a pair of Perl scripts to drop the .pl extension (Policy 10.4)
mv $(CURDIR)/debian/tmp/usr/bin/demux.pl $(CURDIR)/debian/tmp/usr/bin/demux
mv $(CURDIR)/debian/tmp/usr/bin/xplor2gmx.pl $(CURDIR)/debian/tmp/usr/bin/xplor2gmx
dh_install -a
dh_installdocs -a
dh_installchangelogs -a
dh_installman -a
dh_bash-completion -a
dh_lintian -a
dh_link -a
binary-indep: build-arch build-indep install
dh_testdir -i
dh_testroot -i
dh_installdirs -i
dh_install -i
dh_installdocs -i
dh_installchangelogs -i
dh_installman -i
# dh_doxygen expects a different location of index.html, so perform its function manually.
-find $(CURDIR)/debian/gromacs-data/usr/share/doc/gromacs/html/doxygen/ -type f -a \( -name '*.md5' -o -name '*.map' \) -delete
rdfind -outputname /dev/null -makesymlinks true $(CURDIR)/debian/gromacs-data/usr/share/doc/
symlinks -r -s -c $(CURDIR)/debian/gromacs-data/usr/share/doc/
dh_bash-completion -i
dh_lintian -i
dh_link -i
dh_strip_nondeterminism -i
dh_compress -i -X.pdf
dh_fixperms -i
dh_missing -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary-arch: build-arch install
dh_testdir -a
dh_testroot -a
dh_installchangelogs -a
dh_installdocs -a
dh_strip_nondeterminism -a
dh_compress -a
dh_fixperms -a
dh_missing -a
dh_strip -A
dh_makeshlibs -a
dh_shlibdeps -plibgromacs10 -L libgromacs10 -l debian/libgromacs10/usr/lib
dh_shlibdeps -plibnblib-gmx0 -L libnblib-gmx0 -l debian/libnblib-gmx0/usr/lib:debian/libgromacs10/usr/lib
dh_shlibdeps -pgromacs -L libgromacs10 -l debian/libgromacs10/usr/lib:debian/gromacs/usr/lib
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
clean:
dh_testdir
dh_testroot
dh_clean build-basic build-mpi build-manual build/
py3clean admin docs
.PHONY: binary binary-arch binary-indep build clean install
|