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
|
#!/usr/bin/make -f
export DH_VERBOSE=1
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
ARCH:=$(shell dpkg --print-architecture)
AUTOGENERATED:= libodb-api-0d.install libodb-api-dev.install libodb-api-dev.links
LIBDIR:=/usr/lib/${DEB_HOST_MULTIARCH}
DESTDIR:=$(shell pwd)/debian/tmp
BUILDDIR:=$(CURDIR)/debian/build
# The magic debhelper rule
%:
dh $@ --buildsystem=cmake --with=python3,fortran_mod --builddirectory=$(BUILDDIR)
ifeq ($(ARCH), hurd-i386)
AIO:= -DENABLE_AIO=OFF
endif
# For MPI tests
export OMPI_MCA_rmaps_base_oversubscribe=1
PY3DEFAULT:=$(shell py3versions --default)
PY3OTHERS:=`py3versions --supported | sed -e 's%${PY3DEFAULT}%%' `
CMAKE_DIR:=debian/tmp/usr/share
INC_DIR:=debian/tmp/usr/include
CMAKE_CFLAGS:= -DDISABLE_AIO=ON \
-DCMAKE_BUILD_TYPE=Release \
-DDISABLE_OS_CHECK=ON \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_EIGEN=ON \
-DENABLE_NETCDF=ON \
-DENABLE_FORTRAN=ON \
-DENABLE_PYTHON=ON \
-DENABLE_OMP=ON \
-DENABLE_ODB=ON \
-DENABLE_ODB_MPI=ON \
-DENABLE_ODB_API_SERVER_SIDE=ON
override_dh_auto_clean:
rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
dh_auto_clean
override_dh_auto_configure:
for f in ${AUTOGENERATED} ; do \
sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%g' < debian/$$f.in > debian/$$f ; \
done
dh_auto_configure -- ${CMAKE_CFLAGS} -DPYTHON_EXECUTABLE=/usr/bin/${PY3DEFAULT}
for f in ${PY3OTHERS} ; do \
dh_auto_configure -- ${CMAKE_CFLAGS} -DPYTHON_EXECUTABLE=/usr/bin/$$f \
--builddirectory=$(BUILDDIR)/$$d ; \
done
override_dh_auto_build:
$(MAKE) -C $(BUILDDIR) DESTDIR=$(DESTDIR)
for f in ${PY3OTHERS} ; do \
$(MAKE) -C $(BUILDDIR)/$$f DESTDIR=$(DESTDIR) ; \
done
override_dh_auto_test:
@echo "Skipping tests; need to disable downloads"
dh_auto_test || echo "Ignoring test failures"
override_dh_auto_install:
dh_auto_install
mv debian/tmp/usr/lib/python2.7 debian/tmp/usr/lib/$(PY3DEFAULT)
for f in ${PY3OTHERS} ; do \
$(MAKE) -C $(BUILDDIR)/$$f install DESTDIR=$(DESTDIR) ; \
mv debian/tmp/usr/lib/python2.7 debian/tmp/usr/lib/$$f ; \
done
for d in debian/tmp/usr/bin/* ; do \
( chrpath -d $$d || echo "Ignoring non-ELF file errors") ; done
chrpath -d debian/tmp/usr/lib/*.so*
# Fix broken paths
for d in ${CMAKE_DIR}/eckit/cmake/eckit-targets-release.cmake \
${CMAKE_DIR}/odb/cmake/odb-targets.cmake \
${CMAKE_DIR}/odb/cmake/odb-targets-release.cmake \
${CMAKE_DIR}/odb/cmake/odb-import.cmake \
${CMAKE_DIR}/odb_api/cmake/odb_api-targets-release.cmake ; do \
cat $$d | \
sed -e 's%$${_IMPORT_PREFIX}/bin%/usr/bin%' | \
sed -e 's%"/usr/bin/odb"%"/usr/bin/ecmwf_odb"%' | \
sed -e 's%"/usr/bin/qtar"%"/usr/bin/ecmwf_qtar"%' | \
sed -e 's%"=/bin/gzip"%"=/usr/bin/gzip"%' | \
sed -e 's%"=/bin/gunzip"%"=/usr/bin/gunzip"%' | \
sed -e 's%$${_IMPORT_PREFIX}/lib%$(LIBDIR)%' > ${CMAKE_DIR}/tmp ; \
mv ${CMAKE_DIR}/tmp $$d ; done
# Sanitise paths for bit reproducibility
for d in ${CMAKE_DIR}/odb_api/cmake/odb_api-config.cmake \
${CMAKE_DIR}/eckit/cmake/eckit-config.cmake \
${CMAKE_DIR}/metkit/cmake/metkit-config.cmake \
${CMAKE_DIR}/odb/cmake/odb-import.cmake \
${CMAKE_DIR}/odb_api_bundle/cmake/odb_api_bundle-config.cmake \
${CMAKE_DIR}/odb_tools/cmake/odb_tools-config.cmake \
${CMAKE_DIR}/odb/cmake//odb-config.cmake ; do \
cat $$d | sed -e 's%${CURDIR}%/build/odb-api%g' > ${CMAKE_DIR}/tmp ; \
mv ${CMAKE_DIR}/tmp $$d; \
done
for d in ${DESTDIR}/usr/lib/pkgconfig/odb.pc ; do \
cat $$d | \
sed -e 's%"=/bin/gzip"%"=/usr/bin/gzip"%' | \
sed -e 's%"=/bin/gunzip"%"=/usr/bin/gunzip"%' | \
sed -e 's%${CURDIR}%/build/odb-api%g' > ${DESTDIR}/tmpf ; \
mv ${DESTDIR}/tmpf $$d; \
done
# Delete files that break reproducibility, and refs from include files
rm -f ${INC_DIR}/odb_api/odb_api_ecbuild_config.h \
${INC_DIR}/eckit/eckit_ecbuild_config.h \
${INC_DIR}/metkit/metkit_ecbuild_config.h
grep -v BUILD_DIR ${INC_DIR}/ecml/ecml_config.h > ${INC_DIR}/tmp
mv ${INC_DIR}/tmp ${INC_DIR}/ecml/ecml_config.h
grep -v odb_api_ecbuild_config.h ${INC_DIR}/odb_api/odb_api_config.h | \
grep -v ODB_API_BINARY_DIR > ${INC_DIR}/tmp
mv ${INC_DIR}/tmp ${INC_DIR}/odb_api/odb_api_config.h
grep -v eckit_ecbuild_config.h ${INC_DIR}/eckit/eckit_config.h | \
grep -v ECKIT_BUILD_DIR > ${INC_DIR}/tmp
mv ${INC_DIR}/tmp ${INC_DIR}/eckit/eckit_config.h
grep -v metkit_ecbuild_config.h ${INC_DIR}/metkit/metkit_config.h > ${INC_DIR}/tmp
mv ${INC_DIR}/tmp ${INC_DIR}/metkit/metkit_config.h
# Avoid conflict with different odb ( #880890)
mv debian/tmp/usr/bin/odb debian/tmp/usr/bin/ecmwf_odb
# #903445: qtar conflicts with hxtools
mv debian/tmp/usr/bin/qtar debian/tmp/usr/bin/ecmwf_qtar
# Garbage
rm -rf debian/tmp/usr/lib/python3.*/python2.7
|