diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2002-10-20 20:40:12 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2002-10-20 20:40:12 +0000 |
commit | 36af5aca33f36f46c3d9e8042bf9a36d64550e95 (patch) | |
tree | 8a1b6d5cd5a4cf6c41ebec4d9ec1ce9b301a80be /x11-base | |
parent | sparc check fixed (diff) | |
download | gentoo-2-36af5aca33f36f46c3d9e8042bf9a36d64550e95.tar.gz gentoo-2-36af5aca33f36f46c3d9e8042bf9a36d64550e95.tar.bz2 gentoo-2-36af5aca33f36f46c3d9e8042bf9a36d64550e95.zip |
fix font stuff
Diffstat (limited to 'x11-base')
-rw-r--r-- | x11-base/xfree/ChangeLog | 10 | ||||
-rw-r--r-- | x11-base/xfree/files/4.2.1/xfs.conf.d | 11 | ||||
-rw-r--r-- | x11-base/xfree/files/4.2.1/xfs.config | 1 | ||||
-rw-r--r-- | x11-base/xfree/files/4.2.1/xfs.start | 155 | ||||
-rw-r--r-- | x11-base/xfree/xfree-4.2.1.ebuild | 67 |
5 files changed, 220 insertions, 24 deletions
diff --git a/x11-base/xfree/ChangeLog b/x11-base/xfree/ChangeLog index a0f65bdca226..10425223bf2f 100644 --- a/x11-base/xfree/ChangeLog +++ b/x11-base/xfree/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for x11-base/xfree # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/ChangeLog,v 1.47 2002/10/13 04:55:02 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/ChangeLog,v 1.48 2002/10/20 20:40:12 azarah Exp $ + + 20 Oct 2002; Martin Schlemmer <azarah@gentoo.org> xfree-4.2.1.ebuild : + + Remove /usr/X11R6/lib/X11/fonts/encodings from /etc/X11/fs/config. + Get the font stuff in pkg_postinst() sane. This should fix bug #9357. + Should also fix bug #9354 if you specify -e option to ttmkfdir. + + Update /etc/init.d/xfs to scan and index font dirs. 13 Oct 2002; Martin Schlemmer <azarah@gentoo.org> xfree-4.2.1.ebuild : diff --git a/x11-base/xfree/files/4.2.1/xfs.conf.d b/x11-base/xfree/files/4.2.1/xfs.conf.d index d5f0362ee61b..3734cdddef09 100644 --- a/x11-base/xfree/files/4.2.1/xfs.conf.d +++ b/x11-base/xfree/files/4.2.1/xfs.conf.d @@ -1,6 +1,6 @@ # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/files/4.2.1/xfs.conf.d,v 1.1 2002/09/08 20:02:04 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/files/4.2.1/xfs.conf.d,v 1.2 2002/10/20 20:40:12 azarah Exp $ # Config file for /etc/init.d/xfs @@ -12,3 +12,12 @@ XFS_PORT="-1" + +# If this is set to "yes", then the xfs rc-script will +# scan all the font directories in /etc/X11/fs/config for +# changes, and if any, will add the required files. This +# may take a while on very old boxes, so set it to "no" +# if it takes too long for you. + +SETUP_FONTDIRS="yes" + diff --git a/x11-base/xfree/files/4.2.1/xfs.config b/x11-base/xfree/files/4.2.1/xfs.config index d8bc52b30d68..8ff44914b592 100644 --- a/x11-base/xfree/files/4.2.1/xfs.config +++ b/x11-base/xfree/files/4.2.1/xfs.config @@ -32,7 +32,6 @@ catalogue = /usr/X11R6/lib/X11/fonts/75dpi, /usr/X11R6/lib/X11/fonts/Speedo, /usr/X11R6/lib/X11/fonts/truetype, /usr/X11R6/lib/X11/fonts/TTF, - /usr/X11R6/lib/X11/fonts/encodings, /usr/X11R6/lib/X11/fonts/cyrillic, /usr/X11R6/lib/X11/fonts/freefont, /usr/X11R6/lib/X11/fonts/sharefont, diff --git a/x11-base/xfree/files/4.2.1/xfs.start b/x11-base/xfree/files/4.2.1/xfs.start index eb5bbdaf2858..23e3ffcbe761 100644 --- a/x11-base/xfree/files/4.2.1/xfs.start +++ b/x11-base/xfree/files/4.2.1/xfs.start @@ -1,7 +1,8 @@ #!/sbin/runscript # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/files/4.2.1/xfs.start,v 1.1 2002/09/08 20:02:04 azarah Exp $ +# Author: Martin Schlemmer <azarah@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/files/4.2.1/xfs.start,v 1.2 2002/10/20 20:40:12 azarah Exp $ #NB: Config is in /etc/conf.d/xfs @@ -19,8 +20,160 @@ check_config() { return 0 } +# Return 0 on change, or 1 on no change, or if dir do not exist +check_md5sum() { + local x="" + local fontlist="" + + # If the dir do not exist, e + if [ ! -d $1 ] + then + return 1 + fi + + # Create a list of all non known config files in the font dir + fontlist="$(find $1/ -type f -maxdepth 1 | egrep -v 'fonts\..*' | egrep -v '*.\.dir')" + + if [ ! -f $1/fonts.md5 ] + then + # No md5 file exist, so create it and return 0 to add this font + # dir as a candidate for updating... + > $1/fonts.md5 + echo "${fontlist}" | xargs -i md5sum {} >> $1/fonts.md5 + + return 0 + else + local retval=1 + + # If any md5 checksum fails, this dir should be updated. + if [ -n "$(md5sum -c $1/fonts.md5 2> /dev/null | egrep "FAILED")" ] + then + retval=0 + fi + + # Check that no files was added or removed.... + if [ "${retval}" -ne 0 ] && \ + [ -n "${fontlist}" -o -n "$(cat $1/fonts.md5)" ] + then + if [ "$(awk '{print $2}' $1/fonts.md5 | md5sum)" != "$(echo "${fontlist}" | md5sum)" ] + then + retval=0 + fi + fi + + # OK, something changed, so recreate fonts.md5 and add as candidate + # for updating... + if [ "${retval}" -eq 0 ] + then + > $1/fonts.md5 + echo "${fontlist}" | xargs -i md5sum {} >> $1/fonts.md5 + + return 0 + fi + fi + + return 1 +} + +# This is a brain dead function to extract font dirs from +# the xfs config file (/etc/X11/fs/config). +get_fontdir_list() { + local dowrite=1 + + set -f + + (awk '!/^#|^\t+#/ { print $0 }' /etc/X11/fs/config) | while read line + do + if [ "${line/catalogue}" != "${line}" ] + then + dowrite=0; + fi + + if [ "${dowrite}" -eq 0 ] + then + # Do not print the 'catalogue = ' bit, or any ',' + echo "${line/catalogue*=}" | sed -e 's:,::g' + + if [ "$(echo ${line} | sed -e 's:,::g')" = "${line}" ] + then + dowrite=1 + fi + fi + done + + set +f +} + +# This is the main beast for setting up the font dirs +setup_font_dirs() { + local x="" + local pending_fontdirs="" + + # While we at it, update fontconfig's cache as well + if [ -x /usr/bin/fc-cache ] + then + /usr/bin/fc-cache + fi + + if [ ! -x /usr/X11R6/bin/mkfontdir -o ! /usr/X11R6/bin/ttmkfdir2 ] + then + ewarn "Could not find mkfontdir or ttmkfdir2 binary!" + return 0 + fi + + /usr/X11R6/bin/mkfontdir -n \ + -e /usr/X11R6/lib/X11/fonts/encodings \ + -e /usr/X11R6/lib/X11/fonts/encodings/large \ + -- /usr/X11R6/lib/X11/fonts/encodings + + ebegin "Scanning font dirs" + for x in $(get_fontdir_list) + do + if check_md5sum ${x} + then + if [ -z "${pending_fontdirs}" ] + then + pending_fontdirs="${x}" + else + pending_fontdirs="${pending_fontdirs} ${x}" + fi + fi + done + eend 0 + + if [ -n "${pending_fontdirs}" ] + then + ebegin "Indexing font dirs" + for x in ${pending_fontdirs} + do + einfo " ${x}..." + if [ "${x/encodings}" = "${x}" ] + then + /usr/X11R6/bin/ttmkfdir2 \ + -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir \ + -o ${x}/fonts.scale -d ${x} &> /dev/null + fi + + if [ "${x/encodings}" = "${x}" ] + then + /usr/X11R6/bin/mkfontdir \ + -e /usr/X11R6/lib/X11/fonts/encodings \ + -e /usr/X11R6/lib/X11/fonts/encodings/large \ + -- ${x} &> /dev/null + fi + done + eend 0 + fi +} + start() { check_config || return 1 + + if [ "${SETUP_FONTDIRS}" = "yes" ] + then + setup_font_dirs + fi + ebegin "Starting X Font Server" if [ "`grep -e "^xfs:" /etc/passwd`" ] ; then start-stop-daemon --start --quiet --exec /usr/X11R6/bin/xfs \ diff --git a/x11-base/xfree/xfree-4.2.1.ebuild b/x11-base/xfree/xfree-4.2.1.ebuild index 99946683978b..266ebab10d1c 100644 --- a/x11-base/xfree/xfree-4.2.1.ebuild +++ b/x11-base/xfree/xfree-4.2.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/xfree-4.2.1.ebuild,v 1.18 2002/10/20 11:31:15 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-base/xfree/xfree-4.2.1.ebuild,v 1.19 2002/10/20 20:40:12 azarah Exp $ IUSE="sse nls mmx truetype 3dnow 3dfx" @@ -470,36 +470,63 @@ pkg_postinst() { if [ "${ROOT}" = "/" ] then - einfo "Making font dirs..." - LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/X11R6/lib" \ - find ${ROOT}/usr/X11R6/lib/X11/fonts/* -type d -maxdepth 1 \ - -exec ${ROOT}/usr/X11R6/bin/mkfontdir {} \; + einfo "Creating FC font cache..." + ${ROOT}/usr/bin/fc-cache - einfo "Creating fonts.scale files..." - find ${ROOT}/usr/X11R6/lib/X11/fonts/* -type d -maxdepth 1 \ - -exec ${ROOT}/usr/X11R6/bin/ttmkfdir2 -o {}/fonts.scale -d {} \; + # This one cause ttmkfdir to segfault :/ + rm -f ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/large/gbk-0.enc.gz - einfo "Creating FC font cache..." - /usr/bin/fc-cache + # These could be from old installations, and should not be present + find ${ROOT}/usr/X11R6/lib/X11/fonts/encodings -type f -name 'fonts.*' \ + -exec rm -f {} \; + + # ******************************************************************** + # A note about fonts and needed files: + # + # 1) Create /usr/X11R6/lib/X11/fonts/encodings/encodings.dir + # + # 2) Create font.scale for TrueType fonts (need to do this before + # we create fonts.dir files, else fonts.dir files will be + # invalid for TrueType fonts...) + # + # 3) Now Generate fonts.dir files. + # + # CID fonts is a bit more involved, but as we do not install any, + # I am not going to bother. + # + # <azarah@gentoo.org> (20 Oct 2002) + # + # ******************************************************************** - einfo "Generating encodings..." - rm -f ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/fonts.{cache-1,dir,scale} + einfo "Generating encodings.dir..." # Create the encodings.dir in /usr/X11R6/lib/X11/fonts/encodings - cd ${ROOT}/usr/X11R6/lib/X11/fonts/encodings LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/X11R6/lib" \ ${ROOT}/usr/X11R6/bin/mkfontdir -n \ -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings \ - -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/large - # Now create encodings.dir for the fonts + -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/large \ + -- ${ROOT}/usr/X11R6/lib/X11/fonts/encodings + + einfo "Creating fonts.scale files..." + for x in $(find ${ROOT}/usr/X11R6/lib/X11/fonts/* -type d -maxdepth 1) + do + if [ "${x/encodings}" = "${x}" ] + then + ${ROOT}/usr/X11R6/bin/ttmkfdir2 \ + -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/encodings.dir \ + -o ${x}/fonts.scale -d ${x} + fi + done + + einfo "Generating fonts.dir files..." for x in $(find ${ROOT}/usr/X11R6/lib/X11/fonts/* -type d -maxdepth 1) do - if [ "${x}" != "${ROOT}/usr/X11R6/lib/X11/fonts/encodings" ] + if [ "${x/encodings}" = "${x}" ] then - cd ${x} LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/X11R6/lib" \ - ${ROOT}/usr/X11R6/bin/mkfontdir -n \ + ${ROOT}/usr/X11R6/bin/mkfontdir \ -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings \ - -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/large + -e ${ROOT}/usr/X11R6/lib/X11/fonts/encodings/large \ + -- ${x} fi done @@ -510,7 +537,7 @@ pkg_postinst() { # Switch to the xfree implementation. # Use new opengl-update that will not reset user selected # OpenGL interface ... - /usr/sbin/opengl-update --use-old xfree + ${ROOT}/usr/sbin/opengl-update --use-old xfree fi # make sure all the Compose files are present |