# x264
# Builds from https://github.com/puppylinux-woof-CE/petbuilds

. ../func
. ../build.conf

URL=http://distro.ibiblio.org/puppylinux/sources/x
PKG=x264
SRCVER=20131101-2245
VER=20131101.2245
COMP=tar.bz2
DESC="free software library and application for encoding video streams"
DEPS=
CAT=BuildingBlock
DESKTOP=
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	mv ${PKG}-${SRCVER} ${PKG}-${VER}
	cd ${PKG}-${VER}
	./configure --prefix=/usr \
				--libdir=/usr/${LIBDIR} \
				--enable-shared
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	cd -
}
	
# main
retrieve ${PKG}-${SRCVER}.${COMP}
extract ${PKG}-${SRCVER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT	
