#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# The PS3's PPE (Cell): its scheduling, and AltiVec for the mixer's Cell paths (our patches in
# debian/patches/ps3/), as Mesa is built
ifeq ($(DEB_HOST_ARCH),ppc64)
DEB_CFLAGS_MAINT_APPEND += -mcpu=cell -mtune=cell
DEB_CXXFLAGS_MAINT_APPEND += -mcpu=cell -mtune=cell
export DEB_CFLAGS_MAINT_APPEND DEB_CXXFLAGS_MAINT_APPEND
endif

DEB_CMAKE_OPTIONS = \
	-DALSOFT_UTILS=ON \
	-DALSOFT_EXAMPLES=OFF \
	-DALSOFT_TESTS=OFF \
	-DALSOFT_UPDATE_BUILD_VERSION=OFF

ifeq ($(DEB_HOST_ARCH_CPU),i386)
DEB_CMAKE_OPTIONS += -DALSOFT_CPUEXT_SSE3=OFF
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CMAKE_OPTIONS)

execute_after_dh_auto_install:
	install -d debian/tmp/etc/openal
	install -m644 \
		debian/tmp/usr/share/openal/alsoftrc.sample \
		debian/tmp/etc/openal/alsoft.conf
