#!/bin/sh

ml_required_package gdbm

CLEANIMAGE_OPTIONS=PERL_SRC

PATCHFILES=x2p_cflags.SH.patch

function ml_configure() {
        cd $BUILD/$PACKAGE/$PACKAGE
        set -x
        sed "s,@TOPDIR@,$TOPDIR," ../config.sh > config.sh.use
        chmod 755 config.sh.use
        sh -x Configure -D cc=$GCC -D prefix=/usr/perl -D optimize="$CFLAGS" -D installprefix=$TOOLS/perl -U installusrbinperl -der -f config.sh.use
}

function ml_compile() {
        cd $BUILD/$PACKAGE/$PACKAGE
        make
}

function ml_installlocal() {
        cd $BUILD/$PACKAGE/$PACKAGE
        make install
        strip $TOOLS/perl/bin/perl
	find $TOOLS/perl/lib -name \*.so | xargs strip
}

function ml_installroot() {
        ml_installroot_default
        echo "usr/perl" >> $IMAGE/images
        mkdir -p $ROOT/usr/perl
        cp -af $TOOLS/perl/bin/perl $ROOT/usr/perl
        ln -sf ../perl/perl $ROOT/usr/bin
        cp -af $TOOLS/perl/lib $ROOT/usr/perl
        cp -af $TOOLS/lib/libdb[.-]*so* $ROOT/usr/lib
	rm -fr $ROOT/usr/perl/lib/*/pod
}
