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

View File

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

View File

@ -83,11 +83,19 @@ install_src_phase()
cross_compile_setvars cross_compile_setvars
fi 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!" 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 make_install $lver
fi ;;
esac
# Run post_install func. # Run post_install func.
run_func post_install || msg_error "post_install stage failed!" run_func post_install || msg_error "post_install stage failed!"
@ -176,8 +184,8 @@ make_install()
# #
# Install package via make. # Install package via make.
# #
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args} run_rootcmd no ${make_cmd} ${make_install_target} \
[ $? -ne 0 ] && msg_error "installing $pkgname-$lver." ${make_install_args} || msg_error "installing $pkgname-$lver"
# Unset build vars. # Unset build vars.
unset_build_vars unset_build_vars