Added support to build subpackages from a single source.

proplib has been converted to see how it works.

--HG--
extra : convert_revision : dfcd1f547884108d69682e9e62b4aacfa431cc83
This commit is contained in:
Juan RP 2009-02-20 04:10:55 +01:00
parent 8cfe150f54
commit b225a1dc30
12 changed files with 133 additions and 8 deletions

View File

@ -229,12 +229,12 @@ build-pkg)
continue continue
fi fi
setup_tmpl $f setup_tmpl $f
xbps_make_binpkg xbps_make_binpkg $f
reset_tmpl_vars reset_tmpl_vars
done done
else else
setup_tmpl $2 setup_tmpl $2
xbps_make_binpkg xbps_make_binpkg $2
fi fi
;; ;;
chroot) chroot)

View File

@ -40,11 +40,33 @@ _EOF
} }
xbps_write_metadata_pkg()
{
local subpkg=
for subpkg in ${subpackages}; do
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg}
xbps_write_metadata_pkg_real
run_template ${sourcepkg}
done
if [ -n "${subpackages}" ]; then
run_template ${sourcepkg}
rm -rf $XBPS_DESTDIR/${sourcepkg}-${version}/*
unset run_depends
fi
for subpkg in ${subpackages}; do
run_depends="$run_depends ${sourcepkg}-${subpkg}-${version}"
done
xbps_write_metadata_pkg_real
}
# #
# This function writes the metadata files into package's destdir, # This function writes the metadata files into package's destdir,
# these will be used for binary packages. # these will be used for binary packages.
# #
xbps_write_metadata_pkg() xbps_write_metadata_pkg_real()
{ {
local destdir=$XBPS_DESTDIR/$pkgname-$version local destdir=$XBPS_DESTDIR/$pkgname-$version
local metadir=$destdir/var/db/xbps/metadata/$pkgname local metadir=$destdir/var/db/xbps/metadata/$pkgname
@ -203,11 +225,30 @@ _EOF
fi fi
} }
xbps_make_binpkg()
{
local pkg="$1"
local subpkg=
for subpkg in ${subpackages}; do
if [ "$pkg" = "$pkgname-$subpkg" ]; then
. $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template
pkgname=${sourcepkg}-${subpkg}
xbps_make_binpkg_real
return $?
fi
run_template ${sourcepkg}
done
xbps_make_binpkg_real
return $?
}
# #
# This function builds a binary package from an installed xbps # This function builds a binary package from an installed xbps
# package in destdir. # package in destdir.
# #
xbps_make_binpkg() xbps_make_binpkg_real()
{ {
local destdir=$XBPS_DESTDIR/$pkgname-$version local destdir=$XBPS_DESTDIR/$pkgname-$version
local binpkg= local binpkg=

View File

@ -73,6 +73,18 @@ install_src_phase()
touch -f $XBPS_INSTALL_DONE touch -f $XBPS_INSTALL_DONE
#
# Build subpackages if found.
#
for subpkg in ${subpackages}; do
msg_normal "Preparing $pkgname subpackage: $pkgname-$subpkg"
. $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template
pkgname=${sourcepkg}-${subpkg}
run_func do_install
run_template ${sourcepkg}
done
[ -n "$subpackages" ] && setup_tmpl ${sourcepkg}
# #
# Remove $wrksrc if -C not specified. # Remove $wrksrc if -C not specified.
# #

View File

@ -23,11 +23,29 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#- #-
stow_pkg()
{
local pkg="$1"
local automatic="$2"
local subpkg=
for subpkg in ${subpackages}; do
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg}
stow_pkg_real ${pkg} ${automatic}
run_template ${sourcepkg}
done
stow_pkg_real ${pkg} ${automatic}
return $?
}
# #
# Stow a package, i.e copy files from destdir into masterdir # Stow a package, i.e copy files from destdir into masterdir
# and register pkg into the package database. # and register pkg into the package database.
# #
stow_pkg() stow_pkg_real()
{ {
local pkg="$1" local pkg="$1"
local automatic="$2" local automatic="$2"
@ -74,7 +92,6 @@ stow_pkg()
# #
# Run template postinstall helpers if requested. # Run template postinstall helpers if requested.
# #
run_template $pkgname
for i in ${postinstall_helpers}; do for i in ${postinstall_helpers}; do
local pihf="$XBPS_HELPERSDIR/$i" local pihf="$XBPS_HELPERSDIR/$i"
[ -f "$pihf" ] && . $pihf [ -f "$pihf" ] && . $pihf

View File

@ -68,7 +68,7 @@ reset_tmpl_vars()
build_depends libtool_fixup_la_stage no_fixup_libtool \ build_depends libtool_fixup_la_stage no_fixup_libtool \
disable_parallel_build run_depends cross_compiler \ disable_parallel_build run_depends cross_compiler \
only_for_archs patch_args conf_files keep_dirs \ only_for_archs patch_args conf_files keep_dirs \
install_priority noarch \ install_priority noarch subpackages sourcepkg \
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \ XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
XBPS_BUILD_DONE XBPS_INSTALL_DONE" XBPS_BUILD_DONE XBPS_INSTALL_DONE"

1
templates/proplib-dev Symbolic link
View File

@ -0,0 +1 @@
proplib

1
templates/proplib-docs Symbolic link
View File

@ -0,0 +1 @@
proplib

1
templates/proplib-libs Symbolic link
View File

@ -0,0 +1 @@
proplib

View File

@ -0,0 +1,17 @@
# Template file for 'proplib-dev'.
#
short_desc="${short_desc} (development files)"
long_desc="${long_desc}
This package contains files for development, headers, static libs, etc."
run_depends="proplib-libs-0.3"
do_install()
{
local destdir=${XBPS_DESTDIR}/${pkgname}-${version}
mkdir -p ${destdir}/usr/lib
mv ${XBPS_DESTDIR}/${sourcepkg}-${version}/usr/include ${destdir}/usr
mv ${XBPS_DESTDIR}/${sourcepkg}-${version}/usr/lib/libprop.*a \
${destdir}/usr/lib
}

View File

@ -0,0 +1,17 @@
# Template file for 'proplib-docs'.
#
short_desc="${short_desc} (documentation)"
long_desc="${long_desc}
This package contains the manual pages."
run_depends=
noarch=yes
do_install()
{
local destdir=${XBPS_DESTDIR}/${pkgname}-${version}
# Move manpages.
mkdir -p ${destdir}/usr
mv ${XBPS_DESTDIR}/${sourcepkg}-${version}/usr/share ${destdir}/usr
}

View File

@ -0,0 +1,17 @@
# Template file for 'proplib-libs'.
#
short_desc="${short_desc} (libraries)"
long_desc="${long_desc}
This package contains only the ${sourcepkg} shared libraries."
run_depends="glibc-2.8"
do_install()
{
local destdir=${XBPS_DESTDIR}/${pkgname}-${version}
# Move the shared lib.
mkdir -p ${destdir}/usr/lib
mv ${XBPS_DESTDIR}/${sourcepkg}-${version}/usr/lib/libprop.so* \
${destdir}/usr/lib
}

View File

@ -1,5 +1,6 @@
# Template file for 'proplib' # Template file for 'proplib'
pkgname=proplib pkgname=proplib
sourcepkg=proplib
version=0.3 version=0.3
distfiles="http://portableproplib.googlecode.com/files/$pkgname-$version.tar.gz" distfiles="http://portableproplib.googlecode.com/files/$pkgname-$version.tar.gz"
build_style=gnu_configure build_style=gnu_configure
@ -23,4 +24,4 @@ long_desc="
been converted to be built through the GNU autotools." been converted to be built through the GNU autotools."
base_chroot=yes base_chroot=yes
run_depends="glibc-2.8" subpackages="dev docs libs"