|
|
|
define_option 'cross=: Cross compile a program to run on the specified target triplet.'
|
|
|
|
define_option "build=: Explicity specify the host machine's target triplet."
|
|
|
|
|
|
|
|
compile_configure() {
|
|
|
|
local builddir=""
|
|
|
|
local noinstall=false
|
|
|
|
local olddir="$PWD"
|
|
|
|
local makeflags=""
|
|
|
|
|
|
|
|
local OPTIND=1
|
|
|
|
local opt
|
|
|
|
while getopts "b:c:m:I" opt; do case "$opt" in
|
|
|
|
b) local builddir="$OPTARG" ;;
|
|
|
|
I) local noinstall=true ;;
|
|
|
|
m) local makeflags="$OPTARG" ;;
|
|
|
|
esac; done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
[ "$1" = "--" ] && shift
|
|
|
|
|
|
|
|
if [ "$builddir" ]; then
|
|
|
|
mkdir -p "$builddir"
|
|
|
|
cd "$builddir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local cross="$(option =cross)"
|
|
|
|
[ "$cross" ] && local cross="--host=$cross"
|
|
|
|
local build="$(option =build)"
|
|
|
|
[ "$build" ] && local build="--build=$build"
|
|
|
|
|
|
|
|
"$olddir/configure" \
|
|
|
|
--prefix="/$dir_prefix" \
|
|
|
|
--sysconfdir="/$dir_sysconfdir" \
|
|
|
|
--bindir="/$dir_prefix/$dir_bindir" \
|
|
|
|
--sbindir="/$dir_prefix/$dir_sbindir" \
|
|
|
|
--libdir="/$dir_prefix/$dir_libdir" \
|
|
|
|
--libexecdir="/$dir_prefix/$dir_libexecdir" \
|
|
|
|
--datadir="/$dir_prefix/$dir_datadir" \
|
|
|
|
--mandir="/$dir_prefix/$dir_mandir" \
|
|
|
|
--docdir="/$dir_prefix/$dir_docdir/$name" \
|
|
|
|
--infodir="/$dir_prefix/$dir_infodir" \
|
|
|
|
--localedir="/$dir_prefix/$dir_localedir" \
|
|
|
|
$build $cross $@
|
|
|
|
|
|
|
|
make $makeflags
|
|
|
|
[ "$noinstall" = false ] && make DESTDIR="$dir_install" $makeflags install
|
|
|
|
|
|
|
|
[ "$builddir" ] && cd "$olddir"
|
|
|
|
true
|
|
|
|
}
|