|
|
|
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 nomake=false
|
|
|
|
local noinstall=false
|
|
|
|
local olddir="$PWD"
|
|
|
|
local makeflags=''
|
|
|
|
|
|
|
|
local OPTIND=1
|
|
|
|
local opt
|
|
|
|
while getopts 'b:m:MI' opt; do case "$opt" in
|
|
|
|
b) local builddir="$OPTARG" ;;
|
|
|
|
m) local makeflags="$OPTARG" ;;
|
|
|
|
M) local nomake=true ;;
|
|
|
|
I) local noinstall=true ;;
|
|
|
|
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" \
|
|
|
|
--bindir="/$dir_prefix/$dir_bindir" \
|
|
|
|
--sbindir="/$dir_prefix/$dir_sbindir" \
|
|
|
|
--libexecdir="/$dir_prefix/$dir_libexecdir" \
|
|
|
|
--sysconfdir="/$dir_prefix/$dir_sysconfdir" \
|
|
|
|
--libdir="/$dir_prefix/$dir_libdir" \
|
|
|
|
--includedir="/$dir_prefix/$dir_includedir" \
|
|
|
|
--datadir="/$dir_prefix/$dir_datadir" \
|
|
|
|
--infodir="/$dir_prefix/$dir_infodir" \
|
|
|
|
--localedir="/$dir_prefix/$dir_localedir" \
|
|
|
|
--mandir="/$dir_prefix/$dir_mandir" \
|
|
|
|
--docdir="/$dir_prefix/$dir_docdir/$name" \
|
|
|
|
$build $cross "$@"
|
|
|
|
|
|
|
|
[ "$nomake" = false ] && make $makeflags
|
|
|
|
[ "$nomake" = false -a "$noinstall" = false ] && make DESTDIR="$dir_install" $makeflags install
|
|
|
|
|
|
|
|
[ "$builddir" ] && cd "$olddir" || true
|
|
|
|
}
|