#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

#TOOLS:=oc2sec sec2ts zpipe tsfilter tsloop tsmodder tsnullfiller tsnullshaper tspcrmeasure tspidmapper esaudio2pes esaudioinfo esvideompeg2pes esvideompeg2info pes2es pesaudio2ts pesvideo2ts pesinfo tsstamp ts2pes mpe2sec tscbrmuxer mpeg2videovbv tstdt i13942ts tsvbr2cbr tsfixcc tsudpreceive tsudpsend dsmcc-receive tspcrstamp tstcpreceive tstcpsend tstimeout tstimedwrite tsinputswitch tsdoubleoutput pes2txt tsoutputswitch tsccc txt2pes ts2sec pesdata2ts tsmask tsorts tsororts tspcrrestamp tsprinter eitsecfilter eitsecmapper m2ts2cbrts ts2m2ts tsdiscont eitsecactualtoanother tscrypt

# oc2sec is handled differently
# mpeg2videovbv is just named vbv
TOOLS:=sec2ts zpipe tsfilter tsloop tsmodder tsnullfiller tsnullshaper tspcrmeasure tspidmapper esaudio2pes esaudioinfo esvideompeg2pes esvideompeg2info pes2es pesaudio2ts pesvideo2ts pesinfo tsstamp ts2pes mpe2sec tscbrmuxer tstdt i13942ts tsvbr2cbr tsfixcc tsudpreceive tsudpsend dsmcc-receive tspcrstamp tstcpreceive tstcpsend tstimeout tstimedwrite tsinputswitch tsdoubleoutput pes2txt tsoutputswitch tsccc txt2pes ts2sec pesdata2ts tsmask tsorts tsororts tspcrrestamp eitsecfilter eitsecmapper m2ts2cbrts ts2m2ts tsdiscont eitsecactualtoanother tscrypt


%:
	dh $@ --with python2

override_dh_auto_install:
	dh_auto_install
	mkdir -p debian/opencaster/usr/bin
	
	for TOOL in $(TOOLS); do \
	   echo "process $$TOOL"; \
	   cp tools/$$TOOL/$$TOOL debian/opencaster/usr/bin; \
	   rm debian/opencaster/$$TOOL; \
        done

	rm debian/opencaster/mod2sec.py
	rm debian/opencaster/file2mod.py
	rm debian/opencaster/oc-update.sh
	cp tools/oc2sec/mod2sec.py debian/opencaster/usr/bin/mod2sec
	cp tools/oc2sec/file2mod.py debian/opencaster/usr/bin/file2mod
	cp tools/oc2sec/oc-update.sh debian/opencaster/usr/bin/oc-update
	# don't forget this little tool
	cp tools/mpeg2videovbv/vbv debian/opencaster/usr/bin/vbv
	rm -f debian/opencaster/vbv

	#no more docs: mkdir -p debian/opencaster-doc/usr/share/doc/opencaster-doc
	#no more docs: cp -a tutorials debian/opencaster-doc/usr/share/doc/opencaster-doc

get-orig-source:
	./debian/get-orig-source
