From 7b9c3503fa3f19224ef66362f58c3894ab1d1ad9 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 2 Oct 2008 03:19:27 +0200 Subject: [PATCH] Make it possible to use multiple stages in run_stuff_*, e.g: run_stuff_before="configure build install" while here, document them in example.tmpl. --HG-- extra : convert_revision : acca2ad2aed2467b244037b60132cf5461057acc --- pkgfs.sh | 40 ++++++++++++++++++++++++---------------- templates/example.tmpl | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/pkgfs.sh b/pkgfs.sh index f027273eadf..baed60c5e95 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -478,10 +478,12 @@ build_tmpl_sources() export PKG_CONFIG="$PKGFS_MASTERDIR/bin/pkg-config" # Run stuff before configure. - if [ "$run_stuff_before" = "configure" ]; then - [ -f $PKGFS_TEMPLATESDIR/$run_stuff_before_configure_file ] && \ - . $PKGFS_TEMPLATESDIR/$run_stuff_before_configure_file - fi + for i in "$run_stuff_before"; do + if [ "$i" = "configure" ]; then + local bcf="$PKGFS_TEMPLATESDIR/$run_stuff_before_configure_file" + [ -f $bcf ] && . $bcf + fi + done # # Packages using GNU autoconf @@ -542,10 +544,12 @@ build_tmpl_sources() # # Run template stuff before building. # - if [ "$run_stuff_before" = "build" ]; then - [ -f $PKGFS_TEMPLATESDIR/$run_stuff_before_build_file ] && \ - . $PKGFS_TEMPLATESDIR/$run_stuff_before_build_file - fi + for i in ${run_stuff_before}; do + if [ "$i" = "build" ]; then + local bbf="$PKGFS_TEMPLATESDIR/$run_stuff_before_build_file" + [ -f $bbf ] && . $bbf + fi + done # # Build package via make. @@ -559,10 +563,12 @@ build_tmpl_sources() # # Run template stuff before installing. # - if [ "$run_stuff_before" = "install" ]; then - [ -f $PKGFS_TEMPLATESDIR/$run_stuff_before_install_file ] && \ - . $PKGFS_TEMPLATESDIR/$run_stuff_before_install_file - fi + for i in ${run_stuff_before}; do + if [ "$i" = "install" ]; then + local bif="$PKGFS_TEMPLATESDIR/$run_stuff_before_install_file" + [ -f $bif ] && . $bif + fi + done # # Install package via make. @@ -577,10 +583,12 @@ build_tmpl_sources() # # Run template stuff after installing. # - if [ "$run_stuff_after" = "install" ]; then - [ -f $PKGFS_TEMPLATESDIR/$run_stuff_after_install_file ] && \ - . $PKGFS_TEMPLATESDIR/$run_stuff_after_install_file - fi + for i in ${run_stuff_after}; do + if [ "$i" = "install" ]; then + local aif="$PKGFS_TEMPLATESDIR/$run_stuff_after_install_file" + [ -f $aif ] && . $aif + fi + done # # Transform pkg-config files if requested by template. diff --git a/templates/example.tmpl b/templates/example.tmpl index 5662090c927..2467510f4f7 100755 --- a/templates/example.tmpl +++ b/templates/example.tmpl @@ -66,3 +66,19 @@ # Second Line........................................................... # Third line... blah blah blah.......................................... # Nth line... blah blah ..............................................." + +# Use the following vars to execute arbitrary stuff at some stage +# while installing a package. +# +# There are three stages: configure, build and install; and +# also two states when this are run: before or after. +# +# Please take a look at templates/perl-run-stuff-{before,after}.sh files +# to know what to do with them. +# +#run_stuff_before="configure build install" +#run_stuff_before_configure_file="example-before-configure.sh" +#run_stuff_before_build_file="example-before-build.sh" +#run_stuff_before_install_file="example-before-install.sh" +#run_stuff_after="install" +#run_stuff_after_install_file="example-after-install.sh"