#!/usr/bin/make -f #export DEB_CFLAGS_MAINT_APPEND = -O3 -march=native -msoft-float -fomit-frame-pointer export DEB_LDFLAGS_MAINT_APPEND = -lX11 -lXext -lXinerama # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # do not run the actual rules of this makefile in parallel. sub-makes # can go in parallel .NOTPARALLEL: # ============================================================================== # 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,--gc-sections -Wl,-s -Wl,--as-needed export DEB_BUILD_MAINT_OPTIONS += hardening=-all,+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/architecture.mk include /usr/share/dpkg/buildtools.mk include /usr/share/dpkg/default.mk # ============================================================================== # 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 # ------------------------------------------------------------------------------ D_VERSION = $(shell dpkg-parsechangelog -SVersion | sed -e 's/^[0-9]*://') OUR_VERSION = \#define VERSION \"$(D_VERSION) (Debian)\" OUR_TITLE = \#define MP_TITLE \"MPlayer $(D_VERSION) (Debian)\" CFLAGS +=$(CPPFLAGS) #export DEB_BUILD_MAINT_OPTIONS = hardening=+all CONFIGURE_FLAGS = \ --prefix=/usr \ --confdir=/etc/mplayer \ --disable-debug \ --enable-menu \ --disable-arts \ --language=all \ --disable-libmpeg2-internal \ --disable-ffmpeg_a \ --disable-esd \ --disable-armv6 \ --disable-armv6t2 \ --disable-armvfp \ --disable-neon \ --disable-thumb \ --disable-sdl \ --enable-x11 \ --disable-gl \ --enable-alsa \ --extra-cflags="$(DEB_CFLAGS_MAINT_APPEND) $(CPPFLAGS) $(CFLAGS)" \ --extra-ldflags="$(DEB_LDFLAGS_MAINT_APPEND) $(LDFLAGS)" \ $(archconf) CONFIGURE_DOC_FLAGS = \ --disable-ffmpeg_a \ --disable-mencoder \ --disable-mplayer \ --yasm='' \ --language=all # Runtime detections is available for i386, amd64 and ppc. ifneq (,$(filter $(DEB_HOST_ARCH),i386 hurd-i386 kfreebsd-i386 amd64 kfreebsd-amd64 powerpc)) CONFIGURE_FLAGS += --enable-runtime-cpudetection endif ifeq ($(DEB_HOST_ARCH),i386) #configure optimizes for the cpu detected at ./configure time #in order to build a generic binary, avoid non-standard opcodes through gcc archconf += --target=i586-linux endif # when run on a sparc64 kernel, configure will normally select v9 asm. # this is hidden when running on buildds with 32bit kernel personality. # because of #644856, this will currently lead to a FTBFS # therefore, we force a 'generic' target. ifeq ($(DEB_HOST_ARCH),sparc) archconf += --target=generic endif ifeq ($(DEB_HOST_ARCH),alpha) #Avoid high optimization through gcc. # see http://permalink.gmane.org/gmane.linux.debian.ports.alpha/7295 archconf += --target=alpha_ev5-linux endif ifeq ($(DEB_HOST_ARCH_OS),linux) CONFIGURE_FLAGS += --enable-joystick --enable-radio --enable-radio-capture sound_backend := alsa else sound_backend := oss endif # It seems x32 has some alsa issues. Add oss as fallback. # see http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/2015-July/046049.html # The default for all could be "ao=pulse,alsa,oss,sdl:aalib" to avoid this. ifeq ($(DEB_HOST_ARCH),x32) sound_backend := alsa,oss endif ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifeq ($(archconf),) archconf += --target=$(DEB_HOST_GNU_CPU)-$(DEB_HOST_ARCH_OS) endif archconf += \ --enable-cross-compile \ --cc=$(CC) \ --host-cc=$(CC_FOR_BUILD) export PATH:=$(CURDIR)/debian/devbin:$(PATH) endif %: dh $@ override_dh_auto_build-arch: dh_auto_build -- mplayer mv mplayer gmplayer $(MAKE) install-gui-msg DESTDIR=$(CURDIR)/gui-msg ifeq "$(DEB_HOST_ARCH)" "powerpc" $(MAKE) distclean ./configure $(CONFIGURE_FLAGS) --disable-gui --disable-altivec printf '%s\n%s\n' "$(OUR_VERSION)" "$(OUR_TITLE)" >> version.h dh_auto_build -- mplayer mv mplayer mplayer-noaltivec endif $(MAKE) distclean ./configure $(CONFIGURE_FLAGS) --disable-gui printf '%s\n%s\n' "$(OUR_VERSION)" "$(OUR_TITLE)" >> version.h dh_auto_build -- mplayer mencoder override_dh_auto_build-indep: [ -f DOCS/HTML/en/index.html ] || dh_auto_build -- html-chunked override_dh_auto_clean: rm -rf gui-msg rm -rf mplayer-noaltivec [ -f config.mak ] && $(MAKE) distclean || true override_dh_auto_configure-arch: ./configure $(CONFIGURE_FLAGS) --enable-gui --enable-nls printf '%s\n%s\n' "$(OUR_VERSION)" "$(OUR_TITLE)" >> version.h override_dh_auto_configure-indep: [ -f config.mak ] || ./configure $(CONFIGURE_DOC_FLAGS) override_dh_auto_install-arch: $(MAKE) install-mplayer DESTDIR=$(CURDIR)/debian/mplayer $(MAKE) install-mencoder DESTDIR=$(CURDIR)/debian/mencoder $(MAKE) install-mplayer-man DESTDIR=$(CURDIR)/debian/mplayer $(MAKE) install-mencoder-man DESTDIR=$(CURDIR)/debian/mencoder $(MAKE) install-gui-man DESTDIR=$(CURDIR)/debian/mplayer-gui $(MAKE) install-gui-icons DESTDIR=$(CURDIR)/debian/mplayer-gui find debian/mencoder -type d -empty -delete find debian/mplayer -type d -empty -delete find debian/mplayer-gui -type d -empty -delete override_dh_auto_install-indep: override_dh_auto_test-indep: override_dh_compress-arch: dh_compress find debian/mencoder/usr/share/man/ -type f -name mplayer.1.gz -delete find debian/mplayer-gui/usr/share/man/ -type f -name mplayer.1.gz -delete override_dh_install-arch: dh_install sed -e "s/@SOUND_BACKEND@/$(sound_backend)/" -i \ $(CURDIR)/debian/mplayer/etc/mplayer/mplayer.conf