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
|
#!/usr/bin/make -f
# export DH_VERBOSE=1
# The magic debhelper rule
%:
dh $@ --buildsystem=cmake
export DEB_LDFLAGS_MAINT_PREPEND := -Wl,-z,defs -Wl,--as-needed
DESTDIR:=$(shell pwd)/debian/tmp
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
ARCH:=$(shell dpkg --print-architecture)
AUTOGENERATED:= libemos-dev.install libemos-dev.links libemos0d.install
LIBDIR:=/usr/lib/${DEB_HOST_MULTIARCH}
CMAKE_DIR:=debian/tmp/share/libemos/cmake
DO_TEST:=true
# Do tests on little-endian only for the moment;
ENDIAN:=$(shell dpkg-architecture -qDEB_BUILD_ARCH_ENDIAN)
FPIC_LIST:= "s390x amd64 ppc64el m68k sparc64"
ifneq (,$(findstring $(ARCH),$(FPIC_LIST)))
FPIC:= -fPIC
else
FPIC:= -fpic
endif
MCMODEL_FLAGS:=''
BUILD_FLAGS:=''
ifeq ($(ARCH), amd64)
MCMODEL_FLAGS:= -mcmodel=medium
endif
ifeq ($(ARCH), sparc64)
MCMODEL_FLAGS:= -mcmodel=medany
endif
ifeq ($(ARCH), ppc64el)
MCMODEL_FLAGS:= -mcmodel=large
endif
ifeq ($(ARCH), hurd-i386)
BUILD_FLAGS:= ' -D__GNU__'
endif
override_dh_auto_test:
# Need links for tests.
(cd bufrtables && sh ./links.sh)
$(ENDIAN)==little && dh_auto_test || echo "Tests disabled on bigendian systems for the moment"
override_dh_auto_clean:
find bufrtables -type l -delete
rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
dh_auto_clean
override_dh_auto_configure:
dh_auto_configure -- \
-Dgrib_api_BASE_DIR=/usr \
-DECBUILD_LOG_LEVEL=DEBUG \
-DENABLE_FFTW=ON \
-DENABLE_LITTLE_ENDIAN=$(LITTLE) \
-DCMAKE_INSTALL_PREFIX=${DESTDIR} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DDISABLE_OS_CHECK=ON \
-DMCMODEL_FLAGS=${MCMODEL_FLAGS} \
-DBUILD_FLAGS=${BUILD_FLAGS} \
-DFPIC=${FPIC} \
-DINSTALL_LIBDIR=${LIBDIR} \
-DINTERPOL_TABLES_PATH=/usr/share/emos \
-DBUFR_TABLES_PATH=/usr/share/emos/bufrtables \
-DTEST_BUFR_TABLES_PATH=${CURDIR}/bufrtables
for f in ${AUTOGENERATED} ; do \
sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%g' < debian/$$f.in > debian/$$f ; \
done
override_dh_auto_build:
dh_auto_build
# Need to be installed into debian/tmp before tests
cd obj-* && $(MAKE) install
# TODO: CHECK INTERPOL_TABLES_PATH is set correctly.
override_dh_auto_install:
cd obj-* && $(MAKE) install
for d in debian/tmp/bin/* ; do \
( chrpath -d $$d || echo "Ignoring non-ELF file errors") ; done
chrpath -d debian/tmp/lib/*.0d
(cd ${DESTDIR}/share/libemos/tables/bufrtables && sh ./links.sh)
# Now in libeccodes
rm -f debian/tmp/bin/bufr_filter
dh_auto_install
# Fix broken paths
cat ${CMAKE_DIR}/libemos-targets-release.cmake | \
sed -e 's%$${_IMPORT_PREFIX}/bin%/usr/bin%' | \
sed -e 's%$${_IMPORT_PREFIX}/lib%$(LIBDIR)%' > ${CMAKE_DIR}/tmp
mv ${CMAKE_DIR}/tmp ${CMAKE_DIR}/libemos-targets-release.cmake
# Change default from emos to emos_shared to link against shared libs in metview, etc.
grep -v LIBEMOS_SELF_LIBRARIES ${CMAKE_DIR}/libemos-config.cmake | \
sed -e 's%.*set( libemos_BASE_DIR.*%set( libemos_BASE_DIR /usr )%' > ${CMAKE_DIR}/tmp
mv ${CMAKE_DIR}/tmp ${CMAKE_DIR}/libemos-config.cmake
echo >> ${CMAKE_DIR}/libemos-config.cmake
echo "set( LIBEMOS_SELF_LIBRARIES "emos_shared" )" >> ${CMAKE_DIR}/libemos-config.cmake
|