#!/bin/sh

. /etc/flenv

mkdir -p $flinstpath

targetdir=`find $srcpath -maxdepth 1 -type d -name xz-\*`
if [ -z "$targetdir" ] || [ ! -d "$targetdir" ]; then
	echo "ERROR: target source directory not found"
	exit 1
fi

pushd $targetdir

./configure --prefix=$flinstpath --disable-nls --disable-shared \
|| { echo "ERROR: configure failed" ; popd; exit 1 ; }

make \
|| { echo "ERROR: make failed" ; popd; exit 1 ; }

make install-strip \
|| { echo "ERROR: make install-strip failed" ; popd; exit 1 ; }

popd

echo "INFO: xz is now installed"
