#!/usr/bin/make -f
# debian/rules for the VideoLAN Client - uses debhelper.
# based on Joey Hess's one.
# Kludged for ipkg

VERSION=0.7.0

# export PATH="$PATH:/usr/local/arm/2.95.3/bin"
# Compilation options
export CC=arm-linux-gcc
export LD=arm-linux-ld
export AR=arm-linux-ar
export AS=arm-linux-gcc
export RANLIB=arm-linux-ranlib
export STRIP=arm-linux-strip
export CONFIG_FLAGS="--enable-release --prefix=/usr \
	--disable-plugins \
	--disable-gtk \
	--disable-gtk2 \
	--disable-gnome \
	--disable-gnome2 \
	--disable-qt \
	--disable-kde \
	--disable-qte \
	--disable-xosd \
	--disable-ogg \
	--disable-tarkin \
	--disable-tremor \
	--disable-theorea \
	--enable-dummy \
	--enable-v4l \
	--enable-sout \
	--enable-fb \
	--enable-sdl \
	--enable-oss \
	--disable-alsa \
	--enable-x11 \
	--disable-xvideo \
	--disable-dvd \
	--disable-dvdread \
	--disable-vcd \
	--disable-maxosx \
	--disable-freetype \
	--enable-a52 \
	--enable-flac \
	--enable-faad2 \
	--enable-libmpeg2 \
	--enable-libdvbpsi \
	--disable-mkv \
	--enable-mad \
	--enable-ffmpeg \
	--enable-pda \
	--with-tuning=strongarm1100 \
	--x-includes=/skiff/local/arm-linux/include \
	--x-libraries=/usr/local/arm/2.95.3/arm-linux/usr/X11R6/lib \
	--with-libiconv-prefix=/usr/local/arm/2.95.3/arm-linux/usr \
	--with-mad-tree=/home/jpsaman/iPaq/src/libmad-0.15.0b \
	--with-a52-tree=/home/jpsaman/iPaq/src/a52dec-0.7.4 \
	--with-faad2-tree=/home/jpsaman/iPaq/src/faad2-20030612 \
	--with-flac-tree=/home/jpsaman/iPaq/src/flac-1.1.0 \
	--with-libmpeg2-tree=/home/jpsaman/iPaq/src/mpeg2dec-20030612 \
	--with-libdvbpsi-tree=/home/jpsaman/iPaq/src/libdvbpsi-0.1.2 \
	--with-gpe-prefix=/usr/local/arm/2.95.3/arm-linux/usr \
	--with-sdl-config-path=/usr/local/arm/2.95.3/arm-linux/usr/bin \
	--with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr \
	--with-ffmpeg-tree=/home/jpsaman/iPaq/src/ffmpeg-20030622"

export VIDDIR="usr/share/vlc"
export PIXDIR="usr/share/pixmaps"
#export DESTDIR=/tmp/vlc
export DESTDIR=/usr/local/arm/2.95.3/arm-linux
export PKGDIR=/home/jpsaman/iPaq/packages/gpe-vlc-$(VERSION)

config:
	./configure --mandir=$${prefix}/share/man \
		--infodir=$${prefix}/share/info \
		--host=arm-linux \
		--target=arm-linux \
		$(shell echo $(CONFIG_FLAGS)) \
		LDFLAGS="-L/usr/local/arm/2.95.3/arm-linux/lib -L/usr/local/arm/2.95.3/arm-linux/usr/lib" \
		CPPFLAGS="-I/usr/local/arm/2.95.3/arm-linux/usr/include"

build:
# This is ugly -- I know
#	patch -p 0 < ipkg/patch
	$(MAKE)

clean:
	-$(MAKE) distclean

install: build
	rm -fr ${PKGDIR}/
	mkdir -p ${PKGDIR}/CONTROL
	mkdir -p $(PKGDIR)/usr/bin
	mkdir -p ${PKGDIR}/usr/share/vlc
	mkdir -p ${PKGDIR}/usr/lib/menu
	mkdir -p ${PKGDIR}/usr/lib/vlc
	$(STRIP) vlc
	cp ipkg/control.gpe $(PKGDIR)/CONTROL/control
	cp ipkg/postinst.gpe ${PKGDIR}/CONTROL/postinst
	cp ipkg/postrm.gpe ${PKGDIR}/CONTROL/postrm
	cp share/familiar-* ${PKGDIR}/usr/share/vlc
	cp share/vlc32x32.xpm ${PKGDIR}/usr/share/vlc
	cp share/vlc16x16.xpm  ${PKGDIR}/usr/share/vlc
	cp share/vlc48x48.png  ${PKGDIR}/usr/share/vlc
	cp vlc $(PKGDIR)/usr/bin
	cp ipkg/vlc.gpe ${PKGDIR}/usr/lib/menu/vlc

install-plugins: install
	find ./ -name *.so | xargs cp $1 ${PKGDIR}/usr/lib/vlc/ 
	$(STRIP) ${PKGDIR}/usr/lib/vlc/*.so

.PHONY: build clean install install-plugins

