#!/usr/bin/make -f include /usr/share/dpkg/default.mk export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto # keep same order as https://buildd.debian.org/status/package.php?p=google-perftools&suite=sid # purposely remove i386 for Ubuntu compat TCMALLOC_ARCHS=amd64 arm64 armel armhf mips64el ppc64el riscv64 s390x loong64 powerpc ppc64 x32 ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),$(TCMALLOC_ARCHS))) ENABLE_TCMALLOC=ON else ENABLE_TCMALLOC=OFF endif # https://buildd.debian.org/status/package.php?p=openjdk-21 JAVA_ARCHS=amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x alpha ia64 m68k powerpc ppc64 sh4 sparc64 x32 ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),$(JAVA_ARCHS))) ENABLE_JNI=ON else ENABLE_JNI=OFF endif # Override if profile states so: ifneq (,$(filter nojava,$(DEB_BUILD_PROFILES))) ENABLE_JNI=OFF endif # Temp fix for 0.7.0-10.x i386/s390x build; see https://bugs.debian.org/1053641 DEB_CXXFLAGS_MAINT_APPEND += -fexcess-precision=fast ifneq (,$(filter $(DEB_HOST_ARCH), arm64 armel armhf ppc64el)) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728 DEB_CXXFLAGS_MAINT_APPEND += -Wno-psabi endif export DEB_CXXFLAGS_MAINT_APPEND ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) ENABLE_OPENEXR=OFF else ENABLE_OPENEXR=ON endif # Copy/paste from ci.sh `cmd_opt`: DEB_CXXFLAGS_MAINT_APPEND += -DJXL_DEBUG_WARNING -DJXL_DEBUG_ON_ERROR # deduce documentation option (build-indep target) ifeq "" "$(filter %-doc,$(shell dh_listpackages))" ENABLE_DOXYGEN = OFF else ENABLE_DOXYGEN = ON endif ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) BUILD_TESTING=ON else BUILD_TESTING=OFF endif %: dh $@ --buildsystem=cmake+ninja CMAKE_EXTRA_FLAGS += \ -DBUILD_TESTING:BOOL=$(BUILD_TESTING) \ -DCMAKE_BUILD_RPATH_USE_ORIGIN=OFF \ -DJPEGXL_BUNDLE_SKCMS:BOOL=OFF \ -DJPEGXL_ENABLE_BENCHMARK:BOOL=ON \ -DJPEGXL_ENABLE_DEVTOOLS:BOOL=ON \ -DJPEGXL_ENABLE_DOXYGEN:BOOL=$(ENABLE_DOXYGEN) \ -DJPEGXL_ENABLE_EXAMPLES:BOOL=ON \ -DJPEGXL_ENABLE_JNI:BOOL=$(ENABLE_JNI) \ -DJPEGXL_ENABLE_OPENEXR:BOOL=$(ENABLE_OPENEXR) \ -DJPEGXL_ENABLE_PLUGINS:BOOL=ON \ -DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF:BOOL=ON \ -DJPEGXL_ENABLE_PLUGIN_GIMP210:BOOL=OFF \ -DJPEGXL_ENABLE_PLUGIN_MIME:BOOL=OFF \ -DJPEGXL_ENABLE_SJPEG:BOOL=OFF \ -DJPEGXL_ENABLE_SKCMS:BOOL=OFF \ -DJPEGXL_ENABLE_TCMALLOC:BOOL=$(ENABLE_TCMALLOC) \ -DJPEGXL_FORCE_SYSTEM_BROTLI:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_GTEST:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_HWY:BOOL=ON \ -DJPEGXL_FORCE_SYSTEM_JPEG_TURBO=ON \ -DJPEGXL_FORCE_SYSTEM_LCMS2:BOOL=ON \ -DJPEGXL_INSTALL_JARDIR:PATH=share/java \ -DJPEGXL_INSTALL_JNIDIR:PATH=lib/$(DEB_HOST_MULTIARCH)/jni \ -DJPEGXL_TEST_DATA_PATH:PATH=/usr/share/libjxl-testdata \ override_dh_auto_configure: dh_auto_configure -- $(CMAKE_EXTRA_FLAGS) override_dh_auto_build-indep: dh_auto_build -- doc override_dh_auto_install-indep: override_dh_install-indep: dh_install -X.md5 -pjpeg-xl-doc obj-*/html usr/share/doc/jpeg-xl-doc override_dh_auto_test-indep: override_dh_auto_test-arch: # armel requires 7h to run complete testsuite: timeout 7h dh_auto_test -- override_dh_installman-arch: tools_manpages devtools_manpages jpegli_tools_manpages dh_installman override_dh_clean-arch: dh_clean debian/*.1 # by-product of `conformance_tooling_test`: dh_clean tools/conformance/__pycache__/lcms2.cpython-*.pyc debian/control: debian/control.in sed -e "s/@TCMALLOC_ARCHS@/$(TCMALLOC_ARCHS)/g;s/@JAVA_ARCHS@/$(JAVA_ARCHS)/g;" $< > $@ FILE=debian/libjxl-devtools.install DEVTOOLS=`cat $(FILE) | sed 's@usr/bin@debian@' | sed 's/$$/.1/' | tr '\n' ' '` VER_FULL = $(DEB_VERSION_UPSTREAM) debian/%.1: debian/%.1.in LD_PRELOAD= LD_LIBRARY_PATH=./debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) help2man --no-discard-stderr --include=$< --output=$@ --help-option=--help --version-string=$(VER_FULL) --no-info ./debian/tmp/usr/bin/`basename $@ .1` .PHONY: tools_manpages devtools_manpages jpegli_tools_manpages get-orig-source tools_manpages: debian/jxlinfo.1 echo "all tools manpages generated" jpegli_tools_manpages: debian/cjpegli.1 debian/djpegli.1 debian/jpegli_dec_fuzzer_corpus.1 echo "all jpegli tools manpages generated" devtools_manpages: debian/butteraugli_main.1 debian/decode_and_encode.1 debian/display_to_hlg.1 debian/djxl_fuzzer_corpus.1 debian/generate_lut_template.1 debian/jxl_from_tree.1 debian/pq_to_hlg.1 debian/render_hlg.1 debian/ssimulacra_main.1 debian/texture_to_cube.1 debian/tone_map.1 debian/xyb_range.1 debian/benchmark_xl.1 debian/ssimulacra2.1 debian/local_tone_map.1 debian/exr_to_pq.1 echo $(DEVTOOLS) echo "all devtools manpages generated" # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902846 get-orig-source: uscan --download --force-download --rename