From 9078783ed1e4f4ac02c0187cc31c9e093d60381b Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 3 Oct 2008 17:19:37 +0200 Subject: [PATCH] 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 --- .../gtk-update-gdkpixbufloaders.sh | 17 ++++++++++++ helper-templates/gtk-update-immodules.sh | 17 ++++++++++++ helper-templates/pango-update-modules.sh | 16 ++++++++++++ helper-templates/unzip-extraction.sh | 4 ++- pkgfs.sh | 26 +++++++++++++++---- templates/example.tmpl | 5 ++++ templates/gtk+-2.14.3.tmpl | 3 +++ templates/pango-1.22.0.tmpl | 3 +++ 8 files changed, 85 insertions(+), 6 deletions(-) create mode 100755 helper-templates/gtk-update-gdkpixbufloaders.sh create mode 100755 helper-templates/gtk-update-immodules.sh create mode 100755 helper-templates/pango-update-modules.sh mode change 100644 => 100755 helper-templates/unzip-extraction.sh diff --git a/helper-templates/gtk-update-gdkpixbufloaders.sh b/helper-templates/gtk-update-gdkpixbufloaders.sh new file mode 100755 index 00000000000..36fdc738905 --- /dev/null +++ b/helper-templates/gtk-update-gdkpixbufloaders.sh @@ -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 diff --git a/helper-templates/gtk-update-immodules.sh b/helper-templates/gtk-update-immodules.sh new file mode 100755 index 00000000000..0c71e53770e --- /dev/null +++ b/helper-templates/gtk-update-immodules.sh @@ -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 diff --git a/helper-templates/pango-update-modules.sh b/helper-templates/pango-update-modules.sh new file mode 100755 index 00000000000..1a4f2e2e78b --- /dev/null +++ b/helper-templates/pango-update-modules.sh @@ -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 diff --git a/helper-templates/unzip-extraction.sh b/helper-templates/unzip-extraction.sh old mode 100644 new mode 100755 index adf07ddac6c..6e8bc7de2d1 --- a/helper-templates/unzip-extraction.sh +++ b/helper-templates/unzip-extraction.sh @@ -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" diff --git a/pkgfs.sh b/pkgfs.sh index 8f74c4ccc6d..085da963cd4 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -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() diff --git a/templates/example.tmpl b/templates/example.tmpl index a98019a574d..f48d7f717f8 100755 --- a/templates/example.tmpl +++ b/templates/example.tmpl @@ -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" diff --git a/templates/gtk+-2.14.3.tmpl b/templates/gtk+-2.14.3.tmpl index ca406859e1a..a7fbec167f7 100755 --- a/templates/gtk+-2.14.3.tmpl +++ b/templates/gtk+-2.14.3.tmpl @@ -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" diff --git a/templates/pango-1.22.0.tmpl b/templates/pango-1.22.0.tmpl index 85c8be51222..aacb4767319 100755 --- a/templates/pango-1.22.0.tmpl +++ b/templates/pango-1.22.0.tmpl @@ -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"