#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

CONFFLAGS := -DENABLE_RTMP=TRUE -DAUDIO_BACKEND="pulse sdl"

ifeq ($(DEB_HOST_ARCH),powerpcspe)
	CONFFLAGS += -DDISABLE_ALTIVEC=TRUE
endif

UVER := $(shell dpkg-parsechangelog|sed -n '/^Version/{s/Version: \(.*\)/\1/p}'|cut -f1 -d-)

%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure -- $(CONFFLAGS)

override_dh_strip:
	dh_strip --dbg-package=lightspark-dbg

override_dh_install:
	dh_install --list-missing

override_dh_shlibdeps:
	export LD_LIBRARY_PATH="$(CURDIR)/debian/lightspark-common/usr/lib/lightspark:$$LD_LIBRARY_PATH" ; \
	    dh_shlibdeps -Llightspark-common \
	    -pbrowser-plugin-lightspark -plightspark \
	    -- -Ldebian/common.shlibs
	
	dh_shlibdeps --remaining-packages

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/lightspark

VER = $(UVER)+git$(shell date -u '+%Y%m%d')
TMPDIR = lightspark-$(VER)
get-orig-source:
	@echo Git cloning lightspark $(VER)...
	git clone --depth 1 https://github.com/lightspark/lightspark.git $(TMPDIR)
	@echo Generating tarball...
	cd $(TMPDIR) && tar --exclude .git -Jcf ../../lightspark_$(VER).orig.tar.xz .
	rm -rf $(TMPDIR) && dch -v $(VER)-1 "New upstream snapshot."
