#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # Enable verbose builds to detect missing (hardening) flags. #export verbose=1 # This has to be exported to make some magic below work. export DH_OPTIONS export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk BUILD_DATE = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "@$(SOURCE_DATE_EPOCH)") SPHINXOPTS := -N -D html_last_updated_fmt="$(BUILD_DATE)" # Set CC for crossbuild export CC_FOR_BUILD ?= cc export PKG_CONFIG ?= $(DEB_HOST_GNU_TYPE)-pkg-config # The build system doesn't use CPPFLAGS, pass them to CFLAGS to enable the # missing (hardening) flags. CFLAGS += $(CPPFLAGS) # ICC support needs patched thirdparty liblcms2-art CFLAGS += -DFZ_ENABLE_ICC=0 CFLAGS += -fPIC CFLAGS += -DNDEBUG ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif BUILD_FLAGS = build=debug shared=yes OS=Linux XCFLAGS="$(CFLAGS)" XLDFLAGS="$(LDFLAGS)" prefix=/usr c++ python BUILD_FLAGS += LINUX_OR_OPENBSD=yes #BUILD_FLAGS = build=release OS=Linux XCFLAGS="$(CFLAGS)" XLDFLAGS="$(LDFLAGS)" prefix=/usr # Force using system library BUILD_FLAGS += USE_SYSTEM_MUJS=yes BUILD_FLAGS += USE_SYSTEM_LIBS=yes # Force using system lcms2 (was not included in default system library set) BUILD_FLAGS += USE_SYSTEM_LCMS2=yes BUILD_FLAGS += LD=$(DEB_HOST_GNU_TYPE)-ld ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) BUILD_FLAGS += verbose=yes endif ifeq ($(DEB_TARGET_ARCH),mips64el) BUILD_FLAGS += HAVE_OBJCOPY=no endif override_dh_auto_build: -sed -e s,@@DEB_HOST_MULTIARCH@@,${DEB_HOST_MULTIARCH}, debian/mupdf.pc.in > debian/mupdf.pc debian/replace-fonts.sh -mkdir source/pdf/cmaps sh scripts/runcmapdump.sh dh_auto_build -- $(BUILD_FLAGS) VENV_FLAG='' build=debug shared override_dh_auto_install: dh_auto_install -- $(BUILD_FLAGS) VENV_FLAG='' build=debug shared install -m744 -T $(CURDIR)/debian/mupdf.sh $(CURDIR)/debian/tmp/usr/bin/mupdf sh debian/install_icons.sh ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C $(CURDIR)/debian/tests test endif override_dh_gencontrol: dh_gencontrol -- -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W fonts-droid-fallback fonts-noto-cjk fonts-noto-core fonts-sil-charis fonts-urw-base35 texlive-fonts-extra)" override_dh_clean: dh_clean -Xresources/fonts/urw/input/NimbusBoxes.t1 override_dh_auto_clean: -rm -rf build -rm -rf generated -rm -rf source/pdf/cmaps -rm -f resources/fonts/sil/CharisSIL*.ttf -rm -rf platform/c++/* -rm -rf platform/python/* -rm -rf debian/mupdf.pc override_dh_missing: dh_missing --list-missing -X COPYING override_dh_installman: $(CURDIR)/debian/create_tools_manpages.sh docs/src/mupdf-command-line.rst #remove GLUC because rst2man fails to invalid target name sed -i 's/GLUT_ /GLUT/g' $(CURDIR)/output_files/mupdf-gl.rst #convert to manpage rst2man $(CURDIR)/output_files/mupdf-gl.rst $(CURDIR)/debian/tmp/usr/share/man/mupdf-gl.1 rst2man $(CURDIR)/output_files/muraster.rst $(CURDIR)/debian/tmp/usr/share/man/muraster.1 dh_installman override_dh_sphinxdoc: ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS))) PYTHONPATH=src python3 -m sphinx -b html $(SPHINXOPTS) docs/src/ $(CURDIR)/debian/mupdf/usr/share/doc/mupdf/ dh_sphinxdoc endif override_dh_installdocs: rm -rf $(CURDIR)/debian/mupdf/usr/share/doc/mupdf/html/_sources rm -rf $(CURDIR)/debian/mupdf/usr/share/doc/mupdf/html/_static/[doctools.js,language_data.js,searchtools.js] rm -rf $(CURDIR)/debian/mupdf/usr/share/doc/mupdf/doctrees dh_installdocs override_dh_makeshlibs: dh_makeshlibs -- -v$(DEB_VERSION_UPSTREAM) -plibmupdf$(DEB_VERSION_UPSTREAM) %: dh $@ --with sphinxdoc