xbps-src: revamped build_style.

By default now it's assumed that if $build_style is not set, the template
uses 'custom-install' build, .e.g do_{build,configure,install}.

If it's set, a helper with the same name with .sh extension will be sourced
to set do_{build,configure,install} phases.

The exception is "meta-template" which currently it must be set via
build_style, probably will change in the future.
This commit is contained in:
Juan RP 2011-10-24 14:12:09 +02:00
parent 31452a3a22
commit 90204b7b28
9 changed files with 86 additions and 123 deletions

View file

@ -0,0 +1,12 @@
#
# This helper is for templates using configure scripts (not generated
# by the GNU autotools).
#
do_configure() {
[ -z "$configure_script" ] && configure_script="./configure"
${configure_script} ${configure_args}
}
# configure scripts use make(1) to build/install.
. $XBPS_HELPERSDIR/gnu-makefile.sh

View file

@ -0,0 +1,18 @@
#
# This helper is for templates using GNU configure script.
#
# This variable can be used for packages wanting to use common arguments
# to GNU configure scripts.
#
export CONFIGURE_SHARED_ARGS="--prefix=/usr --sysconfdir=/etc \
--infodir=/usr/share/info --mandir=/usr/share/man \
--localstatedir=/var"
do_configure() {
[ -z "$configure_script" ] && configure_script="./configure"
${configure_script} ${CONFIGURE_SHARED_ARGS} ${configure_args}
}
# GNU configure scripts use make(1) to build/install.
. $XBPS_HELPERSDIR/gnu-makefile.sh

View file

@ -0,0 +1,26 @@
#
# This helper is for templates using GNU Makefiles.
#
do_build() {
if [ -z "$make_cmd" ]; then
make_cmd=make
fi
if [ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ]; then
makejobs="-j$XBPS_MAKEJOBS"
fi
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
}
do_install() {
local target
if [ -z "$make_install_target" ]; then
target="DESTDIR=${DESTDIR} install"
else
target="${make_install_target}"
fi
if [ -z "$make_cmd" ]; then
make_cmd=make
fi
${make_cmd} ${make_install_args} ${target}
}

View file

@ -4,17 +4,15 @@
#
# Required vars to be set by a template:
#
# build_style=perl_module
# build_style=perl-module
#
# Optionally if the module needs more directories to be configured other
# than $XBPS_BUILDDIR/$wrksrc, one can use (relative to $wrksrc):
#
# perl_configure_dirs="blob/bob foo/blah"
#
perl_module_build()
{
local perlmkf=
do_configure() {
local perlmkf
if [ -z "$perl_configure_dirs" ]; then
perlmkf="$wrksrc/Makefile.PL"
@ -41,3 +39,6 @@ perl_module_build()
fi
done
}
# Perl modules use standard make(1) to install.
. ${XBPS_HELPERSDIR}/gnu-makefile.sh

View file

@ -1,14 +1,11 @@
#
# This helper is for templates installing python modules.
#
do_build()
{
do_build() {
python setup.py build ${make_build_args}
}
do_install()
{
do_install() {
if [ -z "$make_install_args" ]; then
make_install_args="--prefix=/usr --root=$DESTDIR"
fi