diff --git a/helper-templates/fontconfig-update.sh b/helper-templates/fontconfig-update.sh new file mode 100755 index 00000000000..aa31d42a59f --- /dev/null +++ b/helper-templates/fontconfig-update.sh @@ -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 diff --git a/helper-templates/mkfontxx-rebuild.sh b/helper-templates/mkfontxx-rebuild.sh new file mode 100755 index 00000000000..f55370ea3c6 --- /dev/null +++ b/helper-templates/mkfontxx-rebuild.sh @@ -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 diff --git a/pkgfs.sh b/pkgfs.sh index 6625e1727ac..5033dd8a4b7 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -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" } # diff --git a/templates/font-adobe-100dpi.tmpl b/templates/font-adobe-100dpi.tmpl index a09df5b698b..a744da9c4e0 100755 --- a/templates/font-adobe-100dpi.tmpl +++ b/templates/font-adobe-100dpi.tmpl @@ -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" diff --git a/templates/font-adobe-75dpi.tmpl b/templates/font-adobe-75dpi.tmpl index 0a6ae7d33cb..095425cace5 100755 --- a/templates/font-adobe-75dpi.tmpl +++ b/templates/font-adobe-75dpi.tmpl @@ -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" diff --git a/templates/font-util-runstuff-before-build.sh b/templates/font-util-runstuff-before-build.sh deleted file mode 100644 index 7be2c9a0088..00000000000 --- a/templates/font-util-runstuff-before-build.sh +++ /dev/null @@ -1,6 +0,0 @@ -# -# Replace perl path in bdftrunace.pl before installing. -# - -. $PKGFS_TMPLHELPDIR/perl-replace-path.sh -perl_transform_file $wrksrc/bdftruncate.pl diff --git a/templates/font-util.tmpl b/templates/font-util.tmpl index 00918071647..740fe265591 100755 --- a/templates/font-util.tmpl +++ b/templates/font-util.tmpl @@ -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" diff --git a/templates/fontconfig.tmpl b/templates/fontconfig.tmpl index accaa2690a5..7db14d4b822 100755 --- a/templates/fontconfig.tmpl +++ b/templates/fontconfig.tmpl @@ -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" diff --git a/templates/libpng.tmpl b/templates/libpng.tmpl index 74aa24aa4e8..003e200f09e 100755 --- a/templates/libpng.tmpl +++ b/templates/libpng.tmpl @@ -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" diff --git a/templates/perl.tmpl b/templates/perl.tmpl index c0e6a9d1fb6..df3465b0c94 100755 --- a/templates/perl.tmpl +++ b/templates/perl.tmpl @@ -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"