#!/bin/sh

source ../Config.sh

pp_clean_local () {
    cd source
    pp_clean_default
    # force autoconf
    rm -f configure
    cd "$OLDPWD"
}

pp_build_local () {
    cd source

    # force configure
    if [ ! -f configure -o "$PP_FORCE_FULL_BUILD" = "1" ]; then
	echo "Running libtoolize & autoconf ..."
	libtoolize --copy --force
	autoconf
	sed -i -e "s,%LFSSUPPORT%,yes," configure
	rm -f Makefile
    fi

    # some variables for configure/make
    export CFLAGS="$FW_CFLAGS_3RDPARTY -ffunction-sections -fdata-sections"


    # configure
    if [ ! -f Makefile ]; then
	echo "Running configure ..."
	./configure \
		--host="$HOST_SYSTEM" \
		--target="$HOST_SYSTEM" \
		--prefix=/ \
		--with-fhs \
		--with-codepagedir=/lib/samba/codepages \
		--with-smbmount \
		--without-ssl \
		--without-acl-support \
		--disable-cups \
		--without-cups \
		--with-included-popt
    fi

    # make / install
    echo "Running make ..."
    make install

    cd "$OLDPWD"
}

pp_do "$@"
