diff --git a/bin/xbps-src/main.sh b/bin/xbps-src/main.sh index 8f1a578aee4..bcd9a50971e 100755 --- a/bin/xbps-src/main.sh +++ b/bin/xbps-src/main.sh @@ -229,12 +229,12 @@ build-pkg) continue fi setup_tmpl $f - xbps_make_binpkg + xbps_make_binpkg $f reset_tmpl_vars done else setup_tmpl $2 - xbps_make_binpkg + xbps_make_binpkg $2 fi ;; chroot) diff --git a/shutils/binpkg.sh b/shutils/binpkg.sh index de1aa47644a..4fef1c56dd6 100644 --- a/shutils/binpkg.sh +++ b/shutils/binpkg.sh @@ -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, # these will be used for binary packages. # -xbps_write_metadata_pkg() +xbps_write_metadata_pkg_real() { local destdir=$XBPS_DESTDIR/$pkgname-$version local metadir=$destdir/var/db/xbps/metadata/$pkgname @@ -203,11 +225,30 @@ _EOF 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 # package in destdir. # -xbps_make_binpkg() +xbps_make_binpkg_real() { local destdir=$XBPS_DESTDIR/$pkgname-$version local binpkg= diff --git a/shutils/install_funcs.sh b/shutils/install_funcs.sh index ccf146c5e5d..7f7dc7594e7 100644 --- a/shutils/install_funcs.sh +++ b/shutils/install_funcs.sh @@ -73,6 +73,18 @@ install_src_phase() 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. # diff --git a/shutils/stow_funcs.sh b/shutils/stow_funcs.sh index 8bc375d0092..810a9576932 100644 --- a/shutils/stow_funcs.sh +++ b/shutils/stow_funcs.sh @@ -23,11 +23,29 @@ # 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 # and register pkg into the package database. # -stow_pkg() +stow_pkg_real() { local pkg="$1" local automatic="$2" @@ -74,7 +92,6 @@ stow_pkg() # # Run template postinstall helpers if requested. # - run_template $pkgname for i in ${postinstall_helpers}; do local pihf="$XBPS_HELPERSDIR/$i" [ -f "$pihf" ] && . $pihf diff --git a/shutils/tmpl_funcs.sh b/shutils/tmpl_funcs.sh index 9b919e27b55..00fc99ac9d9 100644 --- a/shutils/tmpl_funcs.sh +++ b/shutils/tmpl_funcs.sh @@ -68,7 +68,7 @@ reset_tmpl_vars() build_depends libtool_fixup_la_stage no_fixup_libtool \ disable_parallel_build run_depends cross_compiler \ only_for_archs patch_args conf_files keep_dirs \ - install_priority noarch \ + install_priority noarch subpackages sourcepkg \ XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \ XBPS_BUILD_DONE XBPS_INSTALL_DONE" diff --git a/templates/proplib-dev b/templates/proplib-dev new file mode 120000 index 00000000000..3941a52d058 --- /dev/null +++ b/templates/proplib-dev @@ -0,0 +1 @@ +proplib \ No newline at end of file diff --git a/templates/proplib-docs b/templates/proplib-docs new file mode 120000 index 00000000000..3941a52d058 --- /dev/null +++ b/templates/proplib-docs @@ -0,0 +1 @@ +proplib \ No newline at end of file diff --git a/templates/proplib-libs b/templates/proplib-libs new file mode 120000 index 00000000000..3941a52d058 --- /dev/null +++ b/templates/proplib-libs @@ -0,0 +1 @@ +proplib \ No newline at end of file diff --git a/templates/proplib/dev.template b/templates/proplib/dev.template new file mode 100644 index 00000000000..69f177d10da --- /dev/null +++ b/templates/proplib/dev.template @@ -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 +} diff --git a/templates/proplib/docs.template b/templates/proplib/docs.template new file mode 100644 index 00000000000..d1e685ad220 --- /dev/null +++ b/templates/proplib/docs.template @@ -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 +} diff --git a/templates/proplib/libs.template b/templates/proplib/libs.template new file mode 100644 index 00000000000..ab149d3ad0a --- /dev/null +++ b/templates/proplib/libs.template @@ -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 +} diff --git a/templates/proplib/template b/templates/proplib/template index 4902a4147df..ffc5901bf99 100644 --- a/templates/proplib/template +++ b/templates/proplib/template @@ -1,5 +1,6 @@ # Template file for 'proplib' pkgname=proplib +sourcepkg=proplib version=0.3 distfiles="http://portableproplib.googlecode.com/files/$pkgname-$version.tar.gz" build_style=gnu_configure @@ -23,4 +24,4 @@ long_desc=" been converted to be built through the GNU autotools." base_chroot=yes -run_depends="glibc-2.8" +subpackages="dev docs libs"