#!/usr/bin/make -f # -*- makefile -*- NULL = # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # ============================================================================== # ARMv5 (Brainux) Switchable Optimization Template for Debian Rules file. # Please add this below `#!/usr/bin/make -f` # or add this above `include /usr/share/dpkg/default.mk`. # ============================================================================== # ------------------------------------------------------------------------------ # [1] Basic flags (base optimizations applied even during test builds) # ------------------------------------------------------------------------------ export COMMON_APPEND = -march=armv5tej -mtune=arm926ej-s -marm -falign-functions=4 export COMMON_APPEND += -O3 -fomit-frame-pointer -fno-tree-vectorize export COMMON_APPEND += -mfloat-abi=soft -ffast-math -fno-finite-math-only -ffunction-sections -fdata-sections # Uncomment for legacy 2000s source code or when build/runtime issues occur. # export COMMON_APPEND += -fno-strict-aliasing -fno-aggressive-loop-optimizations -fno-strict-overflow export COMMON_APPEND += MY_CFLAGS_BASE = $(COMMON_APPEND) -Wno-error=implicit-function-declaration -Wno-error=int-conversion export DEB_CXXFLAGS_MAINT_APPEND+= $(COMMON_APPEND) -fpermissive export DEB_LDFLAGS_MAINT_APPEND += -lm -Wl,--as-needed export DEB_BUILD_MAINT_OPTIONS += hardening=+bindnow # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # [2] Ultra-powerful finalization flag (Resource-intensive; for LTO production use) # When performing a build check (test), # please comment out the six lines below by adding a "#" at the beginning of each. # When enabling these lines (uncommenting), please execute the following command beforehand. # $ mkdir -p ~/target_tmp # ------------------------------------------------------------------------------ export TMPDIR =$(HOME)/target_tmp export TMP =$(HOME)/target_tmp export TEMP =$(HOME)/target_tmp export DEB_CXXFLAGS_MAINT_APPEND += -Wno-odr export DEB_LDFLAGS_MAINT_APPEND += -flto-partition=balanced export DEB_BUILD_MAINT_OPTIONS += optimize=+lto # ------------------------------------------------------------------------------ include /usr/share/dpkg/default.mk ifneq (,$(filter $(DEB_HOST_ARCH), m68k)) FLOAT_STORE=-ffloat-store endif ifneq (,$(filter $(DEB_HOST_ARCH), ia64 loong64 riscv64 s390x)) FLOATTEST=-DFLOATTEST=fp-contract endif # To enable all, uncomment following line #export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_LDFLAGS_MAINT_STRIP += -Wl,-Bsymbolic-functions export DEB_CFLAGS_MAINT_APPEND += -Wall -pedantic $(FLOAT_STORE) export DPKG_GENSYMBOLS_CHECK_LEVEL = 0 # ============================================================================== # Please add this below `include /usr/share/dpkg/default.mk`. # ============================================================================== # ------------------------------------------------------------------------------ # [3] Final assignment (*Must be placed at the very end) # ------------------------------------------------------------------------------ export DEB_CFLAGS_MAINT_APPEND += $(MY_CFLAGS_BASE) # ------------------------------------------------------------------------------ # [4] Compatibility settings for building legacy source code with GCC 14+ # - Forces C11/C++11 standards to allow old syntax stricter in newer compilers. # - Suppresses C++20-specific template/constructor warnings and errors. # ------------------------------------------------------------------------------ #export DEB_CFLAGS_MAINT_APPEND += -std=gnu11 #export DEB_CXXFLAGS_MAINT_APPEND += -std=gnu++11 -Wno-template-id-cdtor # ------------------------------------------------------------------------------ CFLAGS ?= $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS ?= $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS ?= $(shell dpkg-buildflags --get LDFLAGS) ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -Wall endif ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CC = gcc else CC = $(DEB_HOST_GNU_TYPE)-gcc endif SIMD_BROKEN_ARCHS = x32 #ifeq (,$(filter $(DEB_HOST_ARCH), $(SIMD_BROKEN_ARCHS))) # DISABLE_SIMD=-DWITH_SIMD=1 #else DISABLE_SIMD=-DWITH_SIMD=0 #endif JAVA_ARCHS = alpha amd64 arm64 armel armhf i386 ia64 loong64 m68k mips64el ppc64 ppc64el riscv64 s390x sh4 sparc64 x32 #ifneq (,$(filter $(DEB_HOST_ARCH), $(JAVA_ARCHS))) # DISABLE_JAVA=-DWITH_JAVA=1 #else DISABLE_JAVA=-DWITH_JAVA=0 #endif %: dh $@ override_dh_auto_configure: dh_auto_configure -- $(DISABLE_SIMD) $(FLOATTEST) $(DISABLE_JAVA) \ -DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_INSTALL_MANDIR=/usr/share/man/ $(NULL) override_dh_auto_build: dh_auto_build -- V=1 $(MAKE) -C debian/extra CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" V=1 override_dh_auto_clean: $(MAKE) -C debian/extra clean if [ -e Makefile ]; then $(MAKE) testclean; fi dh_auto_clean rm -f simd/jsimdcfg.inc override_dh_auto_install: debian/tjbench.1 dh_auto_install # drop documentation files (installed via dh_installdocs) rm -Rfv debian/tmp/usr/share/doc/ # Install extra utilities $(MAKE) -C debian/extra install prefix=/usr DESTDIR=$(CURDIR)/debian/tmp # Install manual page for tjbench.1 install -m 644 debian/tjbench.1 $(CURDIR)/debian/tmp/usr/share/man/man1/ # Fix jconfig.h for MultiArch rm -f debian/tmp/usr/include/jconfig.h mkdir -p debian/tmp/usr/include/$(DEB_HOST_MULTIARCH) sed -e "s/#\(undef\|define\) HAVE_\(LOCALE\|\(STD\(DEF\|LIB\)\)\)_H 1//g" \ obj-$(DEB_HOST_GNU_TYPE)/jconfig.h > debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/jconfig.h override_dh_install: dh_install -X.la -X/usr/share/doc override_dh_missing: dh_missing --fail-missing override_dh_installchangelogs: dh_installchangelogs -plibjpeg62-turbo-dev change.log dh_installchangelogs -Nlibjpeg62-turbo-dev # See debhelper: DEFAULT_BUILD_DIRECTORY = obj-$(DEB_HOST_GNU_TYPE) debian/tjbench.1: debian/tjbench.1.in PATH=$(CURDIR)/$(DEFAULT_BUILD_DIRECTORY) \ /usr/bin/help2man --no-info --include=$< --output=$@ \ --name="benchmark the performance of libjpeg-turbo" \ --version-string=$(DEB_VERSION_UPSTREAM) `basename $@ .1` # next line may break in the future, but tidy output a bit: sed -z -i -e 's/USAGE: tjbench\n.IP/.SH USAGE\n.IP\ntjbench/g' $@ get-orig-source: uscan --noconf --force-download --rename --download-current-version --destdir=..