Some changes for better use of postinstall_helpers and run_stuff_*.

Introduce run_stuff_<state>_<stage>_cmd. These are used to run
a specific command before or after the specified stage.

Introduce two new helpers: fontconfig-update.sh and mkfontxx-rebuild.sh.
The first runs fc-cache once fontconfig is installed, the second
rebuilds the fonts.dir and fonts.scale files in a directory for
a template.

Allow run_stuff_* to execute a script with any path, not just
from PKGFS_TEMPLATESDIR.

That means that now if you install GTK+ and any fonts package,
gtk-demo will work without any additional stuff.

--HG--
extra : convert_revision : c8aa7eb8d1ab958f64808af0d4c1cce8760d012e
This commit is contained in:
Juan RP 2008-10-06 16:57:36 +02:00
parent ef661f001c
commit 6ade2fe36a
10 changed files with 91 additions and 26 deletions

View File

@ -0,0 +1,9 @@
#
# This helpers runs fc-cache after fontconfig has been installed,
# and update its list of fonts.
#
if [ -x $PKGFS_MASTERDIR/bin/fc-cache ]; then
$PKGFS_MASTERDIR/bin/fc-cache -f
[ "$?" -eq 0 ] && echo "=> Updated fontconfig fonts cache."
fi

View File

@ -0,0 +1,25 @@
#
# This helper rebuilds the fonts.dir and fonts.scale files in a
# directory specified by a template.
#
[ -z "$fonts_dir" ] && return 1
[ ! -d "$fonts_dir" ] && $mkdir_cmd -p $fonts_dir
mkfontdir_cmd=$PKGFS_MASTERDIR/bin/mkfontdir
mkfontscale_cmd=$PKGFS_MASTERDIR/bin/mkfontscale
if [ -x $mkfontdir_cmd -a -x $mkfontscale_cmd ]; then
save_path=$(pwd -P 2>/dev/null)
cd $fonts_dir && $mkfontdir_cmd && $mkfontscale_cmd
if [ "$?" -eq 0 ]; then
echo "=> Updated $fonts_dir/fonts.dir."
echo "=> Updated $fonts_dir/fonts.scale."
fi
cd $save_path
unset save_path
fi
unset fonts_dir
unset mkfontdir_cmd
unset mkfontscale_cmd

View File

@ -34,7 +34,6 @@
# to errors and slow.
# - Multiple distfiles in a package.
# - Multiple URLs to download source distribution files.
# - Support adding filters to templates to avoid creating useless links.
#
# Default path to configuration file, can be overriden
# via the environment or command line.
@ -311,8 +310,11 @@ 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 \
postinstall_helpers version"
run_stuff_after_install_file make_build_target \
run_stuff_before_configure_cmd run_stuff_before_build_cmd \
run_stuff_before_install_cmd run_stuff_after_install_cmd \
make_install_target postinstall_helpers version \
ignore_files"
for i in ${TMPL_VARS}; do
eval unset "$i"
@ -538,8 +540,10 @@ build_tmpl_sources()
# Run stuff before configure.
for i in "$run_stuff_before"; do
if [ "$i" = "configure" ]; then
local bcf="$PKGFS_TEMPLATESDIR/$run_stuff_before_configure_file"
[ -f $bcf ] && . $bcf
[ -f $run_stuff_before_configure_file ] && \
. $run_stuff_before_configure_file
[ -n "$run_stuff_before_configure_cmd" ] && \
${run_stuff_before_configure_cmd}
fi
done
@ -615,8 +619,10 @@ build_tmpl_sources()
#
for i in ${run_stuff_before}; do
if [ "$i" = "build" ]; then
local bbf="$PKGFS_TEMPLATESDIR/$run_stuff_before_build_file"
[ -f $bbf ] && . $bbf
[ -f $run_stuff_before_build_file ] && \
. $run_stuff_before_build_file
[ -n "$run_stuff_before_build_cmd" ] && \
${run_stuff_before_build_cmd}
fi
done
@ -636,8 +642,10 @@ build_tmpl_sources()
#
for i in ${run_stuff_before}; do
if [ "$i" = "install" ]; then
local bif="$PKGFS_TEMPLATESDIR/$run_stuff_before_install_file"
[ -f $bif ] && . $bif
[ -f $run_stuff_before_install_file ] && \
. $run_stuff_before_install_file
[ -n "$run_stuff_before_install_cmd" ] && \
${run_stuff_before_install_cmd}
fi
done
@ -658,8 +666,10 @@ build_tmpl_sources()
#
for i in ${run_stuff_after}; do
if [ "$i" = "install" ]; then
local aif="$PKGFS_TEMPLATESDIR/$run_stuff_after_install_file"
[ -f $aif ] && . $aif
[ -f $run_stuff_after_install_file ] && \
. $run_stuff_after_install_file
[ -n "$run_stuff_after_install_cmd" ] && \
${run_stuff_after_install_cmd}
fi
done
@ -704,6 +714,7 @@ stow_tmpl()
local infodir_pkg="share/info/dir"
local infodir_master="$PKGFS_MASTERDIR/share/info/dir"
local real_xstowargs="$xstow_args"
local real_xstow_ignore="$xstow_ignore_files"
[ -z "$pkg" ] && return 2
@ -722,7 +733,11 @@ stow_tmpl()
xstow_args="$xstow_args -i-file-in-dir $infodir_pkg"
fi
$PKGFS_XSTOW_CMD -ignore ${xstow_ignore_files} ${xstow_args} \
if [ -n "$ignore_files" ]; then
xstow_ignore_files="$xstow_ignore_files $ignore_files"
fi
$PKGFS_XSTOW_CMD -ignore "${xstow_ignore_files}" ${xstow_args} \
-pd-targets $PKGFS_MASTERDIR \
-dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
$PKGFS_DESTDIR/$pkg
@ -733,8 +748,6 @@ stow_tmpl()
echo "==> Created \`$pkg' symlinks into master directory."
fi
xstow_args="$real_xstowargs"
installed_tmpl_handler register $pkgname $version
#
@ -748,6 +761,9 @@ stow_tmpl()
local pihf="$PKGFS_TMPLHELPDIR/$i"
[ -f "$pihf" ] && . $pihf
done
xstow_ignore_files="$real_xstow_ignore"
xstow_args="$real_xstowargs"
}
#
@ -757,6 +773,7 @@ stow_tmpl()
unstow_tmpl()
{
local pkg="$1"
local real_xstow_ignore="$xstow_ignore_files"
if [ -z "$pkg" ]; then
echo "*** ERROR: template wasn't specified? ***"
@ -770,9 +787,13 @@ unstow_tmpl()
run_file $PKGFS_TEMPLATESDIR/$pkg.tmpl
if [ -n "$ignore_files" ]; then
xstow_ignore_files="$xstow_ignore_files $ignore_files"
fi
$PKGFS_XSTOW_CMD -dir $PKGFS_DESTDIR -target $PKGFS_MASTERDIR \
-D -i-file-in-dir share/info/dir -ignore ${xstow_ignore_files} \
$PKGFS_DESTDIR/$pkgname-$version
-D -i-file-in-dir share/info/dir -ignore \
"${xstow_ignore_files}" $PKGFS_DESTDIR/$pkgname-$version
if [ "$?" -ne 0 ]; then
exit 1
else
@ -781,6 +802,8 @@ unstow_tmpl()
fi
installed_tmpl_handler unregister $pkgname $version
xstow_ignore_files="$real_xstow_ignore"
}
#

View File

@ -17,3 +17,8 @@ long_desc="
- Times
This is from the modular Xorg project."
# Build fonts.dir and fonts.scale files after install.
fonts_dir="$PKGFS_MASTERDIR/lib/X11/fonts/100dpi"
postinstall_helpers="mkfontxx-rebuild.sh"
ignore_files="fonts.scale fonts.dir"

View File

@ -17,3 +17,8 @@ long_desc="
- Times
This is from the modular Xorg project."
# Build fonts.dir and fonts.scale files after install.
fonts_dir="$PKGFS_MASTERDIR/lib/X11/fonts/100dpi"
postinstall_helpers="mkfontxx-rebuild.sh"
ignore_files="fonts.scale fonts.dir"

View File

@ -1,6 +0,0 @@
#
# Replace perl path in bdftrunace.pl before installing.
#
. $PKGFS_TMPLHELPDIR/perl-replace-path.sh
perl_transform_file $wrksrc/bdftruncate.pl

View File

@ -16,4 +16,5 @@ long_desc="
# Transform bdftruncate.pl with correct path.
run_stuff_before="build"
run_stuff_before_build_file="$pkgname-runstuff-before-build.sh"
run_stuff_before_build_file="$PKGFS_TMPLHELPDIR/perl-replace-path.sh"
run_stuff_before_build_cmd="perl_transform_file $wrksrc/bdftruncate.pl"

View File

@ -37,3 +37,6 @@ long_desc="
rendering mechanisms).
* depend on the X Window System in any fashion, so that printer only
applications do not have such dependencies."
# Run fc-cache once installed.
postinstall_helpers="fontconfig-update.sh"

View File

@ -20,4 +20,4 @@ long_desc="
only supports C. Support for other languages is being considered."
run_stuff_before="build"
run_stuff_before_build_file="$pkgname-runstuff-before-build.sh"
run_stuff_before_build_file="$PKGFS_TEMPLATESDIR/$pkgname-runstuff-before-build.sh"

View File

@ -25,6 +25,6 @@ long_desc="
# Perl needs to be handled specially and we have to transform some
# definitions to look at the correct directory.
run_stuff_before="build"
run_stuff_before_build_file="perl-runstuff-before-build.sh"
run_stuff_before_build_file="$PKGFS_TEMPLATESDIR/perl-runstuff-before-build.sh"
run_stuff_after="install"
run_stuff_after_install_file="perl-runstuff-after-install.sh"
run_stuff_after_install_file="$PKGFS_TEMPLATESDIR/perl-runstuff-after-install.sh"