Added three new helpers to be used by packages requiring GTK+ and

by pango itself.

To be able to run those helpers once the package has been stowned
properly, another variable available for templates has been added:
"postinstall_helpers".

This accepts a list of template helper names, e.g:

postinstall_helpers="gtk-update-gdkpixbufloaders.sh gtk-update-immodules.sh".

Also rather than setting extract_cmd itself in pkgfs.sh when
extract_sufx=".zip", set it in the helper itself.

--HG--
extra : convert_revision : 0f55c35f201daf6ff2e6d18cc808d0a34d8f4ddf
This commit is contained in:
Juan RP 2008-10-03 17:19:37 +02:00
parent ce2680b740
commit 9078783ed1
8 changed files with 85 additions and 6 deletions

View file

@ -0,0 +1,17 @@
#
# This helper updates GTK's gdk-pixbug.loaders modules file every time
# a template requests this process.
#
gtk_version="2.0"
gdk_pixbuf_query_cmd=$PKGFS_MASTERDIR/bin/gdk-pixbuf-query-loaders
gdk_pixbuf_db=$PKGFS_SYSCONFDIR/gtk-$gtk_version/gdk-pixbuf.loaders
if [ -x $gdk_pixbuf_query_cmd -a -w $gdk_pixbuf_db ]; then
$gdk_pixbuf_query_cmd > $gdk_pixbuf_db
[ "$?" -eq 0 ] && \
echo "=> Updated GTK+ $(basename $gdk_pixbuf_db) modules file."
fi
unset gtk_version
unset gdk_pixbuf_query_cmd
unset gdk_pixbuf_dbfile

View file

@ -0,0 +1,17 @@
#
# This helper updates GTK's gtk.immodules modules file every time
# a template requests this process.
#
gtk_version="2.0"
gtk_query_immodules_cmd=$PKGFS_MASTERDIR/bin/gtk-query-immodules-$gtk_version
gtk_immodules_db=$PKGFS_SYSCONFDIR/gtk-$gtk_version/gtk.immodules
if [ -x $gtk_query_immodules_cmd -a -w $gtk_immodules_db ]; then
$gtk_query_immodules_cmd > $gtk_immodules_db
[ "$?" -eq 0 ] && \
echo "=> Updated GTK+ $(basename $gtk_immodules_db) modules file."
fi
unset gtk_version
unset gtk_query_immodules_cmd
unset gtk_immodules_db

View file

@ -0,0 +1,16 @@
#
# This helper updates the pango modules file when the pango package
# has been properly installed and stowned.
#
pango_query_modules_cmd=$PKGFS_MASTERDIR/bin/pango-querymodules
pango_query_modules_db=$PKGFS_SYSCONFDIR/pango/pango.modules
if [ -x $pango_query_modules_cmd -a -w $pango_query_modules_db ]; then
$pango_query_modules_cmd > $pango_query_modules_db
[ "$?" -eq 0 ] && \
echo "=> Updated Pango's $pango_query_modules_db modules file."
fi
unset pango_query_modules_cmd
unset pango_query_modules_db

4
helper-templates/unzip-extraction.sh Normal file → Executable file
View file

@ -1,7 +1,7 @@
#
# This helper is used in templates using extract_sufx=".zip".
# This checks if unzip is installed and installs it if it's not
# and sets the unzip_cmd variable appropiately.
# and sets the unzip_cmd/extract_cmd variables appropiately.
#
unzip_version="5.52"
@ -23,4 +23,6 @@ fi
unset save_pkgname
unset unzip_version
unzip_cmd=$PKGFS_MASTERDIR/bin/unzip
extract_cmd="$unzip_cmd -x $dfile -d $PKGFS_BUILDDIR"

View file

@ -283,7 +283,8 @@ reset_tmpl_vars()
run_stuff_before run_stuff_after \
run_stuff_before_configure_file run_stuff_before_build_file \
run_stuff_before_install_file run_stuff_after_install \
make_build_target make_install_target"
make_build_target make_install_target \
postinstall_helpers"
for i in ${TMPL_VARS}; do
eval unset "$i"
@ -331,8 +332,7 @@ check_tmpl_vars()
if [ -f "$PKGFS_TMPLHELPDIR/unzip-extraction.sh" ]; then
. $PKGFS_TMPLHELPDIR/unzip-extraction.sh
fi
# $unzip_cmd set by the helper.
extract_cmd="$unzip_cmd -x $dfile -d $PKGFS_BUILDDIR"
# $extract_cmd set by the helper
;;
*)
echo -n "*** ERROR: unknown 'extract_sufx' argument in build "
@ -627,10 +627,14 @@ build_tmpl_sources()
pkgconfig_transform_file $tmpf
done
unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG
echo "==> Installed \`$pkgname' into $PKGFS_DESTDIR/$pkgname."
#
# Once all work has been done, unset compilation vars.
#
unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG
#
# Remove $wrksrc if -C not specified.
#
@ -648,7 +652,6 @@ stow_tmpl()
local pkg="$1"
local infodir_pkg="share/info/dir"
local infodir_master="$PKGFS_MASTERDIR/share/info/dir"
local my_xstowargs=
local real_xstowargs="$xstow_args"
[ -z "$pkg" ] && return 2
@ -675,6 +678,18 @@ stow_tmpl()
xstow_args="$real_xstowargs"
installed_tmpl_handler register $pkg
#
# Run template postinstall helpers if requested.
#
if [ "$pkgname" != "$pkg" ]; then
run_file $PKGFS_TEMPLATESDIR/$pkg.tmpl
fi
for i in ${postinstall_helpers}; do
local pihf="$PKGFS_TMPLHELPDIR/$i"
[ -f "$pihf" ] && . $pihf
done
}
unstow_tmpl()
@ -911,6 +926,7 @@ install_tmpl()
# Do not stow the pkg if requested.
#
[ -z "$only_install" ] && stow_tmpl ${pkgname}
}
list_tmpls()

View file

@ -90,3 +90,8 @@
#run_stuff_before_install_file="example-before-install.sh"
#run_stuff_after="install"
#run_stuff_after_install_file="example-after-install.sh"
# Run helpers after the package has been installed and stowned.
# Helpers are located at PKGFS_DISTRIBUTIONDIR/helper-templates.
#
#postinstall_helpers="blah.sh"

View file

@ -21,3 +21,6 @@ long_desc="
languages, not only C/C++. Using GTK+ from languages such as Perl and
Python (especially in combination with the Glade GUI builder) provides
an effective method of rapid application development."
# Update db modules files once installed.
postinstall_helpers="gtk-update-immodules.sh gtk-update-gdkpixbufloaders.sh"

View file

@ -30,3 +30,6 @@ long_desc="
As well as the low level layout rendering routines, Pango includes
PangoLayout, a high level driver for laying out entire blocks of text,
and routines to assist in editing internationalized text."
# The pango.modules file needs to be updated once installed.
postinstall_helpers="pango-update-modules.sh"