You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
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 $(expr $OPTIND - 1)
|
|
[ "$#" -ge 1 ] && [ "$1" = '--' ] && shift || true
|
|
|
|
if [ "$builddir" ]; then
|
|
mkdir -p "$builddir"
|
|
cd "$builddir"
|
|
fi
|
|
|
|
local cross="$(option =cross)"
|
|
[ "$cross" ] && local cross="--host=$cross" || true
|
|
local build="$(option =build)"
|
|
[ "$build" ] && local build="--build=$build" || true
|
|
|
|
"$olddir/configure" \
|
|
--prefix="/$dir_prefix" \
|
|
--bindir="/$dir_prefix/$dir_bin" \
|
|
--sbindir="/$dir_prefix/$dir_sbin" \
|
|
--libexecdir="/$dir_prefix/$dir_libexec" \
|
|
--sysconfdir="/$dir_prefix/$dir_sysconf" \
|
|
--libdir="/$dir_prefix/$dir_lib" \
|
|
--includedir="/$dir_prefix/$dir_include" \
|
|
--datadir="/$dir_prefix/$dir_data" \
|
|
--infodir="/$dir_prefix/$dir_info" \
|
|
--localedir="/$dir_prefix/$dir_locale" \
|
|
--mandir="/$dir_prefix/$dir_man" \
|
|
--docdir="/$dir_prefix/$dir_doc/$name" \
|
|
$build $cross "$@"
|
|
|
|
if [ "$nomake" = false ]; then
|
|
make $makeflags
|
|
if [ "$noinstall" = false ]; then
|
|
make DESTDIR="$dir_install" $makeflags install
|
|
fi
|
|
fi
|
|
|
|
if [ "$builddir" ]; then
|
|
cd "$olddir"
|
|
fi
|
|
}
|
|
|