#!/usr/bin/make -f export DH_VERBOSE=1 DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk # To enable all, uncomment following line # DEB_BUILD_MAINT_OPTIONS:= hardening=+all,-pie CXXFLAGS:= -fPIC $(shell dpkg-buildflags --get CXXFLAGS) # -std=c++14 # CFLAGS:= -fPIC $(shell dpkg-buildflags --get CFLAGS) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Set for build reproducibility LC_ALL=C export LC_ALL LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) CMAKEDIR:=debian/tmp/$(LIBDIR)/cmake/magics # Fixes for 32-bit archss ARCH_32BIT:= i386 armel armhf mipsel hppa hurd-i386 m68k powerpc sh4 x32 DO_ODB:= $(if $(filter $(DEB_TARGET_ARCH), $(ARCH_32BIT)),OFF,ON) # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 %: dh $@ --with-buildsystem=ecbuild export extra_flags += \ -DBUILD_SITE=debian \ -DENABLE_LIBGD=1 \ -DHAVE_BOOST=1 \ -DENABLE_ODB=$(DO_ODB) \ -DENABLE_EFAS=1 \ -DHAVE_DLFCN_H=1 \ -DHAVE_INTTYPES_H=1 \ -DHAVE_LIBEXPAT=1 \ -DHAVE_LIBPROJ=1 \ -DHAVE_LIBPTHREAD=1 \ -DHAVE_LIBZ=1 \ -DHAVE_MEMORY_H=1 \ -DHAVE_STDINT_H=1 \ -DHAVE_STDLIB_H=1 \ -DHAVE_STRINGS_H=1 \ -DHAVE_STRING_H=1 \ -DHAVE_SYS_STAT_H=1 \ -DHAVE_STS_TYPES_H=1 \ -DHAVE_UNISTD_H=1 \ -DMAGICS_ALLHEADERS=1 \ -DMAGICS_GRIB=1 \ -DMAGICS_JSON=1 \ -DMAGICS_GIF=1 \ -DMAGICS_GIF_ANIMATED=1 \ -DMAGICS_TIFF=1 \ -DMAGICS_TTF=1 \ -DMAGICS_TTF_PATH="share/magics/ttf/" \ -DMAGICS_SITE="debian" \ -DMAGICS_THREADS=1 \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBUILD_DOCUMENTATION=ON \ -DENABLE_FORTRAN=ON \ -DENABLE_LARGE_FILE_SUPPORT=ON \ -DBUILD_EXAMPLES=ON \ -DBUILD_SHARED_LIBS=ON \ -DENABLE_TESTS=ON \ -DENABLE_GEOTIFF=ON \ -DGEOTIFF_INCLUDE_DIR=/usr/include/geotiff \ -DENABLE_RPATHS=OFF \ -DENABLE_CAIRO=ON \ -DENABLE_BUFR=ON \ -DENABLE_GRIB=ON \ -DENABLE_METVIEW=ON \ -DENABLE_NETCDF=ON \ -DCMAKE_C_FLAGS='$(CFLAGS) ' \ -DCMAKE_CXX_FLAGS='$(CXXFLAGS) -I/usr/include/terralib -I/usr/include/terralib/kernel -I/usr/include/geotiff' \ -DMAGICS_EXTRA_LIBRARIES='-lterralib -lgd -lemosR64' export LD_LIBRARY_PATH:=$(CURDIR)/debian/tmp/usr/lib:$(LD_LIBRARY_PATH) override_dh_auto_clean: # remove Makefile: it attempts a Docker build from git ... rm -f Makefile rm -rf debian/build-py* build/*x rm -f bin/magjsonx bin/magmlx bin/metgramx find . -type l -delete find . -name '.DS_Store' -delete rm -f src/params/*.h src/decoders/*Attributes.h rm -rf share/magics/ttf src/terralib debian/build src/boost override_dh_auto_configure: dh_auto_configure -- $(extra_flags) # link for font for tesing. mkdir -p share/fonts/truetype/ttf-dejavu/ ln -sf /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf share/fonts/truetype/ttf-dejavu/ # Link terralib [ -e src/terralib ] || ln -sf /usr/include/terralib src/terralib override_dh_auto_test check: # echo "Tests disabled; see README-testfailures.txt for details" #(ulimit -s 8192; export PYTHONPATH=$(CURDIR)/debian/build-py3/python/Magics ; \ # export MAGPLUS_HOME=$(CURDIR) ; $(MAKE) -C debian/build-py3 check ) override_dh_auto_install: dh_auto_install # sed -i -e 's%$${_IMPORT_PREFIX}/${LIBDIR}%${LIBDIR}%g' $(CMAKEDIR)/magics-targets-none.cmake #sed -i -e 's%$${_IMPORT_PREFIX}/bin%/usr/bin%g' $(CMAKEDIR)/magics-targets-none.cmake sed -i -e 's%${CURDIR}%/build/magics++%g' $(CMAKEDIR)/magics-config.cmake sed -i -e 's%${CURDIR}%/build/magics++%g' $(CMAKEDIR)/magics-import.cmake #sed -i -e 's%$${_IMPORT_PREFIX}/include/magics%/usr/include/magics%g' $(CMAKEDIR)/magics-targets.cmake sed -i -e 's%$${CURDIR}%/build/magics++%g' $(CMAKEDIR)/magics-import.cmake -find debian/tmp/usr/bin -type f -exec chrpath -d {} \; -find debian/tmp debian/libmagplus3v5 -name '*.so*' -exec chrpath -d {} \; override_dh_makeshlibs: # For new symbols when compiled with GCC 7 dh_makeshlibs -V'libmagplus3v5 (>= 2.34.1-2~)'