shutils: reorganize stuff for $build_style, add "python-module" style.

If build_style=python-module, $XBPS_HELPERSDIR/python-module.sh will
run the do_install function.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091018071843-f3nv3rnhfzhngukp
This commit is contained in:
Juan RP 2009-10-18 09:18:43 +02:00
parent ba1c8971a5
commit af58fd7c8e
3 changed files with 48 additions and 40 deletions

View File

@ -29,19 +29,18 @@
#
build_src_phase()
{
local pkgparam="$1"
local pkg="$pkgname-$version"
local f
local pkg="$pkgname-$version" pkgparam="$1" f
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
#
# There's nothing of interest if we are a meta template or an
# {custom,only}-install template.
# Skip this phase for: meta-template, only-install, custom-install
# and python-module style builds.
#
[ "$build_style" = "meta-template" -o \
"$build_style" = "only-install" -o \
"$build_style" = "custom-install" ] && return 0
"$build_style" = "custom-install" -o \
"$build_style" = "python-module" ] && return 0
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]"
@ -82,5 +81,6 @@ build_src_phase()
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
unset_build_vars
touch -f $XBPS_BUILD_DONE
}

View File

@ -42,12 +42,14 @@ configure_src_phase()
fi
#
# There's nothing we can do if we are a meta template or an
# {custom,only}_install template.
# Skip this phase for: meta-template, only-install, custom-install,
# gnu_makefile and python-module style builds.
#
[ "$build_style" = "meta-template" -o \
"$build_style" = "only-install" -o \
"$build_style" = "custom-install" ] && return 0
"$build_style" = "custom-install" -o \
"$build_style" = "gnu_makefile" -o \
"$build_style" = "python-module" ] && return 0
if [ -n "$revision" ]; then
lver="${version}_${revision}"
@ -78,40 +80,37 @@ configure_src_phase()
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
set_build_vars
#
# Packages using GNU autoconf
#
if [ "$build_style" = "gnu_configure" ]; then
case "$build_style" in
gnu_configure|gnu-configure)
#
# Packages using GNU autoconf
#
${configure_script} --prefix=/usr --sysconfdir=/etc \
--infodir=/usr/share/info --mandir=/usr/share/man \
${configure_args}
#
# Packages using propietary configure scripts.
#
elif [ "$build_style" = "configure" ]; then
;;
configure)
#
# Packages using custom configure scripts.
#
${configure_script} ${configure_args}
#
# Packages that are perl modules and use Makefile.PL files.
# They are all handled by the helper perl-module.sh.
#
elif [ "$build_style" = "perl_module" ]; then
;;
perl-module|perl_module)
#
# Packages that are perl modules and use Makefile.PL files.
# They are all handled by the helper perl-module.sh.
#
. $XBPS_HELPERSDIR/perl-module.sh
perl_module_build $pkgname
#
# Packages with BSD or GNU Makefiles are easy, just skip
# the configure stage and proceed.
#
elif [ "$build_style" = "bsd_makefile" -o \
"$build_style" = "gnu_makefile" ]; then
:
#
# Unknown build_style type won't work :-)
#
else
;;
*)
#
# Unknown build_style type won't work :-)
#
msg_error "unknown build_style [$build_style]"
exit 1
fi
;;
esac
if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then
msg_error "building $pkg (configure phase)."
@ -128,5 +127,6 @@ configure_src_phase()
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
unset_build_vars
touch -f $XBPS_CONFIGURE_DONE
}

View File

@ -83,11 +83,19 @@ install_src_phase()
cross_compile_setvars
fi
if [ "$build_style" = "custom-install" ]; then
# Type of installation: custom, make or python.
case "$build_style" in
custom-install)
run_func do_install || msg_error "do_install stage failed!"
else
;;
python-module)
. $XBPS_HELPERSDIR/python-module.sh
run_func do_install || msg_error "python module install failed!"
;;
*)
make_install $lver
fi
;;
esac
# Run post_install func.
run_func post_install || msg_error "post_install stage failed!"
@ -176,8 +184,8 @@ make_install()
#
# Install package via make.
#
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args}
[ $? -ne 0 ] && msg_error "installing $pkgname-$lver."
run_rootcmd no ${make_cmd} ${make_install_target} \
${make_install_args} || msg_error "installing $pkgname-$lver"
# Unset build vars.
unset_build_vars